Introduction

Since GreenLight version 2.9.6 you can use a lot of nagios scripts in combination with the Linux Shell Script Sensor. The following example shows you what things you need to do in order to use the Core Nagios Plugins on the GreenLight appliance.
It is very similar to our ldapsearch kbase article ( LDAP Query )

Please keep in mind that these installations are not part of our support!

Configuration

Download

First of all you need to install the latest Nagios Plugins (not the Nagios Core Application!)

Install the Plugins

Nagios Plugins are now installed /available under--->  /usr/local/nagios/libexec


Create a Shell Script with the following code and name it "dns.sh"


#!/bin/bash
# $3 --> DNS Server
# $4 --> URL for lookup

TIME_START=$(($(date +%s%N)/1000000))
DNSStatus=`/usr/local/nagios/libexec/check_dig -H $3 -l $4 |grep time | awk '{print $2}'`
TIME_DONE=$(($(date +%s%N)/1000000))


if [ "$DNSStatus" = "OK" ]
    then
        echo DNSStatus:1
        echo DNSStatus.query.time_ms:$(($TIME_DONE - $TIME_START))
    else
        echo DNSStatus:0
        echo DNSStatus.query.time_ms:$(($TIME_DONE - $TIME_START))
fi


copy the dns.sh to /opt/panagenda/scripts/gl_sensor


Open GreenLight Frontend and create a new Linux Shell Script Sensor

-Script Filename:  dns

-Parameters:  first parameter--> DNS Server which you want to use for the dns query (e.g. internal DNS server, public DNS, ..)

                     second parameter --> which FQDN you want to resolve

 

 

-Targets:  specify a host server (or any other server)

 

Output / Result 

greenlight.shell.script.DNSStatus=

greenlight.shell.script.DNSStatus.query.time_ms=


 

 

Conclusion

This is just one example out of many. So you can use more or less the same steps for most of the Nagios Core Plugins. Please checkout other Nagios / GreenLight kbase articles in the future