Nagios Training: Create Custom Passive Checks

by Mike on September 15, 2009

in Nagios


Creating Custom Scripts
Both the good and the bad of passive checks is that you will need to construct  your own scripts in order to assess the output and determine the host and service status.  Here is a simple example of what you will need to do.

Lesson 7 | Quiz

# Custom Script for Users
USERS=`who |wc -l`
if (($USERS  <= 3 ))
then CMD=”nagpass;Users;0;Current Users $USERS”
elif (( $USERS >= 4 ))
then CMD=”nagpass;Users;1;Current Users $USERS”
/bin/echo $CMD | /usr/sbin/send_nsca -H -d ‘;’ -c $CFG

Here is the output, 3 or less users, you send the “O” for OK.

Create Custom Passive Checks O for OK

Here the output is more than 3 users so you issue a warning with “1”.

Create Custom Passive Checks 1 for Warning

If the output is over your warning level you can enter “2” for critical.

Course Outline
Nagios: Passive Checks
Install NSCA on Server
Install xinetd on Server
Client Install of NSCA
Passive Host Checks
Passive Service Checks
Passive User Checks
Custom Passive Scripts

Previous post:

Next post: