Page 1 of 1

2 checks 1 service

Posted: Mon Aug 17, 2015 5:32 am
by tmeto
hi,

can i put in one single service the result of 2 checks?

I mean, in the FortiMail, different mail queues, each with its name and size. I attached photo to be better understood.

I seek to represent multiple values of the same line in one service, like so:

snmpwalk -v2c xx.xx.xx.xx - -c comunity fmlMailQueueMailCount.1 && snmpwalk-v2c xx.xx.xx.xx -c comunity fmlMailQueueMailSize.1
FORTINET-FortiMail-MIB :: fmlMailQueueMailCount.1 = Gauge32: 0
FORTINET-FortiMail-MIB :: fmlMailQueueMailSize.1 = Gauge32: 0


Image

Re: 2 checks 1 service

Posted: Mon Aug 17, 2015 1:35 pm
by jdalrymple
The answer is a wrapper script for your plugin. Here is a simple example:

Code: Select all

#!/bin/bash

nrpe="/usr/local/nagios/libexec/check_nrpe"
hostname="127.0.0.1"
check_one="$1"
check_two="$2"

$nrpe -H $hostname -c $check_one
return_one=$?

$nrpe -H $hostname -c $check_two
return_two=$?

output=3

if [ "$return_one" -ge 0 ] && [ "$return_two" -ge 0 ]; then
        output=0
        status="OK"
fi
if [ "$return_one" -ge 1 ] && [ "$return_two" -ge 1 ]; then
        output=1
        status="WARNING"
fi
if [ "$return_one" -eq 2 ] && [ "$return_two" -eq 2 ]; then
        output=2
        status="CRITICAL"
fi

echo $status
exit $output