[asterisk-users] Fw: RE:Nagios under *[solved]
Hi Steve Thanks for all your help, i followed your answers and found on that nagios was being run as user nagiosand if i executed the last command it asked for a password [i tried nagios password,root password etc] but it did not work..it the end i opened nagios.cfg and changed the NAGIOS_USER to root and changed the ownership permissons on the script also to root..I now get the correct status on the Nagios interface.. thanks for all your help - Sriram ) What PATH does the script have when run by the Nagios process? ) Are there any permissions issues on the directories in the path to the script? Not having ever run Nagios, I'm shooting from the hip a bit. I'm guessing these commands may shed some light: ) Get the username running Nagios. ps -aef | grep --ignore-case nagios ) What output do you get from a command like: cd /tmp/ sudo -u username-running-Nagios full-path-of-script - Original Message - From: Sriram To: asterisk-users@lists.digium.com Sent: Friday, June 19, 2009 11:51 PM Subject: RE:Nagios under * Hi Steve I tried your script : STATUS=$(sudo asterisk -rnx pri show span 1\ | awk '/Status/ {print $3}'\ ) if [ Up, == ${STATUS} ] thenecho PRI UP exit 0 elseecho PRI DOWN exit 2 fi but still i get PRI down in the Nagios web interface while if i execute this command from command line i get PRI UP...i m really going mad..did a clean install again but still same problem.. Iv;e also given permission of 777 to the script and saved it under /usr/local/nagios and given the same path in commands.cfg under objects folder of /usr/local/nagios/etc ... can anyone please help me out ? Thanks Sriram ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Fw: RE:Nagios under *[solved]
On Sat, 20 Jun 2009, Sriram wrote: Thanks for all your help, i followed your answers and found on that nagios was being run as user nagiosand if i executed the last command it asked for a password [i tried nagios password,root password etc] but it did not work..it the end i opened nagios.cfg and changed the NAGIOS_USER to root and changed the ownership permissons on the script also to root..I now get the correct status on the Nagios interface.. It would be better to run Nagios as nagios and add nagios to sudo so it can execute asterisk -nrx as the user executing Asterisk. The following line in /etc/sudoers should do the trick. nagios ALL=(ALL) NOPASSWD: ALL This, unfortunately, will allow the nagios user (or anybody who hacks into nagios) to execute any command as root, but it is safer than running nagios as root. Sudo has the facility to allow a user to execute a single command as another user, I just don't know the syntax off the top of my head. Google is your friend... Something like: nagios ALL=(user-running-asterisk) NOPASSWD: /usr/sbin/asterisk should get you close. Thanks in advance, Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users