Python script

Python script

Hi,

I have  script that work well with Nagios in my SUSE sles 11  machine.
How can i use the same  script and add in Opmanager -script monitor template?

Below are the  script that i need to put in Opmanager.


Thanks

#!/bin/bash

if [ $# != 2 ]; then
  echo "Bad number of parameters. Provide warning limit and critical limit"
  exit 3
fi

ntpfile='/etc/init.d/ntp'

if [ ! -f $ntpfile ]; then
  echo "ntp daemon not found"
  exit 3
fi

offset=`/etc/init.d/ntp status | awk ' { print $9} ' | sed -n 3p`

if [ -z "$offset" ]; then
    echo "ntp daemon not running"
    exit 3
fi
 
lessThanZero=`echo "$offset < 0" | bc`
if [ $lessThanZero -eq 1 ]; then
  absOffset=`echo "$offset * -1" | bc`
else
  absOffset=$offset
fi
resultWarning=`echo "$absOffset > $1" | bc`
resultCritical=`echo "$absOffset > $2" | bc`
if [ $resultCritical -eq 1 ]; then
  exitStatus=2
elif [ $resultWarning -eq 1 ]; then
  exitStatus=1
else
  exitStatus=0
fi

echo Offset: $offset milliseconds
exit $exitStatus
                New to ADManager Plus?

                  New to ADSelfService Plus?