Nagios Core 4.08 don't send traps in order.
-
Nagios_Admin_M
- Posts: 77
- Joined: Fri Jul 22, 2016 4:39 am
Re: Nagios Core 4.08 don't send traps in order.
I used the $HOSTNAME$ macro and I saw an entry in the log file, but when I typed $SERVICEOUTPUT$ the script doesn't work.
Re: Nagios Core 4.08 don't send traps in order.
Ok, let's get a fresh copy of all the things needed so that we can figure out what is going on, please attach:
1. Your send-service-trap script
2. Your command definition that calls the script
3. Your service config for an example service
Then I can point you in the right direction.
Thank you
1. Your send-service-trap script
2. Your command definition that calls the script
3. Your service config for an example service
Then I can point you in the right direction.
Thank you
-
Nagios_Admin_M
- Posts: 77
- Joined: Fri Jul 22, 2016 4:39 am
Re: Nagios Core 4.08 don't send traps in order.
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"
Last edited by tmcdonald on Wed Aug 17, 2016 9:53 am, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
Reason: Please use [code][/code] tags around long output
Re: Nagios Core 4.08 don't send traps in order.
The only thing I see different is that the send-service-trap command, you are using the host_name instead of the IP address, is the host_name resolvable to an IP address on the nagios server?
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
Nagios_Admin_M
- Posts: 77
- Joined: Fri Jul 22, 2016 4:39 am
Re: Nagios Core 4.08 don't send traps in order.
I can share the kind of way I accomplished the task with you.
I stared the command_line by assigning the values to my variables:
" command_line var0=$HOSTNAME$ etc... "
I created a send.trap script:
/usr/bin/send.trap
/usr/bin/send_trap .......................... var0
and populated vars to:
/usr/bin/sendtrap ............................. nHostname etc...
I finally got the traps sent.
ALTHOUGH your solutions send values directly to /usr/bin/sendtrap Net-snmp script and uses only one file instead of 2 as my,
I took this approach because I couldn't get all the values wright the the script.
I stared the command_line by assigning the values to my variables:
" command_line var0=$HOSTNAME$ etc... "
I created a send.trap script:
/usr/bin/send.trap
/usr/bin/send_trap .......................... var0
and populated vars to:
/usr/bin/sendtrap ............................. nHostname etc...
I finally got the traps sent.
ALTHOUGH your solutions send values directly to /usr/bin/sendtrap Net-snmp script and uses only one file instead of 2 as my,
I took this approach because I couldn't get all the values wright the the script.
Re: Nagios Core 4.08 don't send traps in order.
Glad that you have it working now. Shall I close and lock the post as solved?
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
Nagios_Admin_M
- Posts: 77
- Joined: Fri Jul 22, 2016 4:39 am
Re: Nagios Core 4.08 don't send traps in order.
Yes, you can.