Monitoring of Command output

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Monitoring of Command output

Post by bsivavani »

Hi,

We would like to monitor below command output

/opt/oracle/product/middleware/bin/emctl status oms|grep -vi up|grep -vi oracle

If command return any output send an alert.

Kindly advice if it is possible ?
bolson

Re: Monitoring of Command output

Post by bolson »

This script should do it:

Code: Select all

#!/bin/bash
var1=$(/opt/oracle/product/middleware/bin/emctl status oms|grep -vi up|grep -vi oracle)
if [ -n "$var1" ] then
echo $var1
exit 2
fi
This script will issue a critical alert and the output of the command if any, and a status of ok if there is no output.
Locked