Zabbix Agent Install Script
-
Hi All...
This update is a major rewrite of the original post... The individual files can be found athttps://gitlab.wellston.biz/dafyre/zabbix-utils
The script is still located https://gitlab.wellston.biz/dafyre/zabbix-utils/raw/master/zabbix-agent-installer
zabbix-agent-installer
This assumes that you have the basic development tools installed on your system, as we will be building the Zabbix agent from source.
Ubuntu:
sudo apt-get install build-essential
RHEL / RPM based Distros:
sudo yum groupinstall DevelopmentSuSE / openSuSE / Tumbleweed
sudo zypper install -t pattern devel_C_C++Should dake care of the necessary dependencies.
There are several variables in this script that should be set for your environment.
Any of the HTTP based URLs can be left as is to pull the most recent versions, or they can be changed to be hosted on your own servers.
AGENT_URL is the URL of the Zabbix source code that is running the same version of Zabbix that is running on your server. This can be left as is to pull Zabbix 3.0.3 sources.
AGENT_CONFIG is the zabbix_agentd configuration template that will be used (the default pulls form the git repo).
AGENT_SERVICE is the web url to the systemd service file for the zabbix_agentd.
ZABBIX_SERVER is the IP address or hostname of your Zabbix server.
Windows Agents
The windows agents come pre-compiled, and I have included both 32 bit and 64 bit agents as .zip files.
32 Bit Agent: https://gitlab.wellston.biz/dafyre/zabbix-utils/raw/master/zabbix_win_agent32.zip
64 Bit Agent: https://gitlab.wellston.biz/dafyre/zabbix-utils/raw/master/zabbix_win_agent64.zip-
Extract the files into C:\zabbix_agent
-
Edit the zabbix_agentd.conf file and make sure to set Server= and ServerActive= to be the IP address of your Zabbix server. (this file is best edited with Notepad++)
-
The win-service-setup.bat file needs to be run as administrator.
original post follows
Hi All...NOTE This only installs the Zabbix AGENT. It does not install the Zabbix Server. A separate script for that will be coming soon.
I've got a Zabbix Agent install script that will install the agent from source (I tend to install the Zabbix server bits from source as well, to keep with the most recent versions).
It assumes that you have all of the necessary dependencies to build the Zabbix Agent on the target system.
https://gitlab.wellston.biz/dafyre/zabbix-utils/blob/master/zabbix-agent-installer
I have more comments in the code. If you have any questions or recommendations on it, please let me know!
I have tested this with Ubuntu 16.04. Plannting to test with others later.
Edit: The installer works on Ubuntu 16.04 and CentOS assuming you have done apt-get install build-essential on Ubuntu or yum groupinstall Development on CentOS
Edit 2: Direct download is here: https://gitlab.wellston.biz/dafyre/zabbix-utils/raw/master/zabbix-agent-installer
Edit 3: This script is meant to be run as root or via sudo!
-
-
Why aren't you installing to a folder under /opt ?
such as /opt/zabbix
-
Because /usr/local has always served that purpose for me?
I don't have to worry about modding other files (say in /etc) to get the commands be in the path variable.. (On most distros, /usr/local/bin and /usr/local/sbin are already in $PATH).
-
Ok but it's weird, applications get installed under /opt/<some folder>
-
@DustinB3403 said in Zabbix Agent Install Script:
Ok but it's weird, applications get installed under /opt/<some folder>
Only if you pass the right flags to configure.
That may be something I could try for my next re-write, lol.
-
You almost have it, you just need to change your target directories and it should work just fine.
-
Which dependencies are required prior to starting this script?
-
@DustinB3403 said in Zabbix Agent Install Script:
You almost have it, you just need to change your target directories and it should work just fine.
It already works just fine on Ubuntu and CentOS after a
apt-get install build-essential oryum groupinstall Development.
-
@dafyre said in Zabbix Agent Install Script:
@DustinB3403 said in Zabbix Agent Install Script:
You almost have it, you just need to change your target directories and it should work just fine.
It already works just fine on Ubuntu and CentOS after a
apt-get install build-essential oryum groupinstall Development.
So why not just put that into the installer script at the top?
sudo apt-get install build-essential --yes
-
@DustinB3403 said in Zabbix Agent Install Script:
@dafyre said in Zabbix Agent Install Script:
@DustinB3403 said in Zabbix Agent Install Script:
You almost have it, you just need to change your target directories and it should work just fine.
It already works just fine on Ubuntu and CentOS after a
apt-get install build-essential oryum groupinstall Development.
So why not just put that into the installer script at the top?
sudo apt-get install build-essential --yes
Because if I do that, the script barfs errors all over the place if it is run on a Non-Debian distro.
Edit: This is one of the things I plan to fix.
-
Also sloppy to use a static IP in the script.
-
@DustinB3403 said in Zabbix Agent Install Script:
Also sloppy to use a static IP in the script.
I don't have internal DNS for this, and you will see that it is a variable you can change.
During our chat, I realized that I made no mention of adjusting the variables for your environment. I'll add some documentation to it for clarification.
-
@DustinB3403 said in Zabbix Agent Install Script:
Also sloppy to use a static IP in the script.
Is it, or is it smart? If DNS is down, don't all your server show as down?
-
@aaronstuder said in Zabbix Agent Install Script:
@DustinB3403 said in Zabbix Agent Install Script:
Also sloppy to use a static IP in the script.
Is it, or is it smart? If DNS is down, don't all your server show as down?
For a public script it's sloppy, even @dafyre agreed. Its fine to be there, but it can't resolve to an internal DNS for the installation of the system. Because it's not internal for you, but internal for @dafyre
-
@DustinB3403 said in Zabbix Agent Install Script:
@aaronstuder said in Zabbix Agent Install Script:
@DustinB3403 said in Zabbix Agent Install Script:
Also sloppy to use a static IP in the script.
Is it, or is it smart? If DNS is down, don't all your server show as down?
For a public script it's sloppy, even @dafyre agreed. Its fine to be there, but it can't resolve to an internal DNS for the installation of the system. Because it's not internal for you, but internal for @dafyre
It's been fixed anyhow. Now defaults to 127.0.0.1, I think.
-
@aaronstuder said in Zabbix Agent Install Script:
@DustinB3403 said in Zabbix Agent Install Script:
Also sloppy to use a static IP in the script.
Is it, or is it smart? If DNS is down, don't all your server show as down?
Aaron does have a point in this. The good news is that the zabbix server contacts machines back via IP address when they are auto registered in the system.
-
Topic has been unattended for some time, but all your github links are giving me 404 errors...
I'm sure you are aware of this, but just in-case.. I wanted to check out your agent installer for windows scripts.
cheers.
-
@cronsloth If you are looking for WIndows Zabbix agents, I have some scripts here;
https://community.spiceworks.com/scripts/show/3985-zabbix-32-bits-client-installationhttps://community.spiceworks.com/scripts/show/3984-zabbix-64-bits-client-installation
Just make sure to have the latest agent files.
-
There is also a msi out there that you can compile yourself. Makes it a lot easier.
-
@coliver said in Zabbix Agent Install Script:
There is also a msi out there that you can compile yourself. Makes it a lot easier.
Compile yourself?