nagios notification sent as a .bin file

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
drewbpearson
Posts: 13
Joined: Wed Feb 05, 2014 5:50 pm

Re: nagios notification sent as a .bin file

Post by drewbpearson »

and this...I hope it is helpful...from the retention.dat file...
service {
host_name=stor2
service_description=check_disk_smb
modified_attributes=0
check_command=check_disk_smb!nagios!nagios!smbMonit0r!80!90
check_period=workhours
notification_period=workhours
event_handler=
has_been_checked=1
check_execution_time=0.132
check_latency=0.209
check_type=0
current_state=1
last_state=1
last_hard_state=1
last_event_id=38057
current_event_id=38217
current_problem_id=15169
last_problem_id=14986
current_attempt=3
max_attempts=3
normal_check_interval=10.000000
retry_check_interval=2.000000
state_type=1
last_state_change=1391458800
last_hard_state_change=1391459040
last_time_ok=1391458200
last_time_warning=1391725200
last_time_unknown=1380723000
last_time_critical=1389978600
plugin_output=WARNING: Only 238.58G (13%) free on \\192.168.71.21
long_plugin_output=agios
performance_data='nagios'=1703566072320B;1567800201216;1763775226368;0;1959750251520
last_check=1391725200
next_check=1391725800
check_options=0
notified_on_unknown=0
notified_on_warning=1
notified_on_critical=0
current_notification_number=17
current_notification_id=5890
last_notification=1391720409
notifications_enabled=1
active_checks_enabled=1
passive_checks_enabled=1
event_handler_enabled=1
problem_has_been_acknowledged=0
acknowledgement_type=0
flap_detection_enabled=1
failure_prediction_enabled=1
process_performance_data=1
obsess_over_service=1
is_flapping=0
percent_state_change=0.00
check_flapping_recovery_notification=0
state_history=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
}
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios notification sent as a .bin file

Post by tmcdonald »

Very odd. The line

Code: Select all

long_plugin_output=agios
makes me think that the "n" in "nagios" got escaped as a newline somewhere...

We don't fully understand what is happening but I think it is related to escaping. While this is not a full solution, this is what we have right now:

Your SMB share name is "\\stor2\nagios" so we think the "\nagios" portion is becoming a newline character, hence the "agios" output above. Basically in your notification command you are using %b to output your service information, and when using %b you are allowed to make newlines with \n and tabs with \t, for example. So what you want to do is modify your command to the following:

Code: Select all

# 'notify-service-by-email' custom SMB command definition
define command{
command_name notify-service-by-email-smb
command_line /usr/bin/printf "%b%s%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$
}
This will create a special notification command that should handle the newline correctly, since %s does not do escaping. Unfortunately since notification commands are attached to contacts you will need to create a new contact (it can be a clone of an existing one) and give it this new command, then set this new contact as the contact for the misbehaving service. A small price to pay, but it should work. Let us know.
Former Nagios employee
drewbpearson
Posts: 13
Joined: Wed Feb 05, 2014 5:50 pm

Re: nagios notification sent as a .bin file

Post by drewbpearson »

Thank you all so much I will~
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios notification sent as a .bin file

Post by tmcdonald »

Let us know how this works out for you.
Former Nagios employee
Locked