[smokeping-users] using sudo in an alert

Tim Peiffer peiffer at umn.edu
Fri Jul 27 01:04:47 CEST 2012


Andrew,

Rhetorical Q: What is the exit status of script.py, and are you handling 
it appropriately?

Suggestion: qualify or expand paths in all cases.   Don't rely on your 
environment to know what you really want it to do.

to = "| /usr/sbin/sudo /home/myID/scripts/script.py"

Regards,
Tim Peiffer

-- 
Tim Peiffer
Network Support Engineer
Office of Information Technology
University of Minnesota/NorthernLights GigaPOP

+1 612 626-7884 (desk)



On 7/26/12 5:56 PM, Andrew Pattison wrote:
> I tried that but it still doesn't work. The alert is triggered as it 
> is logged in /var/messages but either smokeping is not calling the 
> script or the call is failing. Any ideas?
>
> Andrew.
>
> On 25 July 2012 17:23, Ryan Becker <rb14060 at gmail.com 
> <mailto:rb14060 at gmail.com>> wrote:
>
>     Try using the absolute path to the script in the sudoers file.
>      Also, the /etc/sudoers file should NOT be edited directly, you
>     should be using the visudo command as root.
>
>     On Wed, Jul 25, 2012 at 4:41 AM, Andrew Pattison
>     <andrum99 at gmail.com <mailto:andrum99 at gmail.com>> wrote:
>
>         I've got something similar in in /etc/sudoers already.
>
>         Thanks
>
>         Andrew.
>
>
>         On 24 July 2012 23:15, Ryan Becker <rb14060 at gmail.com
>         <mailto:rb14060 at gmail.com>> wrote:
>
>             Make sure that the user is allowed to execute the script
>             without a password.  Here's an example that you can modify
>             to suit your needs: techbnc ALL = NOPASSWD: /usr/sbin/csf
>             In this example the user techbnc is allowed to call
>             /usr/sbin/csf without needing a password.  What's
>             happening is that normally when sudo is called, it asks
>             for the password and Smokeping has no way to provide that
>             password.  By adding the user to the file with NOPASSWD,
>             they are allowed to execute the script without being
>             password prompted and therefore Smokeping will be able to
>             complete the action.
>
>             On Tue, Jul 24, 2012 at 5:35 PM, Andrew Pattison
>             <andrum99 at gmail.com <mailto:andrum99 at gmail.com>> wrote:
>
>                 I am trying to set up smokeping with an alert script.
>                 The alert script is called like this entry in
>                 /etc/smokeping/config.d/Alerts:
>
>                 to = |sudo script.py
>
>                 When called as simply |script.py this works fine, but
>                 with sudo the script does not get called. How can I
>                 get this working?
>
>                 Thanks
>
>                 Andrew.
>
>                 _______________________________________________
>                 smokeping-users mailing list
>                 smokeping-users at lists.oetiker.ch
>                 <mailto:smokeping-users at lists.oetiker.ch>
>                 https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
>
>
>
>
>
>
>
> _______________________________________________
> smokeping-users mailing list
> smokeping-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20120726/088aa09a/attachment-0001.htm 


More information about the smokeping-users mailing list