SMS get output from nagios
Peter Edmonds
termx23 at gmail.com
Wed Jan 16 10:03:10 CET 2008
On Jan 16, 2008 7:12 PM, Mikael Mieritz <mikaelmieritz at hotmail.com> wrote:
> I have written a script in perl that sends sms to my mobile. When an event occur in nagios the script is enabled and it is working. What my script does is to send a string to my phone, so i need to feed the script with the output from nagios when an error occurs, but i can't seem to find out how to do this.
Hi Mikael,
You need to setup your notify command to use the macros available in
Nagios to get the output you want
On my Nagios setup, the Notify command for service notifications looks like this
echo -e "<$HOSTNAME$>\n$SERVICEDESC$\n$SERVICESTATE$\n$SERVICEOUTPUT$\n$LONGDATETIME$"
|gnokii --sendsms $CONTACTPAGER$ >>
/usr/local/groundwork/nagios/var/gnokii.log 2>&1
For host notifications this does the job
echo -e "<$HOSTNAME$>\n$SERVICEDESC$\n$SERVICESTATE$\n$HOSTOUTPUT$\n$LONGDATETIME$"
|gnokii --sendsms $CONTACTPAGER$ >> /usr/local/nagios/var/gnokii.log
2>&1
For more detail on macros in Nagios, look at
http://nagios.sourceforge.net/docs/2_0/macros.html
Peter Edmonds
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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