Additiona Info don't work with Win Server!
Thibault Genessay
tgenessay at aliadis.fr
Mon Feb 13 17:51:18 CET 2006
lkk at interfree.it wrote:
>Thibault can you help me?
>
>
Glad you ask, but ... er ... not that much actually
>With Linux/Unix Servers work fine. I receive email with additional info.
>With Windows Servers don't work! Why?
>
>
You probably don't use the same plugin for windows and linux so that's
not directly related to the OS but rather to the plugin or, more
probably, to the kind of output you get from your plugin.
Let's put what is spread on 3 different mails all together so that other
users have a maximum amount of info. You have the following service
notification configuration:
define command{
command_name notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios v2.0b4 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
You use this as the notification command in your service definition,
right ? So you should first start by naming it 'service-notify-by-email'
for clarity's sake. Anyway you get the following mail
------------------------------
**** Nagios v2.0b4 *****
Notification Type: PROBLEM
Service: Used Disk D:
Host: myhost
Address: ip
State: CRITICAL
Date/Time: Mon Feb 13 15:42:45 CET 2006
Additional Info:
D:
------------------------------
Whereas the last line should be
D:\ - total: 63.80 Gb - used: 61.72 Gb (97%) - free 2.08 Gb (3%)
The problem obviously (imho at least) comes from this backslash. It does not look like a coincidence: one backslash and your output gets truncated just afterwards.
It's very hard to figure out if and how backslashes get interpreted in the pipeline plugin > nagios > mail with bash popping in everywhere. I don't even know if you can rely on the fact that the command
printf "%b" "D:\ - total: 63.80 Gb - used: 61.72 Gb (97%) - free 2.08 Gb (3%)\n" | mail -s "this is just a test" yourname at somewhere.com
works on the command line.
Ideas:
Try to redirect the mail body to a file rather than sending it, i.e. /bin/printf [...] > /tmp/somefilenagioscanwriteto and examine its content. Try to get your plugin not output this backslash you don't care about after all (that's what mine does actually). Give us more info on you system, Nagios ver., service definition, check plugin, ...
--
Thibault
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list