Options

How to cerate health monitor with External Program to monitor WEB PAGE Content

If your web page is static, in other words, this page not change, you can use this Bash Scritp to monitor this page:

1: collecte the hash from web server with curl (example)

curl http://abc.com/sites/default.xml | md5sum | sed -s s/-//g | awk {‘print$1’}

2: SLB -> Health Monitors -> External Programs, create new

 #!/bin/bash

HASH_XML=$(curl http://$HM_SRV_IPADDR/sites/default.xml | md5sum | sed -s s/-//g | awk {‘print$1’})

if [“449186eab67a4e4a4cd9ed2ef8a7ca1f” = “$HASH_XML” ]; then

  echo “ok”

  exit 0

else

  echo “fail”

  exit 1

fi

END_SCRIPT

were 449186eab67a4e4a4cd9ed2ef8a7ca1f is the a hash that collected at step 1

3: SLB -> Health Monitors -> Health Monitors Create New

Method Type: External

Program: choose the script that created at step 2

Done!

You can user this Health Monitor in Service Groups, Servers, Ports or in templates.


If the page content is changed (by an invader for example) the monitor returns down value to the monitored server.


You can change this script for to adjust to your environment as you want.


I hope this procedure can helps you!!

Regards,

Morato

Sign In or Register to comment.