Question about Nagios Plugin check_svn
Hari Sekhon
hpsekhon at googlemail.com
Fri Feb 27 11:09:04 CET 2009
Manuel Höbel wrote:
>
> Hi Hari Sekhon,
>
> I have a question about your Nagios Plugin ‘check_svn’.
>
> I only want to check if SVN is reachable. So I only use the Command Line
>
> $USER1$/check_svn -H $HOSTADDRESS$
>
> in my Nagios Configuration to do so. But in Nagios, I always get the
> failure:
>
> UNKNOWN: 'svn' cannot be found in path. Please install the subversion
> client or fix your PATH environment variable
>
> Now to my question: Where do I have to change/set the ‘PATH
> environment variable’? Should I write it in the Command Line, for example:
>
> $USER1$/check_svn -H $HOSTADDRESS$ /usr/bin/svn
>
> or somewhere in your Plugin File?
>
> Sorry, I have no idea and I’m new to the hole ‘Nagios thing’… ;) It
> would give me great pleasure if you could help me with this little
> problem. J
>
Hi Manuel,
I'm sending this to the Nagios-Users mailing list as well as I think
it's a generally useful thing to know/discuss.
Firstly, the path is set in the user's profile as per unix standards, so
you may want to check the path of the user account that the plugin is
running as (if it's running from the nagios server as you imply then
this is the user that Nagios itself runs as).
Secondly, if you want to change the PATH environment variable to include
the directory containing the svn binary only for the check_svn
definition then you can try another standard unix trick which is to
prepend the environment variable to the beginning of the command line as
follows:
PATH=$PATH:/path/to/directory $USER1$/check_svn -H $HOSTADDRESS$
which will append the directory "/path/to/directory" to the PATH
environment variable and allow the plugin to find the svn executable.
Replace "/path/to/directory" with the directory where your svn
executable is located, something like /usr/local/bin etc...
I've noticed that Nagios runs shells for some plugins and not for
others. It looks like Nagios runs a shell for anything that isn't an
obvious full plugin path... so you can use all sorts of constructs like
cd /dir && ./plugin _name etc just as you would if you were typing into
a shell.
<rant>
Probably the only thing I disagree with on the Plugin Coding Guidelines
is specifying the full path to any binaries used as this makes things
horribly non-portable across distros and platforms which may have
programs in different places. I don't think that you should have to be
editing plugin code to make it work on different platforms, that's just
horrible to maintain if you run more than 1 distro/platform (and a lot
of us do).
PATH is so standard in unix, we should just use it. Security worries
regarding PATH are usually ridiculous since if someone can modify your
path, you've got serious problems and inconveniences like hard coding
full paths to binaries just isn't going to save your bacon, we don't
write /path/to/ls every time we execute it on the command line, do we?
<end rant>
Thanks
-h
--
Hari Sekhon
Always open to interesting opportunities
http://www.linkedin.com/in/harisekhon
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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