Using Zabbix
In Ubuntu 12.04:
Linux ternminal commands
wget "http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.3/zabbix-2.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fzabbix%2F&ts=1352420382&use_mirror=iweb" tar zxvf zabbix-2.0.3.tar.gz cd zabbix-2.0.3/ groupadd zabbix useradd -g zabbix zabbix cd database/mysql/ mysql -u root -p create database zabbix character set utf8; mysql -u root -p zabbix <schema.sql mysql -u root -p zabbix <images.sql mysql -u root -p zabbix <data.sql cd ../../ sudo apt-get install libmysqlclient18 libmysqlclient-dev sudo apt-get install libcurl4-openssl-dev sudo apt-get install libsnmp-base libsnmp-dev ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl sudo make install sudo mkdir /var/www/zabbix cd frontends/php/ sudo cp -a . /var/www/zabbix sudo chmod 644 /var/www/zabbix sudo service apache2 restart add database password at zabbix_server cnfiguration: sudo gedit /usr/local/etc/zabbix_server.conf zabbix_server Browse to http://yourhostname/zabbix and login as admin with a password of zabbix. Login as admin with a password of zabbix Configure zabbix. In case some tests fail. Edit /etc/php5/apache2/php.ini and modify parameters. in case zabbix web says no connection to zabbix server. disable firewall. sudo ufw disable
Configure traps
read this document. We used the perl trap receiver
Creating a python client to send traps:
- download&Install PySNMP: in ubuntu sudo easy_install pysnmp
- then I've found this example that creates a simple trap event.
python example
from pysnmp.entity.rfc3413.oneliner import ntforg from pysnmp.proto import rfc1902 ntfOrg = ntforg.NotificationOriginator() ntfOrg.sendNotification( ntforg.CommunityData('public'), ntforg.UdpTransportTarget(('localhost', 162)), 'trap', ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), ('1.3.6.1.2.1.1.1.0', rfc1902.OctetString('my system')) )
Known Problems
- the whole process is not trivial. The configuration of zabbix is not automated at all.
- if the firewall is enabled then the server cannot start
- Configuring the trap is very tricky. I've tried SNMPTT as well. The configuration scripts are not obvious. It requires also to define the MIB that you are going to use without any example.
- Zabbix requires to change the trap format by adding ZBXTRAP keyword as described [here].