Tag Archive - snmp

create an snmp nagios plugin using python

To create a nagios plugin we need to keep in the mind the exit codes of the program/plugin which is interpreted by nagios to determine the status of the service.

1
2
3
4
5
Return Code          Status
0                         OK. The service is functioning normally
1                         WARNING. The service is about to reach to a critical state prior flagging it as CRITICAL
2                         CRITICAL. The service is down
3                         UNKNOWN. the plugin cannot determine the status of the service.

So any plugins you make should have an exit status, depending on the checks performed, here we will create a python snmp plugin using the pysnp module, the script also uses the optparse module so that arguments can be passed to the command line. Based on my previous post to monitor mysql database using mysql-snmp NetSNMP agent, I used the python pysnmp module to poll the mysql mib on the remote mysql server.

First create the host,hostgroup and the service for checking mysql innodb transactions in nagios

1
2
3
4
5
6
7
8
define host{
        use                     linux-server            ; Name of host template to use
       ; This host definition will inherit all variables that are defined
       ; in (or inherited by) the linux-server host template definition.
        host_name               mysqlserver
        alias                      mysqlserver
        address                 192.168.221.188
        }

Continue Reading…

 

monitor mysql using snmp

Monitoring mysql over snmp has various advantages, one being that you can write snmp plugins and feed them onto cacti or nagios, secondly it is less resource intensive. as SNMP works over UDP. The mysql-snmp is based on NetSNMP and connects to the remote mysql server.

First download the mysql-snmp on your remote mysql server

1
[root@fedora local]# git clone git://github.com/masterzen/mysql-snmp.git
1
2
[root@fedora local]# cd mysql-snmp
[root@fedora local]# make install

Next we configure “/etc/snmp/snmpd.conf” with the following values
Continue Reading…

 
Page 1 of 11
Theme Tweaker by Unreal