how to associate /bin/bash with shell script in Nagios
James Pratt
jpratt at norwich.edu
Fri Mar 30 20:32:39 CEST 2012
Ok, so it's working fine when you run it from the command line, but not for nagios user, correct? (If it's a shell script, nagios will execute it using the proper interpreter, so there is no way to "tell" nagios to use bash if that makes sense)?
I usually su - nagios user, then try and run it from that user account - that's usually where the problem is, it runs fine for root or whoever, but fails for the nagios user for whatever reason...
Cheers,
Jamie
From: Parkman, Mikhail [mailto:Mikhail_Parkman at cable.comcast.com]
Sent: Friday, March 30, 2012 1:28 PM
To: Nagios Users List
Subject: Re: [Nagios-users] how to associate /bin/bash with shell script in Nagios
Sorry for confusion - I was just trying different combinations.
But initially my command definition was following:
define command{
command_name dlg_notifications
command_line /usr/local/nagios/libexec/nagios-msg-broker.sh
}
I have "#!/bin/bash" in the top of my shell script, and shell script is set to be executable.
perfserver-10:/usr/local/nagios/libexec$ ls -l nagios-msg-broker.sh
-rwxrwxrwx 1 nagios nagcmd 149 Mar 30 10:04 nagios-msg-broker.sh
Thanks.
Mikhail.
From: James Pratt [mailto:jpratt at norwich.edu]
Sent: Friday, March 30, 2012 9:53 AM
To: Nagios Users List
Subject: Re: [Nagios-users] how to associate /bin/bash with shell script in Nagios
I'm slightly confused - Do you have "#!/bin/bash" in the top of your shell script, and is it set to be executable by (at least) the nagios user? (Not sure why you are calling bash then the script name as an arg, that is odd to me, but maybe I'm missing something)?
Cheers,
Jamie
From: Parkman, Mikhail [mailto:Mikhail_Parkman at cable.comcast.com]<mailto:[mailto:Mikhail_Parkman at cable.comcast.com]>
Sent: Friday, March 30, 2012 12:43 PM
To: nagios-users at lists.sourceforge.net<mailto:nagios-users at lists.sourceforge.net>
Subject: [Nagios-users] how to associate /bin/bash with shell script in Nagios
Hello,
I have the following command:
define command{
command_name dlg_notifications
command_line /bin/bash /usr/local/nagios/libexec/nagios-msg-broker.sh
}
And the following service
define service{
use mypc
service_description dlg_Alerts_notifications
check_command dlg_notifications
max_check_attempts 1
retain_status_information 0
retain_nonstatus_information 0
}
/bin/bash /usr/local/nagios/libexec/nagios-msg-broker.sh
runs fine manually.
Service defined above can't run it though.
While googling around, I found out that apparently Nagios does not know that script should be executed by /bin/bash
How would I let Nagios know about /bin/bash
Thanks.
Mikhail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20120330/f71fa3e5/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list