Jump to content

Monitor Script (not really a plugin)


arrestedgames

Recommended Posts

This is assuming Linux, I have no clue if this is valid on a windows machine...

Probably going to rewrite this in python; so that it is more live/realtime - but for testing purposes I use this for showing the status of the test box:

 

#!/bin/bash
world_status="UP"
auth_status="UP"
system_status="UP"
auth_color="green"
system_color="green"
world_color="green"

function get_world()
{
 for worldlist in `./world.sh -v -C status | awk '{ print $(NF-1)}'`
 do
 if [ "$worldlist" = "NOT" ]; then
 world_status="DOWN"
 world_color="red"
 fi
 done
}

function get_auth()
{
 for authlist in `./auth.sh -v -C status | awk '{ print $(NF-1)}'`
 do
 if [ "$authlist" != "NOT" ]; then
 auth_status="DOWN"
 auth_color="red"
 fi
 done
}

function get_total()
{
 for totallist in $auth_status $world_status
 do
 if [ "$totallist" != "UP" ]; then
 system_status="DOWN"
 system_color="red"
 fi
 done
}

get_world
get_auth
get_total

current_date=`date +%D`
current_time=`date +%T`
function print_html()
{
 cat < /path_to_web_root_healthcheck/index.html
DATE: $current_date

TIME: $current_time

WORLD: $world_status

AUTH: $auth_status

OVERALL: $system_status
EOF
}

function print_text()
{
 cat < /path_to_web_root_healthcheck/index.txt
DATE: $current_date
TIME: $current_time
WORLD: $world_status
AUTH: $auth_status
OVERALL: $system_status
EOF
}

print_html
print_text

 

added this to the atavism user crontab:

 

crontab -e

then add:

*/15 * * * * /Path_To_Server/atavism_server/bin/check_status.sh

 

it runs every 15 minutes, and spits out a pair of files that can be curled/wget/included whatever.

probably not the best thing to run in a production env, but for testing it gives you a quick look at the health of all the services.

Link to comment
Share on other sites

  • 3 months later...

hi,

 

thanks arrestedgames.

 

below my stone on your proposal.

 

pattern "RUNNING" is not the better way because when u catch world.sh status, u can see "NOT RUNNING", same case for auth.sh.

 

 

i guess, u need to update world.sh and auth.sh with "OFFLINE" instead off "NOT RUNNING", for example.

 

 

FIX

 

In function

get_auth()

, update

 

for authlist in `./world.sh -v -C status | awk '{ print $NF}'`

 

by

 

for authlist in `./auth.sh -v -C status | awk '{ print $NF}'`

 

 

let me know.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recommended Cloud Solution


    ksweb.net

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.