Creating a Nagios Plug-in … making it easy.

Creating a Nagios plug-in looks daunting and hard at first. It’s really not as hard as you think.
Here is a couple things you should know:

Know what you want to monitor.
I create most of my plug-ins in bash scripts and perl scripts. (other languages supported, those are just what I use)
Know your exit codes.
Your plug-in output should be helpful and informative.

Exit codes are simple, and key to your plug-in success.

0 – OK
1 – WARN
2 – CRITICAL
3 – UKNOWN

Now those look family don’t they, they are the states or status of a service. i.e. my disk space is in OK state because I have 120GB free space.
nagios_-screenshots

here is a sample code snippet:

if [ $space -ge $CRITCAL ] ; then
echo "DISK SPACE CRITICAL - 90% disk space used [10GB free on /]"
exit 2;
fi

Need Nagios/Monitoring consulting? Maybe I can help, I am currently working on, as project lead, one of the biggest Nagios installs, for a Wal-Mart and Novell.

*Name
*Mail
Website
Comment