Discussion:
[Nagios-users] sms alert using gnokii
bernie liwanag
2003-03-05 03:55:03 UTC
Permalink
Hi to all!

How can I make gnokii works on my nagios.I have my
gnokii running using a command prompt. I can send and
received a text message using the command :

# /usr/local/sbin/gnokii --sendsms <cell phone #>


- Here is my sample conifiguration in contacts.cfg
file

# 'nagios' contact definition
define contact{
contact_name nagios
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands
notify-by-email,host-notify-by-sms
host_notification_commands
host-notify-by-email,host-notify-by-sms
email ***@mallinux.test.com.ph
}


- Here is my sample configuration of misccommands.cfg


# 'host-notify-by-sms' command definition
define command
command_name host-notify-by-sms
command_line /usr/bin/printf "Host '$HOSTALIAS$'
is $ $HOSTSTATE$\nInfo: $OUTPUT$\nTime: $DATETIME$" |
/usr/local/sbin/gnokii --sendsms 09201234567
}

# 'notify-by-sms' command definition
define command{
command_name notify-by-sms
command_line /usr/bin/printf "Service:
$SERVICEDESC$\nHost: $HOSTNAME$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\nInfo:
$OUTPUT$\nDate: $DATETI
ME$" | /usr/local/sbin/gnokii --sendsms 09201234567
}

I have included the .gnokiirc config file in both
/root/ directory and /home/nagios/ directory

Can someone tells me what wrong with my config?

Thanks a lot to all!

Bernie
































__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
S***@gwf.com.au
2003-03-06 04:45:22 UTC
Permalink
Bernie,

I have SMS working on RH7.3, Nagios 1.0 using Nokia 5110, Gnokii Version 0.3.3,
Telstra GSM (Australia)

Some key points to remember:- if the gnokii command runs from root ok then su
nagios and try the command. If the command now fails permissions are the clue.

Make sure nagios can write to the port eg. ttys0 in Red Hat
Make sure nagios is a member of the tty group
Make sure nagios is a member of the uucp group ( not sure of the correlation but
have found this to be the case with other devices connected to the comm port eg
Temp Trax digital thermometer)

Lastly here is the command I use, note the +61 (Aust code), no smsc and no
switches I have seen "-C0 2" inserted before >/dev/null but this displays the
message on the phone without saving to the inbox
command[notify-by-sms]=/usr/bin/printf "$HOSTNAME$ - $SERVICEDESC$ is
$SERVICESTATE$" | /usr/bin/gnokii --sendsms +61408XXXXXX >/dev/null

Thanks to Pia from Linux Australia for helping me nut this out and good luck!
As you do not describe what errors you get, it is a bit difficult to provide
**********************************************************************************************************************************************
This email and its attachments are confidential subject to copyright and may be legally privileged. If they have come to
you in error you should take no action based upon the contents nor should you copy or show them to anyone. Please
delete the email and its attachments and inform ***@gwf.com.au
Any views or opinions expressed are those of the author and do not necessarily represent those of George Weston Foods
Ltd.
Security: Internet email is not a completely secure medium, please note this when considering the content of your message.
Viruses: We take precautions to ensure email is free of viruses but cannot guarantee this. Accordingly we advise
scanning all email and attachments
*********************************************************************************************************************************************
S***@gwf.com.au
2003-03-06 05:06:05 UTC
Permalink
Bernie,

I missed a bit, I believe user nagios should also be a member of the gnokii
group.

Regards
Shane
Post by S***@gwf.com.au
I have SMS working on RH7.3, Nagios 1.0 using Nokia 5110, Gnokii Version
0.3.3, Telstra GSM (Australia)
Post by S***@gwf.com.au
Some key points to remember:- if the gnokii command runs from root ok then su
nagios and try the command. If the command now fails >>permissions are the clue.
Post by S***@gwf.com.au
Make sure nagios can write to the port eg. ttys0 in Red Hat
Make sure nagios is a member of the tty group
Make sure nagios is a member of the uucp group ( not sure of the correlation
but have found this to be the case with other devices >>connected to the comm
port eg Temp Trax digital thermometer)
Post by S***@gwf.com.au
Lastly here is the command I use, note the +61 (Aust code), no smsc and no
switches I have seen "-C0 2" inserted before >/dev/null but >>this displays the
message on the phone without saving to the inbox
Post by S***@gwf.com.au
command[notify-by-sms]=/usr/bin/printf "$HOSTNAME$ - $SERVICEDESC$ is
$SERVICESTATE$" | /usr/bin/gnokii --sendsms >>+61408XXXXXX >/dev/null
Post by S***@gwf.com.au
Thanks to Pia from Linux Australia for helping me nut this out and good luck!
**********************************************************************************************************************************************
This email and its attachments are confidential subject to copyright and may be legally privileged. If they have come to
you in error you should take no action based upon the contents nor should you copy or show them to anyone. Please
delete the email and its attachments and inform ***@gwf.com.au
Any views or opinions expressed are those of the author and do not necessarily represent those of George Weston Foods
Ltd.
Security: Internet email is not a completely secure medium, please note this when considering the content of your message.
Viruses: We take precautions to ensure email is free of viruses but cannot guarantee this. Accordingly we advise
scanning all email and attachments
*********************************************************************************************************************************************
Loading...