February
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...
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
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.
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
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=#ALTER USER zabbix WITH PASSWORD 'uioprehjdsnmc';
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
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.
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
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.
Note | |
---|---|
Several weeks later, we see that after a few days, Zabbix has stopped collecting data.
The web GUI is very slow (reloading a page takes half a minute or so.
The load on the Zabbix server is below 0.4, but all
Restarting the Zabbix server doesn't fix the defunct processes, but it does reveal that the CacheSize is too low.
According to the manual page on the server config of this version, we can set CacheSize to anywhere between 128K and 1G, the default being 8M.
We set it to 32M, and restart the server.
Now it's running again.
Allegedly, in order to set it any higher, it is necessary to first adjust some kernel parameters with
Or, according to thread 61016 on the Zabbix forum: Spesific for FreeBSD machine: kern.ipc.shmall=2097152 kern.ipc.shmmax=2147483648 kern.ipc.shmmni=4096 kern.ipc.semmsl=250 kern.ipc.semmns=32000 kern.ipc.semopm=100 kern.ipc.semmni=128
|