Page 1 of 1

Monitoring of Command output

Posted: Wed Feb 21, 2018 11:52 am
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 ?

Re: Monitoring of Command output

Posted: Wed Feb 21, 2018 12:42 pm
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.