Re: Nagios Core 4.08 don't send traps in order.
Posted: Fri Aug 05, 2016 5:23 pm
I used the $HOSTNAME$ macro and I saw an entry in the log file, but when I typed $SERVICEOUTPUT$ the script doesn't work.
Support for Nagios products and services
https://support.nagios.com/forum/
Code: Select all
|||||||||||||||||||||||||||||||||||||||||||
define command{
command_name send-service-trap
command_line /usr/bin/send-service-trap host_name public "$HOSTNAME$" "$HOSTSTATEID$" "$SERVICEDESC$" "$SERVICESTATEID$" "$SERVICEATTEMPT$" "$LASTSERVICESTATECHANGE$" "$SERVICEDURATIONSEC$" "$LASTSERVICECHECK$" "$SERVICEOUTPUT$"
}
define command{
command_name send-host-trap
command_line /usr/bin/send-host-trap IP public "$HOSTNAME$" "$HOSTSTATEID$" "$HOSTATTEMPT$" "$HOSTDURATIONSEC$" "$LASTHOSTCHECK$" "$LASTHOSTSTATECHANGE$" "$HOSTOUTPUT$"
}
|||||||||||||||||||||||||||||||||||||||||||
/usr/bin/snmptrap -v 2c -c $1 IP '' NAGIOS-NOTIFY-MIB::nHostEvent nHostName s $2 nHostStateID i $3 nHostAttempt i $4 nHostDurationSec i $5 nHostGroupName s "$6" nHostLastCheck i $7 nHostLastChange i $8 nHostOutput s "${9}"
/usr/bin/snmptrap -v 2c -c $1 IP '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$2" nHostStateID i $3 nSvcDesc s "$4" nSvcStateID i $5 nSvcAttempt i $6 nSvcDurationSec i $7 nSvcGroupName s "$8" nSvcLastCheck i $9 nSvcLastChange i ${10} nSvcOutput s "${11}"
|||||||||||||||||||||||||||||||||||||||||||
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands send-service-trap
host_notification_commands send-host-trap
define contactgroup{
contactgroup_name linuxadmins
alias Linux Servers Administrators
members me, managementstation
}
|||||||||||||||||||||||||||||||||||||||||||
traplogfile output
,,,,
EOF
,,,,
EOF
/usr/bin/snmptrap -v 2c -c host... '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "hname" nSvcDesc s "0" nSvcStateID i PING nSvcOutput s "0"
/usr/bin/snmptrap -v 2c -c host... '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "hname" nSvcDesc s "0" nSvcStateID i PING nSvcOutput s "0"