### SYNCSORT PASSIVE BACKUP CHECKS FOR NAGIOS HOWTO ### DATE: 17-09-2010 Written by Remco Hage RealOpenIT BV Informaticalaan 7 2628ZD DELFT The Netherlands Phone: 0031 15 256 8969 email: rhage@realopenit.nl In this readme, i describe howto reveive passive service results from synscort backup into Nagios. This article is not very complete so pay attention to the steps. It requires Nagios knowlegde, also you need to know how passive checks works in Nagios, and know some bash scripting. Global view on how it works: 1) snmptrapd service receives traps from syncsort server. 2) snmptrapd sends traps to SNMPTT. SNMPTT "translate" these traps, for this translation it uses the MIBS in SNMPTT.CONF. 3) SNMPTT forwards translated traps to Nagios via $USER1/submit_check_result to the external command file wih an status code and plugin output from syncsort message. 4) Nagios recognizes this as a passice check result and display's it as service (if there is one). # Software requirements Suse: install snmp-net perl-snmp en snmptt via 1 click installer ubuntu/debian: install libnet-snmp-perl libsnmp snmptrapfmt snmpd # suse only Set in /etc/init.d/snmptrapd: CONFIG="-c /etc/snmp/snmptrapd.conf" startproc $BINARY $OPTIONS $CONFIG # Ubuntu/Debian: make sure snmpd, snmptrapfmt and snmptt service are running. /etc/snmp/snmptrapd.conf: traphandle default /usr/sbin/snmptt disableAuthorization yes donotlogtraps yes execute: /etc/init.d/snmptrapd restart ### ADD MIBS to the system touch TRAP-TEST-MIB.txt in /usr/share/snmp/mibs (just for testing snmptraps) put in the file: TRAP-TEST-MIB DEFINITIONS ::= BEGIN IMPORTS ucdExperimental FROM UCD-SNMP-MIB; demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 } demo-trap TRAP-TYPE STATUS current ENTERPRISE demotraps VARIABLES { sysLocation } DESCRIPTION "This is just a demo" ::= 17 END restart the snmpd services and send a test string: snmptrap -v 1 -c public localhost TRAP-TEST-MIB::demotraps localhost 6 17 '' SNMPv2-MIB::sysLocation.0 s "Just here" If no errors, you should see some results in /var/log/snmptrapd.log, like this: 2009-12-10 15:49:22 localhost [127.0.0.1] (via UDP: [127.0.0.1]:44084->[127.0.0.1]) TRAP, SNMP v1, community public .1.3.6.1.4.1.2021.13.990 Enterprise Specific Trap (17) Uptime: 2 days, 0:01:19.23 .1.3.6.1.2.1.1.6.0 = STRING: Just here Reveiving strings via snmp-trapd service is working... # FOR MORE INFO: http://www.net-snmp.org/wiki/index.php/TUT:Using_and_loading_MIBS ### SNMPTT TO NAGIOS ### Now we take care that snmptt sends it's results to Nagios. Now put the submit_check_result from monitoring exchange in: /usr/local/nagios/libexec/eventhandlers/submit_check_result Make sure the script is executable and the Nagios user has rights chmod +x /usr/local/nagios/libexec/eventhandlers/submit_check_result chown nagios.nagios /usr/local/nagios/libexec/eventhandlers/submit_check_result Now convert the mibs, so SNMPTT knows wat to send: ( you have to get the bex_mib.hp from the syncsort cd and put in in /usr/share/snmp/mibs ) so for Syncsort it is: snmpttconvertmib --in=/usr/share/snmp/mibs/bex_mib.hp --out=/etc/snmp/snmptt.conf --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 0' /etc/snmp/SNMPTT.conf: EVENT bexStarts .1.3.6.1.4.1.2245.1.0.1 "Status Events" INFORMATIONAL FORMAT Backup Express Started: Backup Express Release $1 started. EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r SYNCSORT-$1 0 "Backup Express Started: Backup Express Release $1 started." SDESC Backup Express Started Variables: 1: bexVersion EDESC # See "submit_check_result $r SYNCSORT-$1 0" is important. This means the hostname is $r, the service name is SYNSORT-syncsort-backup-name and gets status one in Nagios, so it gives an OK. If you have the right service, get into syncsort interface, put nagios in as SNMP server, and start and cancel a backup, so you can see if the results are comming in. SNMPTT recognizes the mibs/oids and send the results to the submit_check_result script Submit_check_result reads out the errors, and puts it in the external command file. To check if the script is being executes at all, you could put something like this in the submit_check_result for testing: logger -p WARNING SUBMIT_CHECK_RESULT_TEST Then you should at least see something in /var/log/messages, BUT... Nagios is not regognizing the hosts/service yet... We continue.. # SEE MORE INFO: http://www.snmptt.org/docs/snmpttconvertmib.shtml # MORE INFO: http://www.snmptt.org/docs/snmptt.shtml#Nagios-Netsaint ### PASSIVE RESULTS FROM SYNCSORT IN NAGIOS ### To show trap results in Nagios create a new service template. I call it just "passive_service" here for test, but you might want to call it syncsort_service or anything. # passive check template define service{ name passive_service use generic-service active_checks_enabled 0 passive_checks_enabled 1 obsess_over_service 1 flap_detection_enabled 1 register 0 is_volatile 0 retain_status_information 1 retain_nonstatus_information 1 check_period 24x7 max_check_attempts 3 normal_check_interval 60 retry_check_interval 30 contact_groups admins check_freshness 1 freshness_threshold 5000 check_command give_ok } add to commands.cfg: define command{ command_name give_ok command_line /usr/local/nagios/libexec/check_dummy 0 "OK: NO ERRORS RECEIVED.." } (give_ok set status as OK if Nagios not receives results. If Nagios reveices an error via SNMP, it gives critical, but watch the freshness_threshold carefull!!!) execute /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg If no errors, check the Nagios log for the right service name, and create the service in Nagios wich uses the passive_service template. ###################################### ### EXTRA INFORMATION ABOUT MIBS ETC # ###################################### ### write you own mibs ### http://www.net-snmp.org/wiki/index.php/Writing_your_own_MIBs ### Sources ### http://xavier.dusart.free.fr/joomla/index.php/en/nagios/47-traps-snmp-dans-nagios http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html http://technotes.twosmallcoins.com/?p=369 http://www.sage.org/lists/sage-members-archive/2005/msg03326.html If you have problems, questions, don't hestitate to contact us. We are after all an open source company that deliveres services!