Simplest plugin. Please help with incorporating into Nagios
Marc Powell
marc at ena.com
Mon Apr 25 22:51:38 CEST 2005
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Calvin Crutchfield
> Sent: Monday, April 25, 2005 3:40 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Simplest plugin. Please help with
incorporating
> into Nagios
>
> Version: Latest Nagios and plugins
> OS: Solaris
> Remote method: Check_by_ssh
> Nagios along with check_by_ssh is working properly.
>
> Question:
> I need to execute a custom script via check_by_ssh on remote nodes.
> I am a little confused about what it takes to use a script as a
plugin. I
> know that Nagios uses the exit codes to determine OK WARN CRIT and I
know
> it
> needs to only have one line of output.
>
> -But what else does a script need?
Just to perform some action and return the above output.
> -What format is the one line of output?
Preferably something that can display nicely in a web page. It's only
used for human consumption and should indicate what the problem is or
isn't.
> -What do I need to do to the script to allow check_by_ssh to execute
it?
The script will be executed as the user you ssh in as. As long as that
user can run the script you need to nothing else beyond the above.
>
> Does it need to be compiled in anyway? I will be using shell or perl
> scripts.
It makes no difference.
> Assume this script: Simply gets a number and exits depending in its
size.
> -------------
> #!/bin/sh
> FILES=`ls |wc -l`
>
> if [ $FILES -gt 100 ]
> then
> exit 1
> else
> exit 0
> fi
> ----------------
>
>
You don't print any output for the CGI's to display but other than that,
as a very basic plugin it looks fine.
> I want to start simple then I can deduce what I need to do to
incorporate
> my
> larger scripts. If this is simple please help as I was not able to
grasp
> the plugins document very well. If making your scripts into plugins
is a
> big deal, I would be willing to pay a reasonable fee for some
> consultation.
It's very simple. I've written plugins that are just a handful of lines
of actual code. The keys are to programmatically perform some check that
can equate to OK, WARNING or CRITICAL, print some useful output to help
you figure out what the problem is and exit with the proper status code.
Everything else is just fluff (error checking, dealing with uncertain
situations, etc).
http://nagiosplug.sourceforge.net/developer-guidelines.html will likely
be helpful ;) The guidelines are geared more toward plugins that would
be contributed back but if you're just doing something for in house use
you can leave a lot of it out.
--
Marc
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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