We want to use Zabbix to monitor a bunch of PC's running Ubuntu Karmic, but the Zabbix server has to run on Debian Lenny. Lenny has only version 1.4 of Zabbix, which doesn't work well with clients of version 1.6. So we install 1.8 from backports, help Zabbix through the firewalls, and start gathering data...
Procedure 27.3. Installing Zabbix 1.8 on Debian Lenny
Preparing to fetch lenny-backports packages
We need to fetch Zabbix 1.8 from the lenny-backports repository, so we edit /etc/apt/sources.list
:
<snip> deb http://www.backports.org/debian lenny-backports main contrib non-free deb-src http://www.backports.org/debian lenny-backports main contrib non-free
We don't want to upgrade all of our packages to the lenny-backports
version, so we also create /etc/apt/apt.conf.d/80version
:
APT::Default-Release "lenny";
Then we update the repository metadata cache, install the keys for the backports repository, and update once more:
apt-get update
apt-get install debian-backports-keyring
apt-get update
Installing the Zabbix server
apt-get install -t lenny-backports zabbix-server-pgsql zabbix-frontend-php
Debconf offers to use dbconfig-common
to install the database.
Use it, because otherwise the database will be created, but the tables will not.
Transferring the database to a separate host
The above installation brings in postgresql-8.1 (8.4?) as a dependency, which is already better than just installing zabbix-frontend-php
and having mysql
tagging along even though you answer “postgres” to the question which database you want.
But in order to have the database on a database server, we need to transfer it manually.
So we dump the database on the zabbix server:
sudo -u postgres pg_dump zabbix > zabbix.sql
... then we create the database on the database server:
sudo -u postgres createuser zabbix
sudo -u postgres createdb zabbix -o zabbix
sudo -u postgres psql
ALTER USER zabbix WITH PASSWORD 'uioprehjdsnmc';
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
postgres=#
Now we can state in /etc/zabbix/zabbix_server.conf
that
DBHost=dbserver.mydomain.com DBName=zabbix DBUser=zabbix DBPassword=uioprehjdsnmc
... and in /etc/zabbix/dbconfig.php
that:
$DB["TYPE"] = "pgsql"; $DB["SERVER"] = "dbserver.mydomain.com"; $DB["PORT"] = "0"; $DB["DATABASE"] = "zabbix"; $DB["USER"] = "zabbix"; $DB["PASSWORD"] = "uioprehjdsnmc"; $ZBX_SERVER = "127.0.0.1"; $ZBX_SERVER_PORT = "10051";
For Zabbix to run without complaint, we also need in /etc/php5/conf.d/forZabbix.ini
:
post_max_size = 50M; upload_max_filesize = 50M; mbstring.func_overload = 2;
And finally we restart the server and reload the GUI:
sudo /etc/init.d/zabbix-server restart
sudo /etc/init.d/apache2 reload
Configuring Zabbix
Now that Zabbix is running, we can make it show on the web with this in the Apache config:
Alias /zabbix/ "/usr/share/zabbix/" <Directory "/usr/share/zabbix/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>
First thing to do is to log in on Zabbix with the default username “Admin” and its password “zabbix”.
Once logged in, a new Super Admin account should be created, and impossible-to-guess passwords should be set on all Super Admin accounts including Admin
.
Then, host groups
should be made and discovery rules
, and actions
should be created that add hosts to these host groups as soon as they are discovered.
Configuring the client(s)
In /etc/zabbix/zabbix_agent.conf
, the server must be mentioned, and we can set the maximum time per request (from the server) the client may spend on Zabbix:
Server=lwp23.service.rug.nl Timeout=15
The Zabbix daemon that answers the requests from the server must also be configured, in /etc/zabbix/zabbix_agentd.conf
:
Server=zabbox.mydomain.com Hostname=some.client.mydomain.com <snip> Timeout=15
And we must restart the daemon for the settings to take effect:
/etc/init.d/zabbix-agent restart
Leading Zabbix through the firewalls
On the client, ufw
is running, so configuring is simple:
sudo ufw allow proto tcp from 129.125.36.118 to any port 10050
On the server, plain iptables
is at work:
sudo iptables -A INPUT -s 10.0.23.0/24 -d 10.0.133.78/32 -p tcp -m tcp -m state --state NEW -m multiport --dports 10051 -j ACCEPT
It may be necessary to restart the server after opening up the firewall.