JVM

Monitor JVM and Notify via e-mail

# This script monitors the free heap space of two servers every 5 minutes
# and sends an email if the free space is less than a certain threshold.

# Thanks to Marco Vannini for submitting this script

output off

MAIL=alarm.sh
SLEEP=300000
THRESHOLD=80000000
password = xxxxxxx

while true do

   connect h3mis186oss.ced:9102 system $password

   SRV186 = h3mis186_domain1_cluster2
   HF186 = get /JVMRuntime/$SRV186/HeapFreeCurrent

   if $HF186 < $THRESHOLD then
      CMD=expr(${MAIL} + " 186 " + ${HF186})
      call $CMD
   end

   disconnect

   # ---------------------------------------------

   connect h3mis187oss.ced:9102 system $password

   SRV187 = h3mis187_domain1_cluster2
   HF187 = get /JVMRuntime/$SRV187/HeapFreeCurrent

   if $HF187 < $THRESHOLD then
      CMD = expr(${MAIL} + " 187 " + ${HF187})
      call $CMD
   end

   disconnect

   # ---------------------------------------------

   sleep $SLEEP

end

exit