normal script to show alert

normal script to show alert

Hi,

I made a script to test with opmanager to monitor disk in freebsd. I can run this script on server console but while chekcking with opmanager got, below error.

Script Result
Exit Code 4
Message Monitor Disk Health :For Windows machines scripts cannot be executed remotely:Hhg-sto-100

 
Data Data is not found/invalid data format - Please refer the help card 'Output Format' part for assistance.


my bash script:

#!/usr/local/bin/bash

tmpfile=`mktemp`

trap "rm -f $tmpfile" INT EXIT TERM


check_drive() {
  if [ "`awk '$2 ~ /(Error|Offline_Uncorrectable|
Bad_Block)/ { sum+=$NF} END { print sum} ' $tmpfile`"  == 0 ]
  then                                                    
     a=0;
  else
    a=1;
  fi
}

for drive in /dev/ada[0-9] /dev/ada[0-9][0-9] /dev/da[0-9] /dev/da[0-9][0-9]
do
        smartctl -a $drive | sed '/Vendor Specific SMART Attributes/, /SMART Error Log Version/ !d' > $tmpfile
done

check_drive

echo "Data:"
echo "A     $a"



















I can run this script successfully on server command prompt, but while checking with opmanager got above error. what could be wrong with this.

Regards
Ben

























                New to ADSelfService Plus?