SNMPTT and external file
Posted: Wed Oct 19, 2011 10:26 am
Hi all,
My Nagios receives traps handled by SNMPTT.
I'd like to send the traps to different nagios-services based on the text of the trap.
In order to perform this feature, I manage the text of the trap using a PREEXEC command (SNMPTT) and an external script (/home/user/check_trap)
$r is the host and $p1 is the service name provided by the external script that contains the rules to determine the right service based on the trap text (for example containing an IP address).
There is a way to do not use an external script but simplest a SNMPTT command an a external file that will contains the same rules of the script to determine the right service?
The external file may be like this:
If the trap text contains 192.168.0.7 the destination nagios-service is service2, so the EXEC command will be
Thanks a lot,
marco
My Nagios receives traps handled by SNMPTT.
I'd like to send the traps to different nagios-services based on the text of the trap.
In order to perform this feature, I manage the text of the trap using a PREEXEC command (SNMPTT) and an external script (/home/user/check_trap)
Code: Select all
PREEXEC /home/user/check_trap "trap text" # --> $p1
EXEC /usr/lib/nagios/plugins/eventhandlers/submit_check_result $r $p1 1 "error"
There is a way to do not use an external script but simplest a SNMPTT command an a external file that will contains the same rules of the script to determine the right service?
The external file may be like this:
Code: Select all
service1 192.168.0.5
service2 192.168.0.7
service3 192.168.0.9
Code: Select all
EXEC /usr/lib/nagios/plugins/eventhandlers/submit_check_result host service2 1 "error"
marco