Zabbix under Ubuntu 9.10
ZABBIX [zabbix.com] is an enterprise-class distributed monitoring solution designed to monitor and track performance and availability of network servers, devices, and other resources. It supports distributed and Web-based monitoring, auto-discovery, real-time monitoring, SLA assurance, trending, and more.
Key features
Open Source solution
Runs on AIX, FreeBSD, HP-UX, Linux, MacOS X, NetBSD, OpenBSD, Solaris, Tru64/OSF
SQL database for storing configuration, collected data and trends
Web interface offers minimal learning, ubiquitous access
Instant drill down from real-time status of IT Services to historical trend and statistics
Data visualisation and mapping
High performance native ZABBIX agents for performance and integrity monitoring for virtually all platforms (UNIX, Win32)
Monitoring of “agentless” environments (define)
Assuring and monitoring Service Levels
Monitoring of SNMP (v1,v2,v3) devices
Recommend Not Installing from Ubuntu Repository.
Installed the Zabbix packages from Synaptic, with an eye to following instructions here [zabbix.com]. Problems and solutions:
Ubuntu 9.10 repository contains Zabbix 1.6.4 which is a very old version. For this reason alone, please see "Installing Version 1.8.1" below.
The Ubuntu install script fails because it does not create a 'zabbix' user. You can use the Gnome admin screens, or your favorite command line program (useradd, adduser) to add user 'zabbix' ... I used uid=200 so it wouldn't be displayed in the login (gdm) screen.
Once you do this, the install script requires your postgres password (if you install the postgres backend) repeatedly. Ideally that should be prompted in the GUI part of the installer, but instead you have to open the "Show Details" terminal window and type it in, manually, over and over.
After installation is complete, if you look in the log file you will see:
/usr/sbin/zabbix_server [26588]: Cannot create PID file [/var/run/zabbix-server/zabbix_server.pid] [Permission denied] /usr/sbin/zabbix_server [26588]: ERROR: Cannot create PID file [/var/run/zabbix-server/zabbix_server.pid] [Permission denied]
This is because the owner of the directory has to be 'zabbix' -- As root, do this:
# chown zabbix /var/run/zabbix-server # /etc/init.d/zabbix-server start
and now when you browse to http://192.168.1.1/zabbix (change 192.168.1.1 to your server) you should be able to login with the default username Admin and the password zabbix -- and see that the: Zabbix server is running: Yes
I was unable to resolve the remaining error in the log entry, "Unable to create mutex" which has to do with locking the logfile.
Installing Zabbix 1.8.1 from Source
Preparing your server
Install the required packages
sudo apt-get install build-essential gnustep-make
sudo apt-get install linux-headers-$(uname -r)
sudo apt install ntp ntpdate
Now you need to edit /etc/ntp.conf file and change your NTP servers after that restart ntp using the following comamnd
sudo /etc/init.d/ntp restart
Be sure you have a timezone defined for PHP, placing a value from the list of recognized zones [php.org] in file apache2/php.ini:
date.timezone =America/Phoenix
Next, create a zabbix user:
sudo adduser
**
zabbix **
and create a password.
Install the following packages
sudo apt-get install apache2 postgresql-8.3 postgresql-server-dev-8.3 php5 php5-gd php5-pgsql snmp libsnmp-dev snmpd libcurl4-openssl-dev fping libiksemel3 libiksemel-dev
Install postgresql web GUI admin application using the following command
sudo apt-get install phppgadmin
Now you need to login as root
sudo su -
sudo -u
**
postgres * psql postgres password postgres password123 q; ubuntu and Postgres Usernames (both = zabbix * ) are the same so they can work in unison
sudo -u
**
postgres * createuser --superuser zabbix * sudo -u
**
postgres * createdb zabbix *
Now you can login to psql without sudo
Now you need to login as zabbix user
su -
**
zabbix ** cd /home/
**
zabbix **
Download zabbix latest version from here [zabbix.com]
tar zxvpf
**
zabbix ** -1.8.1.tar.gz
cd
**
zabbix ** -1.8.1/create/schema
cat postgresql.sql | psql
**
zabbix ** cd ../data
cat data.sql | psql
**
zabbix ** cat images_pgsql.sql | psql
**
zabbix ** cd ..
cd ..
sudo ./
**
configure **
`
` enable-server
`
` enable-agent
`
` with-pgsql
`
` with-net-snmp
`
` with-jabber=/usr/
`
` with-libcurl
sudo make install
Now you need to add the following ports to services file
sudo nano /etc/services
Add at the following ports
zabbix_agent 10050/tcp zabbix_trap 10051/tcp
Save and exit the file
sudo mkdir /etc/
**
zabbix ** sudo chown -R
**
zabbix * . zabbix /etc/ zabbix * /
cp misc/conf/zabbix_* /etc/
**
zabbix ** /
Now we need to edit the agent config file
nano /etc/
**
zabbix ** /zabbix_agentd.conf
Make sure that the Server parameter points to the server ip address, for the agent that runs on the
server it is like this: Server=127.0.0.1 change to xxx.xxx.xxx.xxx
AND REMOVE # from ListenIP=127.0.0.1 AND CHANGE IT to ListenIP=xxx.xxx.xxx.xxx
Save and exit the file
Now we need to edit the server config file
nano /etc/
**
zabbix ** /zabbix_server.conf
For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site,
this is the place.
Change this:
Database user
DBUser=zabbix
Database password
Comment this line if no password used
DBPassword=password123
AND REMOVE # from ListenIP=127.0.0.1 AND CHANGE IT to ListenIP=X.X.X.X (your server ip)
Save and exit the file
Now copy the zabbix server,agent startup scripts for to /etc/init.d location
sudo cp misc/init.d/debian/
**
zabbix ** -server /etc/init.d
sudo cp misc/init.d/debian/
**
zabbix ** -agent /etc/init.d
Now we need to change of destination path in server and agent configuration files
For zabbix server config file
sudo nano /etc/init.d/
**
zabbix ** -server
Look for the following line:
DAEMON=/home/
**
zabbix ** /bin/${NAME}
and replace it with:
DAEMON=/usr/sbin/${NAME}
For zabbix server config file
sudo nano /etc/init.d/
**
zabbix ** -agent
Look for the following line:
DAEMON=/home/
**
zabbix ** /bin/${NAME}
and replace it with:
DAEMON=/usr/sbin/${NAME}
Save and exit the file
Add the zabbix server and agent config files to startup
sudo chmod 755 /etc/init.d/<strong>zabbix</strong>-server
sudo update-rc.d <strong>zabbix</strong>-server defaults
sudo chmod 755 /etc/init.d/<strong>zabbix</strong>-agent
sudo update-rc.d <strong>zabbix</strong>-agent defaults
Now you can start zabbix server and agent using the following command
sudo /etc/init.d/<strong>zabbix</strong>-server start
sudo /etc/init.d/<strong>zabbix</strong>-agent start
You can check the processes using the following command
ps -aux | grep
**
zabbix ** cd /home/
**
zabbix * / zabbix * -1.8.1/
mkdir /home/
**
zabbix ** /public_html
cp -R frontends/php/* /home/
**
zabbix ** /public_html/
Create a symbolic link to an Apache configuration:
ln -s /home/zabbix/apache.conf /etc/apache2/conf.d/zabbix
That configuration file should read:
Alias /zabbix /home/<strong>zabbix</strong>/public_html
<Directory /home/<strong>zabbix</strong>/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
php_value max_execution_time 300
php_value memory_limit 128M
php_value upload_max_filesize 16M
php_value post_max_size 16M
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Also in /etc/php5/apache2/php.ini update the mbstring function overload capabilites line as follows:
mbstring.func_overload = 2
(adding this as a php_value in zabbix's apache.conf has no effect).
Change php.ini file memory limit and time settings
sudo nano /etc/php5/apache2/php.ini
Change the following values:
max_execution_time = 300 ; Maximum execution time of each script, in seconds date.timezone = Europe/Copenhagen
Allow postgres user to access webadmin console to do this edit /usr/share/phppgadmin/conf/config.inc.php,/etc/phppgadmin/apache.conf files
sudo nano /usr/share/phppgadmin/conf/config.inc.php
CHANGE:
$conf['extra_login_security'] = true;
TO:
$conf['extra_login_security'] = false;
sudo nano /etc/phppgadmin/apache.conf
CHANGE:
deny from all
TO:
allow from all
Restart apache server using the following command
sudo /etc/init.d/apache2 restart
Point your browser to http://localhost/zabbix ... or http://serverip/zabbix ... and you should see:
Welcome to the Zabbix frontend installation wizard. This installation wizard will guide you through the installation of Zabbix frontend
You will then arrive at a confirmation screen of your configuration values:
Current value
Required
Recommended
PHP version
5.2.10-2ubuntu6.4
5.0
5.3.0
Ok
PHP memory limit
50M
128M
256M
Fail
PHP post max size
8M
16M
32M
Fail
PHP max execution time
30
300
600
Fail
PHP timezone
America/Phoenix
Ok
PHP databases support
MySQL PostgreSQL
Ok
PHP BC math
yes
Ok
PHP MB string
yes
Ok
PHP MB string overload
no
Fail
PHP Sockets
yes
Ok
PHP GD
2.0
2.0
2.0.34
Ok
GD PNG Support
yes
Ok
libxml module
2.7.5
2.6.15
2.7.6
Ok
ctype module
yes
Ok
(final result) Fail
Please correct all issues and press "Retry" button
Ah, well if you see that -- you haven't added the right values to the apache.conf and the global php.ini file -- see above. Once you do, you should be able to proceed...
After a couple more clicks you will get to a screen saying
Configuration file: Fail
at which point you should click Save Configuration file, and put that file (or a copy of its contents) into /home/zabbix/conf/zabbix.conf.php as directed. It should look like:
global $DB;
$DB["TYPE"] = "POSTGRESQL"; $DB["SERVER"] = "localhost"; $DB["PORT"] = "0"; $DB["DATABASE"] = "zabbix"; $DB["USER"] = "zabbix"; $DB["PASSWORD"] = "yourpassword"; $ZBX_SERVER = "localhost"; $ZBX_SERVER_PORT = "10051";
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?>
User Admin password zabbix
In ZABBIX: Configuration / Hosts / Zabbix server should be yourserver ip instead of for 127.0.0.1