I wrote a quick safety feature for my Hyperic server that monitors the Hyperic Server process every minute and if the Server stops or dies the script will attempt to restart it. Nothing fancy but it’s a nice little feature… plus you can change a couple lines and make one to monitor your Hyperic Agents as well…
#!/usr/bin/perl
# ---------- Hyperic 5.0.0 Server Heartbeat Check ------------
# This script is used to verify that the Hyperic 5.0.0 Server is running and
# restarts it upon failure. To schedule it to run automatically every
# minute on linux run the following:
# crontab -e */1 * * * * <Path to this script>
# NOT SUPPORTED OR PROVIDED BY VMWARE AND HAS NO GUARENTEES
$cmd = "/opt/hyperic/server-5.0.0-EE/bin/hq-server.sh status";
$out = `$cmd`;
# print "Output $cmd\n";
# print "Output Check 1 - $out\n";
if (index($out, "HQ Server is not running") != -1)
{
# print "\nHQ Server is dead\n";
# Restart the HQ Service
$cmd = "/opt/hyperic/server-5.0.0-EE/bin/hq-server.sh start" ;
$out = `$cmd`;
# print "Restarting the Service\n $out \n ";
}
else
{
# print "\nServer is running\n";
}
No comments:
Post a Comment