SMS notifications

Onsite DeTeWe Onsite.DeTeWe at firstgroup.com
Fri May 21 12:38:56 CEST 2004


Hiya,

Sticky bit has solved the problem.

I also retyped the whole command, from within the console.  I have found 
the putty, using ssh is not that good at leaving files just how you think 
they are.  Found out that there was a space at the end of the command line 
within the .cfg file.  It must also be passed and makes gnokii a bit 
confused.  Worth noting I suppose.

Thank you for all your help over the past couple of days.

Really glad that this is all sorted, it was starting to get to me...

Kind regards

Jason







Ludo Bosmans <ludo.bosmans at xtenso.be>
21/05/2004 08:25
 
        To:     'Onsite DeTeWe' <Onsite.DeTeWe at firstgroup.com>
        cc: 
        Subject:        RE: [Nagios-users] SMS notifications



Jason,
 
Sorry  for my late response, but yesterday it was an official holliday in 
belgium, so i  didn't follow-up.
 
1. If  you su - nagios and send an sms manually, you get an additional 
error message (  fopen ... ) but the sms is send ?
2. If  you do "chmod 4755 /usr/local/bin/gnokii" and owner is root "chown 
root  /usr/local/bin/gnokii", then retry as nagios user manually, you 
should have the  same output as root user. I mean without the additional 
error message. Correct  ?
3. It  is possible that the logoutput, info aswell the error msg are 
giving  problems when it is started from nagios, try to redirect the 
output to a  file.
     /usr/bin/printf "%b" "Service:   $SERVICEDESC$\nHost: 
$HOSTNAME$\nAddress: $HOSTADDRESS$\nState:   $SERVICESTATE$\nInfo: 
$OUTPUT$\nDate: 
$DATETIME$" |  /usr/local/bin/gnokii  --sendsms 07901854342 > 
/tmp/gnokii.log 2>&1 
Use >> /tmp/gnokii.log 2>&1 to append.
Try it manually as nagios  user, then adapt the command in the nagios 
config file and restart  nagios.
4. See if the file is writable by the nagios  user.
5.  Check messages in file, if this works, use /dev/null instead of 
/tmp/gnokii.log 
6.  Screw the rights from the gnokii executable back to normal ( remove 
suid flag )  and retry test.
 
kind  regards,
 
ludo
 
-----Original  Message-----
From: Onsite DeTeWe  [mailto:Onsite.DeTeWe at firstgroup.com]
Sent: donderdag 20 mei 2004  16:58
To: Ludo Bosmans
Subject: RE: [Nagios-users] SMS  notifications


ludo Thanks for all your help...  ;-) 






Ludo Bosmans  <ludo.bosmans at xtenso.be> 

19/05/2004 16:45
        
        To:         'Onsite DeTeWe' <Onsite.DeTeWe at firstgroup.com> 
        cc:          
         Subject:        RE:  [Nagios-users] SMS  notifications



Jason, 
  
1. If   you execute it as root, what is the output at that time. 

GNOKII Version 0.6.1 
write:  [ATZ<cr>] 
read :  [ATZ<cr><cr><lf>OK<cr><lf>] 
write: [ATE1<cr>] 
read :  [ATE1<cr><cr><lf>OK<cr><lf>] 
write: [AT+CGMM<cr>] 
read :  [AT+CGMM<cr><cr><lf>Nokia  6310i<cr><lf><cr><lf>OK<cr><lf>] 
write: [AT+CGMI<cr>] 
read :  [AT+CGMI<cr><cr><lf>Nokia<cr><lf><cr><lf>OK<cr><lf>] 
write: [AT+CSCS?<cr>] 
read :  [AT+CSCS?<cr><cr><lf>+CSCS:  "PCCP437"<cr><lf><cr><lf>OK<cr><lf>] 
write: [AT+CSCA?<cr>] 
read :  [AT+CSCA?<cr><cr><lf>+CSCA: 
"+447802000xxx",145<cr><lf><cr><lf>OK<cr><lf>] 
write: [AT+CMGF=0<cr>] 
read :  [AT+CMGF=0<cr><cr><lf>OK<cr><lf>] 
write: [AT+CMGS=82<cr>] 
read :  [AT+CMGS=82<cr><cr><lf>> ] 
write: 
[079144872000302311000B817009815443F20000AA4D2A95337C4EBFE72A95829A879775208102F99ED375A0A9B3099D96E5F6B25CA098D2C3F4B20E245004C96479793ED781048AA4DBFCD681040A62985E7E51D3EDB20E2400^Z] 
 
read : 
[079144872000302311000B817009815443F20000AA4D2A95337C4EBFE72A95829A879775208102F99ED375A0A9B3099D96E5F6B25CA098D2C3F4B20E245004C96479793ED781048AA4DBFCD681040A62985E7E51D3EDB20E2400^Z<cr><lf>+CMGS: 
 49<cr><lf><cr><lf>OK<cr><lf>] 
Send succeeded! 

2. Do  you  have specified somewere a logfile, f.e. for the smsd and are 
the rights   correct ? 

logging and debugging is off.  !? 

3.  Debug settings in gnokiirc (  /etc/gnokiirc ) 

See above. 

  
kind  regards, 
  
ludo 
  
-----Original Message----- 
From: Onsite DeTeWe   [mailto:Onsite.DeTeWe at firstgroup.com] 
Sent: woensdag 19 mei 2004  17:06 
To: Ludo Bosmans;   nagios-users at lists.sourceforge.net 
Subject: RE: [Nagios-users] SMS  notifications 







Ludo Bosmans   <ludo.bosmans at xtenso.be>    

19/05/2004 14:57
        
        To:          'Onsite DeTeWe' <Onsite.DeTeWe at firstgroup.com>, 
 nagios-users at lists.sourceforge.net 
        cc:           
          Subject:        RE:  [Nagios-users] SMS   notifications



Jason, 
  
To   avoid lots of replies, work step by  step and try to document 
symptoms in   detail.. 
  
1. Do   the  command work manually as root ? 

Yes 

2. Do  a su -  nagios and try the  command again. If it doesn't work. What 
is the error   message ?   

Yes  with following. 
[nagios at SNMPServer  etc]$ /usr/bin/printf "%b" "Service: 
 $SERVICEDESC$\nHost:  $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: 
 $SERVICESTATE$\nInfo:  $OUTPUT$\nDate: $DATETIME$" | 
/usr/local/bin/gnokii  --sendsms  07901854342 
fopen: Permission  denied   
WARNING: cannot open  logfile, logs will be directed to  stderr 
GNOKII Version 0.6.1 
write: [ATZ<cr>] 
read :   [ATZ<cr><cr><lf>OK<cr><lf>] 
write: [ATE1<cr>] 
read :   [ATE1<cr><cr><lf>OK<cr><lf>] 
write: [AT+CGMM<cr>] 
read :   [AT+CGMM<cr><cr><lf>Nokia   6310i<cr><lf><cr><lf>OK<cr><lf>]   
write: [AT+CGMI<cr>] 
read :   [AT+CGMI<cr><cr><lf>Nokia<cr><lf><cr><lf>OK<cr><lf>]   
write: [AT+CSCS?<cr>] 
read :   [AT+CSCS?<cr><cr><lf>+CSCS:  "PCCP437"<cr><lf><cr><lf>OK<cr><lf>] 
  
write: [AT+CSCA?<cr>] 
read :   [AT+CSCA?<cr><cr><lf>+CSCA: 
 "+44780200xxxx",145<cr><lf><cr><lf>OK<cr><lf>]   
write:  [AT+CMGF=0<cr>] 
read :   [AT+CMGF=0<cr><cr><lf>OK<cr><lf>]   
write:  [AT+CMGS=70<cr>] 
read :   [AT+CMGS=70<cr><cr><lf>> ] 
write: 
 [079144872000302311000B817009814543F20000AA40D3B2DC9E1E9775208102F99ED375A0A9B3099D96E5F6B25CA00892C9F2F27CAE030914537A985ED681048AA4DBFCD681040A62985ED68104^Z] 
  
read : 
 [079144872000302311000B817009814543F20000AA40D3B2DC9E1E9775208102F99ED375A0A9B3099D96E5F6B25CA00892C9F2F27CAE030914537A985ED681048AA4DBFCD681040A62985ED68104^Z<cr><lf>+CMGS: 
  37<cr><lf><cr><lf>OK<cr><lf>]   
Send succeeded! 

3. Do  you  have read and write  permissions on the serial port specified 
in the gnokiirc   file as  the nagios user ? 

Yes   

4.   correct is necessary. 
5.   Is  there a getty process on it ? Disable it in /etc/inittab and do 
"init  q", check  if process is not respawned anymore. 

No 

6.  Check access rights again from   serial device. 

Works  from command line, just not  from within nagios. 
Extract from syslog   

May 19 15:53:48 SNMPServer nagios: HOST ALERT:   sw6-1;UP;HARD;1;PING OK - 
Packet loss = 0%, RTA = 34.49 ms 
May 19 15:53:48 SNMPServer nagios: HOST  NOTIFICATION:  network;sw6-1;UP;
host-notify-by-sms;PING OK -  Packet loss = 0%, RTA =  34.49 ms 

7. Try  to set the suid flag as  root,  just to see if this fix the 
 problem. 

No effect. 

snippet  from the  misccommands.cfg file showing sms trigger 

#  'host-notify-by-email' command definition 
define  command{ 
         command_name     host-notify-by-email 
         command_line     /usr/bin/printf "%b" "***** Nagios 
  *****\n\nNotificatio 
n Type:  $NOTIFICATIONTYPE$\nHost:  $HOSTNAME$\nState: 
$HOSTSTATE$\nAddress:  $HOST 
ADDRESS$\nInfo: $OUTPUT$\n\nDate/Time:  $DATETIME$\n" | /bin/mail  -s 
"Host $HOSTS 
TATE$ alert  for $HOSTNAME$!"  $CONTACTEMAIL$ 
         } 

# 'host-notify-by-sms' command  definition 
define command{ 
         command_name     host-notify-by-sms 
         command_line     /usr/bin/printf "%b" "**Nagios**\nType: 
 $NOTIFICATIONTYP 
E$\nHost: $HOSTNAME$\nState:   $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: 
$OUTPUT$ 
\nDate/Time: $DATETIME$\n" | /usr/local/bin/gnokii --sendsms   07901845342 

  
kind    regards, 
  
Jason 
  
  
-----Original Message-----   
From: Onsite DeTeWe    [mailto:Onsite.DeTeWe at firstgroup.com] 
Sent: woensdag 19 mei 2004   14:02 
To: Ludo  Bosmans;   nagios-users at lists.sourceforge.net 
Subject: RE: [Nagios-users] SMS   notifications   



Hiya, 

Yeah sorry..    Should have explained in full. 

I have a host-notify-by-sms and   notify-by-sms in the .cfg.  One  for 
service and one for host.    The snippet I sent was for a host  down.    

Really puzzling as the other  commands  in the  .cfg for 
 host-notify-by-email and notify-by-email work   fine.   All I did was 
replace them. 

J 





Ludo Bosmans    <ludo.bosmans at xtenso.be>     

19/05/2004 11:59
          
        To:           'Onsite DeTeWe'  <Onsite.DeTeWe at firstgroup.com>, 
 Ludo  Bosmans  <ludo.bosmans at xtenso.be>, 
  nagios-users at lists.sourceforge.net    
        cc:            
          Subject:         RE:  [Nagios-users] SMS    notifications



Jason, 
    
I   suppose that the manual test is ok ? Of   course replace the macros 
with  the  corresponding   values. 
 /usr/bin/printf   "%b"  "**Nagios**\nType:  $NOTIFICATIONTYPE$\nHost: 
   $HOSTNAME$\nState:   $HOSTSTATE$\nAddress:  $HOSTADDRESS$\nInfo: 
  $OUTPUT$\nDate/Time:  $DATETIME$\n" |   /usr/local/bin/gnokii  --sendsms 
 $CONTACTPAGER$ 
  
In the checkcommands  you have a   "notify-by-sms", but in the  syslog 
there is  "host-notify-by-sms",  so you need to  check the syntax of  that 
config entry and try  manually to execute the command to   see if it 
 works.   
  
kind    regards, 
  
ludo 
    


-----Original Message-----   
From: Onsite  DeTeWe    [mailto:Onsite.DeTeWe at firstgroup.com]    
Sent: woensdag 19 mei 2004    12:22 
To: Ludo   Bosmans;   nagios-users at lists.sourceforge.net   
Subject: RE: [Nagios-users] SMS    notifications   



Thanks for  your reply,     

I do have a nokia   connected to the serial   port, but I am using the 
phone to  send the  texts.   

Regarding the macro, I have   also tried just  using the  mobile number 
for a test.  This  still does not  work.    Here is a syslog message when 
a host  does down.    

May 19  11:11:48  SNMPServer nagios: HOST   NOTIFICATION: 
 server;fiplog01;UP;host-notify-by-sms;PING OK -  Packet   loss  = 0%, RTA 
= 58.53 ms   

As  you  can see the trigger is being  used,  just nothing more 
 happening.   

Jason 






Ludo Bosmans     <ludo.bosmans at xtenso.be>      

19/05/2004  11:06
             
         To:           'Onsite  DeTeWe'  <Onsite.DeTeWe at firstgroup.com>, 
   nagios-users at lists.sourceforge.net     
        cc:             
          Subject:          RE:  [Nagios-users] SMS     notifications



Hi    Jason, 
    
I use   also gnokii to   send sms's.  I  don't know your set-up, do you 
have a   Nokia   connected to a serial  port ? 
Imy    configuration i have a  modem connected to  the serial port and  i 
 establish a   call to a local provider  smc center. So i am able to  drop 
  more then 1 sms at the  time  in one connection. Only the call   to the 
smc  center is charged. No  charge  for the sms's   itself. 
  
So i  can not really simulate, but   it  seems for me that the 
 $CONTACTPAGERS$ macro is  wrong, it   must be   $CONTACTPAGER$. 
    
kind     regards,   
    
ludo 
-----Original Message-----       
From: Onsite DeTeWe      [mailto:Onsite.DeTeWe at firstgroup.com]    
Sent: woensdag 19 mei 2004     11:34 
To:    nagios-users at lists.sourceforge.net 
Subject:  [Nagios-users] SMS  notifications   



Hi All,    

I  have just setup a  mobile gateway on  our  nagios box (6310i  with 
 serial lead ;-).  Got all   the SMS  stuff  working using gnokii which 
 works a treat.   Recommend it to    anyone.  However, when I try  and 
 get nagios to  use a new  notify routine  it fails to send the    text.   


Debug    so  far.   

Got  gnokii to send SMS    direct.   
Added  notify-by-sms  to    misccommands.cfg.   
          I know the  above works as   I then cut the command  from the 
.cfg and run  it  from  the  command line direct and it  works.      

Could this be a  permissions thing  associated   with the  nagios user??? 
    

When I force a host  down and  look in the   syslog the  notification does 
try and send via  the correct   command, it  seems  like just the command 
from within nagios  is not    working. 

Hope  someone  can   help.   

Regards 

Jason 



This is     the command line. 

/usr/bin/printf "%b" "**Nagios**\nType: $NOTIFICATIONTYPE$\nHost: 
    $HOSTNAME$\nState: $HOSTSTATE$\nAddress:   $HOSTADDRESS$\nInfo: 
   $OUTPUT$\nDate/Time:  $DATETIME$\n" |  /usr/local/bin/gnokii  --sendsms 
   $CONTACTPAGERS$ 

**********************************************************************     

This  message is confidential.  It  may not  be disclosed  to, or used by, 

anyone  other  than the addressee.  If you receive this   message in 
error, please   advise us   immediately. 

Internet email is not    necessarily secure. First  does not  accept 
responsibility for changes to any email which   occur after   the  email 
has been  sent.  Attachments  to this email could  contain  software 
viruses which could damage your  system. First  have checked    the 
attachments for   viruses before   sending, but you should  virus-check 
them  before   opening. 

http://www.firstgroup.com   
**********************************************************************     






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040521/ad2a249d/attachment.html>


More information about the Users mailing list