Sending notifications via SMS+mobile phone
Ilya Meylikhov
rage_q3 at mail.ru
Fri Apr 25 17:06:39 CEST 2008
Hi again.
Just now I've tried to change my command definition:
define command{
command_name notify-by-sms
command_line touch /home/rage/it_is_working
}
My /usr/local/nagios/etc/objects/templates.cfg:
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
service_notification_commands notify-by-sms
host_notification_commands notify-by-sms
register 0
}
So according to my configuration, nagios must create a file in my /home/rage
folder when an alert take place. But the file didn't appear when I manually
shutdown one of my monitoring services. In the log files I got the same
messages:
Apr 25 19:03:35 srv-nagios nagios: SERVICE ALERT: vector;Check
SMTP;OK;HARD;3;SMTP OK - 0.063 sec. response time
Apr 25 19:03:35 srv-nagios nagios: SERVICE NOTIFICATION:
nagiosadmin;vector;Check SMTP;OK;notify-by-sms;SMTP OK - 0.063 sec. response
time
What I am doing wrong?
> Hello! Could anyone please assist me in troubleshooting the following
task:
>
> I've bought a TC-35i GSM modem and connect it to my linux Debian box.
> Everything works fine and I can successfully send sms using the following
> command:
>
> echo "some test text" | gnokii --sendsms myNumber
>
> The problem is that nagios can't send sms using gnokii and I can't figure
> out why Peter's script (I add it to my message in the bottom) won't work
for
> me.
>
> The command for nagios is:
>
> define command{
> command_name notify-service-by-email
> command_line echo -e
>
"<$HOSTNAME$>\n$SERVICEDESC$\n$SERVICESTATE$\n$SERVICEOUTPUT$\n$LONGDATETIME
> $" |gnokii --sendsms $CONTACTPAGER$ >> /usr/local/nagios/var/gnokii.log
2>&1
> }
>
> I got the following message in /usr/local/nagios/var/nagios.log:
>
> [1209125514] SERVICE ALERT: vector;Check SMTP;CRITICAL;SOFT;1;Connection
> refused
> [1209125574] SERVICE ALERT: vector;Check SMTP;CRITICAL;SOFT;2;Connection
> refused
> [1209125634] SERVICE ALERT: vector;Check SMTP;CRITICAL;HARD;3;Connection
> refused
> [1209125634] SERVICE NOTIFICATION: nagiosadmin;vector;Check
> SMTP;CRITICAL;notify-service-by-email;Connection refused
Thanks in advance,
Ilya.
-----Original Message-----
From: Peter Edmonds [mailto:termx23 at gmail.com]
Sent: Friday, March 14, 2008 3:20 PM
To: Meylikhov
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Sending notifications via SMS+mobile phone
> Can anyone assist me in solving the following task: I need nagios to send
> SMS via mobile phone connected to COM port.
I use gnokii. I have used a Telular GSM SX5D and currently use an
Easygate analog fixed cellular terminal (via serial port). Gnokii is
avaialble in Debian Etch and supports a lot of mobile phones. Check
http://wiki.gnokii.org/index.php/Config for a partial list of
supported phones. The atgen driver in gnokii supports lots of phones.
/etc/gnokiirc looks like this
[global]
port = /dev/ttyS0
model = AT
initlength = default
connection = serial
use_locking = yes
serial_baudrate = 19200
smsc_timeout = 10
[gnokiid]
bindir = /usr/sbin/
[connect_script]
TELEPHONE = 12345678
[disconnect_script]
[logging]
debug = on
rlpdebug = off
xdebug = off
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
Peter Edmonds
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javao
ne
_______________________________________________
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
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
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