I need some assistance writing a script to monitor a RPC broker and notify if it is down.
I have a broker that runs on port 9250. When it is up it looks like the following:
# netstat -Aan|grep 9250
f1000e00025863b8 tcp4 0 0 172.16.2.1.9250 172.16.80.40.1185 ESTABLISHED
f1000e000ecafbb8 tcp4 0 0 *.9250 *.* LISTEN
f1000e00003a5bb8 tcp4 0 0 172.16.2.1.9250 172.16.81.105.1572 ESTABLISHED
f1000e000027cbb8 tcp4 0 0 172.16.2.1.9250 10.4.62.89.1123 ESTABLISHED
f1000e00021e03b8 tcp4 0 0 172.16.2.1.9250 10.4.68.210.1356 ESTABLISHED
f1000e000224bbb8 tcp4 0 0 172.16.2.1.9250 10.4.65.79.2659 ESTABLISHED
f1000e000047bbb8 tcp4 0 0 172.16.2.1.9250 172.16.2.143.1098 ESTABLISHED
f1000e00022783b8 tcp4 0 0 172.16.2.1.9250 172.16.5.173.1037 ESTABLISHED
When it is down it looks like the following:
# netstat -Aan|grep 9250
#
I would like to run a script from CRON every 2 minutes that looks for the broker to be up but if not, notify me via email...
So:
If broker is up = do nothing
If broker is down = email notification
mail -s "Broker 9250 is down" <email address> < /tmp/restart_broker.txt
So it emails that it is down and provides instructions on how to restart.
Any help would be greatly appreciated...
I have a broker that runs on port 9250. When it is up it looks like the following:
# netstat -Aan|grep 9250
f1000e00025863b8 tcp4 0 0 172.16.2.1.9250 172.16.80.40.1185 ESTABLISHED
f1000e000ecafbb8 tcp4 0 0 *.9250 *.* LISTEN
f1000e00003a5bb8 tcp4 0 0 172.16.2.1.9250 172.16.81.105.1572 ESTABLISHED
f1000e000027cbb8 tcp4 0 0 172.16.2.1.9250 10.4.62.89.1123 ESTABLISHED
f1000e00021e03b8 tcp4 0 0 172.16.2.1.9250 10.4.68.210.1356 ESTABLISHED
f1000e000224bbb8 tcp4 0 0 172.16.2.1.9250 10.4.65.79.2659 ESTABLISHED
f1000e000047bbb8 tcp4 0 0 172.16.2.1.9250 172.16.2.143.1098 ESTABLISHED
f1000e00022783b8 tcp4 0 0 172.16.2.1.9250 172.16.5.173.1037 ESTABLISHED
When it is down it looks like the following:
# netstat -Aan|grep 9250
#
I would like to run a script from CRON every 2 minutes that looks for the broker to be up but if not, notify me via email...
So:
If broker is up = do nothing
If broker is down = email notification
mail -s "Broker 9250 is down" <email address> < /tmp/restart_broker.txt
So it emails that it is down and provides instructions on how to restart.
Any help would be greatly appreciated...