1)GOOD plugin documentation? 2)library issues.

Jason Marshall jasonm at kelman.com
Wed Feb 12 23:44:51 CET 2003


>    First off this program rules, I have been searching for usefull
> documentation on writing plugins for nagios but havent found much.
>   So any links/whatever there would be greaetly appreciated.

here's all the documentation you need:

  Have it do whatever you want to to, and spit out a string for the
  status/error message, and exit with an appropriate code (0,1,2?)
  depending on success, warning, or failure.

Literally, that's all there is to it...

See the attachment for a very simple example...

---
Jason Marshall, Unix Geek, Kelman Technologies, Inc., Calgary, AB, Canada.

  From a Sun Microsystems bug report (#4102680):
    "Workaround: don't pound on the mouse like a wild monkey."

  "I have great faith in fools: 
     Self confidence my friends call it."  -Edgar Allan Poe

-------------- next part --------------
#!/bin/sh

# jm020501

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION="1.0.0.0"

. $PROGPATH/utils.sh

cd /opt/nagios || (echo "Cannot cd to /opt/nagios..." ; exit 1)

swap=`vmstat 1 2 |tail -1 |awk '{print $4}'`

if [ $swap -le 65536 ]; then
  echo "Only ${swap}k of swap left..."
  exit $STATE_CRITICAL
else
  if [ $swap -le 131072 ]; then
    echo "Only ${swap}k of swap left..."
    exit $STATE_WARNING
  else
    echo "${swap}k of swap."
    exit $STATE_OK
  fi
fi



More information about the Users mailing list