How can I get more information - eventlog descriptions - in my notification emails
Scott, Ewan
EWScott at scotborders.gov.uk
Tue Feb 9 10:59:08 CET 2010
Marc
Thanks for this.
By returning to using $SERVICEOUTPUT$ and placing this towards the beginning of the printf output - see below - I now get the EventLog text into the notification email. I lose the "Additional Info:" text literal at the end of the email so presumably there is a fixed size for the output which cannot be extended. However, for what I'm trying to do, I think it is sufficient.
Regards
Ewan
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\nNotification Type: $NOTIFICATIONTYPE$\nTEXT: $SERVICEOUTPUT$\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nDate/Time: $LONGDATETIME$\nAdditional Info:" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
-----Original Message-----
From: Marc Powell [mailto:marc at ena.com]
Sent: 05 February 2010 16:51
To: Scott, Ewan
Cc: Nagios Mailinglist
Subject: Re: [Nagios-users] How can I get more information - eventlog descriptions - in my notification emails
On Feb 5, 2010, at 10:25 AM, Scott, Ewan wrote:
> Hi
>
> I'm looking to get more information in my notificiation emails. Specifically, I'd like to get the text of Windows server Eventlogs into the body of the email. This information is coming across to the nagios server and can be found in the log file.
> See example below:
> Feb 5 15:08:36 sbc-omega-test nagios: SERVICE NOTIFICATION: nagiosadmin;hq-test-01;EventLog TempDB start chk;WARNING;notify-service-by-email;informational: MSSQLSERVER: Starting up database ReportServerTempDB. (384), eventlog: 384 warning
> I had hoped I could resolve this by changing the $SERVICEOUTPUT$ to $LONGSERVICEOUTPUT$ in the notify-service-by-email command definition (see below).
> # 'notify-service-by-email' command definition
> 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$LONGSERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service
> Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
> }
> However this did not give any change in the output. That's all I've changed on the server. Can anyone give me pointers as to what else I need to change?
$SERVICEOUTPUT$ is the macro that you want. It looks like the plugin is only outputting one line of text. Make sure it is/was typed correctly in the notification command above. --
http://nagios.sourceforge.net/docs/3_0/macrolist.html#serviceoutput
$SERVICEOUTPUT$ The first line of text output from the last service check (i.e. "Ping OK").
$LONGSERVICEOUTPUT$ The full text output (aside from the first line) from the last service check. (e.g. everything beyond the first line of text).
--
Marc
**********************************************************************
This email and any files transmitted with it are privileged, confidential and subject to copyright. Any unauthorised use or disclosure of any part of this email is prohibited. If you are not the intended recipient please inform the sender immediately; you should then delete the email and remove any copies from your system.
The views or opinions expressed in this communication may not necessarily be those of Scottish Borders Council.
Please be advised that Scottish Borders Council's incoming and outgoing email is subject to regular monitoring and any email may require to be disclosed by the Council under the provisions of the Freedom of Information (Scotland) Act 2002.
**********************************************************************
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
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