Page 1 of 1

Nagios SNMP Trap Generate Every 5 Mins

Posted: Mon Aug 29, 2016 10:12 am
by srikgali
I want to Generate SNMP Trap Every 5 minutes in Nagios, which will be send to BPPM monitoring Tool. We had already Nagios to BPPM Integration. but we want to setup heartbeat trap to BPPM to check whether Nagios Snmp is working. Can i know how can i achive it?

How can i generate SNMP Trap Every 5 Mins?

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Mon Aug 29, 2016 1:19 pm
by tmcdonald

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Mon Aug 29, 2016 1:26 pm
by ssax
You could create a cron job that does it:

Code: Select all

*/5 * * * * root /path/to/your/script.sh

Code: Select all

#!/bin/bash

# script.sh

/usr/bin/snmptrap -v2c -cpublic 127.0.0.1 $(date +'%s') .1.3.6.1.6.3.1.1.5.1

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Mon Aug 29, 2016 2:01 pm
by gormank
Its pretty simple to create a command in Nagios and then a service running every 5 minutes if you really want to run it from Nagios. There's no external script--its all in Nagios. I did create a symlink to snmptrap in libexec though. The only real difference is in Nagios, the schedule is flexible and execution time will drift, while cron will run it when scheduled.

The command: $USER1$/snmptrap $ARG1$

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Mon Aug 29, 2016 4:11 pm
by ssax
Thanks gormank for another option, srikgali, let us know if either of those work for you.

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Tue Aug 30, 2016 10:10 am
by srikgali
Thanks For the update, This is helpful.

Re: Nagios SNMP Trap Generate Every 5 Mins

Posted: Tue Aug 30, 2016 1:51 pm
by mcapra
Awesome! Let us know if you have further questions.