I'm having a hard time to get my send-sms script to work. if i execute it on the commandline, everything works perfect. but when i try to send a message from zenoss (test-msg or based on a event), nothing happends. But in every case the correct messaged gets logged in the file. Where is my error?
I use gnokii to connect to a nokia mobile phone.
Here is my code on pastebin: http://pastebin.com/VFq674ar
Thx very much in advance!
Any help is welcome!
I'm using zenoss 3.2.1
Just a guess, but I'd verify that zenoss is in the sudoers file and might even suggest you throw a +s on that bin requireing sudo priv. I'd then verfy that it runs by hand as the zenoss user. Are you executing this script using an eventcommand?
thank you for your reply!
I'd verify that zenoss is in the sudoers file
zenoss ALL= NOPASSWD: /usr/bin/gnokii
As the zenoss-user, I can execute the script without any problems. My message gets logged and the sms gets send immediately. When zenoss executes the script (i set up a page-alerting-rule, which i trigger through an manually created event) the device-name and the correct message as well as the correct page-number is logged in my log-file.
From that I get:
-> Zenoss can execute the script
-> The script gets the correct message from zenoss, through std-in
-> The script gets the correct number
I think my problem is either the method of calling gnokki (os.process vs. subprocess.popen) or the fact that gnokii takes some time to execute.
I modified the script to redirect all output from gnokki to /dev/null and switch to background immediately after receiving input from zenoss:
gnokii = os.system("echo " + msg + " | /usr/bin/sudo /usr/bin/gnokii --config /home/zenoss/gnokiirc --sendsms " + rcpt + " &> /dev/null &")
But still no luck.
Next thing was to use the script from this thread: http://community.zenoss.org/thread/15903
Also this script works fine from commandline, but still nothing happends when called from zenoss.
From that I get:
-> Its not the method of calling gnokii
-> Its not the fact that gnokii takes some time to execute.
I think I'm missing something basic. Anybody any Idea?
I checked my log: zenactions tells me everything is fine:
2012-03-20 16:39:15,015 INFO zen.ZenActions: sent page to 004316327515555: [zenoss] client-blabla asdfasdfasdfasdf
So what can be the error? Can someone please help me?
does nobody use the combination of zenoss + gnokii + sms? if you use another combination of software to send sms please tell me!
at this point any help is appreciated!
I use email to send SMS, most services like AT&T have an email address that will send an SMS, in the case of AT&T it's <yourcellnumberhere>@mobile.mycingular.com, most other carriers offer the same function.
So I am just sendind a second email alert out to that SMS email address for critical events.
thank you for your reply.
But what do you do if your network is down?
Thats why i want to use a mobile-phone connected directly to the zenoss server. So i get alerts even if the network is down ...
I do have a POTS line on a computer at the office, and USB modem connected, the computer triggers a call over the modem when certain events occur so I get a call on my cell phone. But that is not deployed at our remote sites.
I did setup a hartbeat monitoring system however. The zenoss machine will get the health of all of it's daemons, encode that in an email and send it every couple of minutes. Another computer at a different location receives the emails, decode it to get daemon status, and also alerts if no email is received. This makes sure remote Zenoss servers are up and running and healthy. Also indicates a failed network infrastructure.
OK, for the record:
I'm using RHEL6 and the switch which did the trick was to comment out the following line in the /etc/sudoers (or visudo):
And now it works with the code i posted on pastebin
thx anyone involved!
Follow Us On Twitter »
||Latest from the Zenoss Blog »||Community||Products||Services||Customers||About Us|
Copyright © 2005-2011 Zenoss, Inc.