System and Network Monitoring With Zabbix Zabbix Features http://www.zabbix.com/features.php Zabbix Requirements http://www.zabbix.com/requirements.php @GARR - alfredo.pagano@garr.it Download Zabbix http://www.zabbix.com/download.php Zabbix Screenshots http://www.zabbix.com/screenshots.php In this howto we are going to install Zabbix software: agent and a server side. Each group will be provided a virtual machine with the following specifications: OS: CentOS release 5.3 (Final) Kernel: 2.6.18-128.el5 #1 SMP x86_64 x86_64 GNU/Linux 1 Gb RAM 10 GB disk space CPU 1 GHZ A basic Zabbix installation requires the following software: ntp, php, php-bcmath, php-gd, php-mysql, httpd, mysql, gcc, mysql-server, mysql-devel, netsnmp, net-snmp-utils, net-snmp-devel, net-snmp-libs, curl-devel mak All the dependencies should have already been satisfied Connect via SSH to: IP: Username: root Password:
1. We need to create a user the server process will run as. This will need to be repeated on any devices running agent. Zabbix server is actually protected from being run under root. # useradd zabbix 2. Download the lastest Zabbix version available and untar it. # cd /home/zabbix # wget http://garr.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.6.5.tar.gz # tar -xzvf zabbix-1.6.5.tar.gz 3. Start MySQL and change the root password. # /etc/init.d/mysqld start Now you need to connect to MySQL using the newly created root password, create a database and assign a new user with privileges to the DB. I used zabbixuser and zabbixpass for the username and password but you may want to change it to your own preference. Don t make it the same as your root or DB login, since it will be stored in a plaintext file. # mysql -u root -p (no password required) mysql> CREATE DATABASE zabbix; mysql> GRANT DROP,INDEX,CREATE,SELECT,INSERT,UPDATE,ALTER,DELETE ON zabbix.* TO zabbixuser@localhost IDENTIFIED BY 'zabbixpass'; mysql> quit; 4. Insert the schema, using zabbixpass when prompted for password. # cd zabbix-1.6.5 # cat create/schema/mysql.sql mysql -u zabbixuser -p zabbix # cat create/data/data.sql mysql -u zabbixuser -p zabbix # cat create/data/images_mysql.sql mysql -u zabbixuser -p zabbix 5. Now configure and compile the source code on your system. #./configure -enable-server -enable-agent -prefix=/usr/local/zabbix -with-mysql -with-net-snmp -with-libcurl # make && make install # make clean 6. Add the Zabbix server and agent ports to your /etc/services file. # echo zabbix_agent 10050/tcp >> /etc/services # echo zabbix_trap 10051/tcp >> /etc/services REMEMBER: IF YOU HAVE IPTABLES TURNED ON YOU WILL NEED TO OPEN PORT 80, 10050, & 10051 7. Copy the sample config files to /etc/zabbix for server and agentd. # mkdir /etc/zabbix # cp misc/conf/zabbix_agentd.conf /etc/zabbix # cp misc/conf/zabbix_server.conf /etc/zabbix 8. Change the DB login info using your favorite editor. # vim /etc/zabbix/zabbix_server.conf
DBUser=zabbixuser BPassword=zabbixpass 9. Add the server IP address and change the hostname. We have agent and server on the same box. # vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1 Hostname=EnterAUniqueHostNameForEachAgent 10. Copy and edit the control scripts to start/stop/restart server and agent. # cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd # cp misc/init.d/redhat/zabbix_server_ctl /etc/init.d/zabbix_server In /etc/init.d/zabbix_agentd: BASEDIR=/usr/local/zabbix ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd In /etc/init.d/zabbix_server: BASEDIR=/usr/local/zabbix ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server 11. We are almost done. Now we need to set up automatic starting and stopping of certain services: # chkconfig level 345 zabbix_server on # chkconfig level 345 zabbix_agentd on # chkconfig level 345 httpd on # chkconfig level 345 mysqld on # /etc/init.d/iptables stop 12. Copy the front end setup files. # cp -r frontends/php /var/www/html/zabbix Edit /etc/php.ini and check the execution time value and timezone. Make sure you substitute with your own timezone. max_execution_time = 300 date.timezone = Europe/Rome 13. Start apache web server and change write permissions on the config file: # /etc/init.d/httpd start # chmod 777 /var/www/html/zabbix/conf 14. Open http://your.server.ip/zabbix in your web browser and follow the setup. When you configure the DB connection use zabbixuser/zabbixpass. Some screenshots:
15. We also need to change the permissions on the apache config file so we don t fudge it in the future. # chmod 755 /var/www/html/zabbix/conf 16. Start agent and server # /etc/init.d/zabbix_agentd start # /etc/init.d/zabbix_server start If everything goes through fine you can log in to the server through http://your.server.ip/zabbix. User Admin for the username and password zabbix To monitor your Zabbix server, you can go to the Configuration Tab, and choose the hosts sub Tab. Select the Zabbix Server host, by putting a checkmark next to it. and choose the Activate Selected button below or just click on Not Monitored. Wait a minute or two, then select the Monitoring tab, and then the latest data sub tab. You should start seeing performance stats appear! That s it, your Zabbix server should now be good to go. Enjoy! You can find a lot more info on this wonderful program on Zabbix Forums and in the ZABBIX Manual.