Nagios Core 4.08 don't send traps in order.
Re: Nagios Core 4.08 don't send traps in order.
Did you fix the error from your previous post as that could be the problem?
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.
[1470235656] wproc: NOTIFY job 545 from worker Core Worker 28031 is a non-check helper but exited with return code 127
[1470235656] wproc: host=...,...,...,...; service=...,...,...,...; contact=user1
[1470235656] wproc: early_timeout=0; exited_ok=1; wait_status=32512; error_code=0;
[1470235656] wproc: stderr line 01: /bin/sh: ...: command not found
I do not know what is 127 error code.
I do not know what last line means either.
[1470235656] wproc: host=...,...,...,...; service=...,...,...,...; contact=user1
[1470235656] wproc: early_timeout=0; exited_ok=1; wait_status=32512; error_code=0;
[1470235656] wproc: stderr line 01: /bin/sh: ...: command not found
I do not know what is 127 error code.
I do not know what last line means either.
Re: Nagios Core 4.08 don't send traps in order.
You may want to edit the nagios.cfg file and enable debugging and restart nagios, then check the nagios.debug log for that error and which script is causing it.
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 have in nagios.debug:
TCP OK - 0.042 second response time on 42.1.234.145 port 80
I found also
....$SERVICEOUTPUT$ /usr/bin/send_trap'
TCP OK - 0.042 second response time on 42.1.234.145 port 80
I found also
....$SERVICEOUTPUT$ /usr/bin/send_trap'
Re: Nagios Core 4.08 don't send traps in order.
I would assume this is causing the error
Check your command definition and see if it is correct.....$SERVICEOUTPUT$ /usr/bin/send_trap
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.
[1470332185.319560] [2048.1] [pid=7466] Processing: '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ | var2=$HOSTNAME$ var3=$HOSTSTATEID$ var5=$SERVICEDESC$ var6=$SERVICESTATEID$ var9=$SERVICEATTEMPT$ var8=$LASTSERVICESTATECHANGE$ var7=$SERVICEDURATIONSEC$ var10=$LASTSERVICECHECK$ var11=$SERVICEOUTPUT$ /usr/bin/send_trap'
Re: Nagios Core 4.08 don't send traps in order.
It looks like you need to change the notify-service-by-email command. Try the example below and see if that works. You may have to edit it for your needs.
Code: Select all
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$; /usr/bin/send-host-trap '$HOSTNAME$' '$HOSTSTATEID$' '$SERVICEDESC$' '$SERVICESTATEID$' '$SERVICEATTEMPT$' '$LASTSERVICESTATECHANGE$' '$SERVICEDURATIONSEC$' '$LASTSERVICECHECK$' '$SERVICEOUTPUT$'
}
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 used yours command definition created log file see the values.
#send-service-trap
cat << EOF >> /logfile
'$HOSTNAME$' '$HOSTSTATEID$' '$SERVICEDESC$' '$SERVICESTATEID$' '$SERVICEATTEMPT$' '$LASTSERVICESTATECHANGE$' '$SERVICEDURATIONSEC$' '$LASTSERVICECHECK$' '$SERVICEOUTPUT$'
EOF
#logfile
'host_name '$' '$' '$' '$' '$' '$' '$' '$' '$'
This is what I got. Although an email is sent plus there is a full date log in the nagios.log file.
#send-service-trap
cat << EOF >> /logfile
'$HOSTNAME$' '$HOSTSTATEID$' '$SERVICEDESC$' '$SERVICESTATEID$' '$SERVICEATTEMPT$' '$LASTSERVICESTATECHANGE$' '$SERVICEDURATIONSEC$' '$LASTSERVICECHECK$' '$SERVICEOUTPUT$'
EOF
#logfile
'host_name '$' '$' '$' '$' '$' '$' '$' '$' '$'
This is what I got. Although an email is sent plus there is a full date log in the nagios.log file.
Re: Nagios Core 4.08 don't send traps in order.
Is this what you have in your command definition or is it your send-service-trap script?
If it is your script, try this:
- Note: I just added ${10} so you can see how to use multiple digit ones
You can only access the variables in your script with $0, $1, $2, etc, it will not know about the nagios macros, only the arguments that it's passed in.
Thank you
Code: Select all
#send-service-trap
cat << EOF >> /logfile
'$HOSTNAME$' '$HOSTSTATEID$' '$SERVICEDESC$' '$SERVICESTATEID$' '$SERVICEATTEMPT$' '$LASTSERVICESTATECHANGE$' '$SERVICEDURATIONSEC$' '$LASTSERVICECHECK$' '$SERVICEOUTPUT$'
EOF- Note: I just added ${10} so you can see how to use multiple digit ones
Code: Select all
#send-service-trap
cat << EOF >> /logfile
"$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}"
EOFThank 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.
I have a log full with empty apostrophes.
"" "" "" "" "" "" "" "" "" ""
"" "" "" "" "" "" "" "" "" ""