Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Server Monitoring

  1. #11
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,048
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Server Monitoring

    I find it easier to use ruptime:

    sudo apt-get install rwho
    man ruptime

    You can search the forum for ways to write a zenity or notify-osd script that displays up and down servers in your desktop toolbar.

    Using zenity:

    http://ubuntuforums.org/showthread.p...ruptime+zenity

    It could be rewritten for notify-osd.
    Last edited by tgalati4; March 22nd, 2011 at 05:38 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  2. #12
    Join Date
    Sep 2008
    Location
    canada
    Beans
    Hidden!

    Re: Server Monitoring

    Thanks for the zenety link it is on my list of things to check out.
    ooh found a good link for zenity
    http://linux.byexamples.com/archives...og-examples-1/
    Last edited by pl@yer; March 22nd, 2011 at 05:56 PM.

  3. #13
    Join Date
    Mar 2011
    Location
    England UK
    Beans
    52
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Server Monitoring

    I havnt looked at zenity but it defo sounds like the way forward,

    Regarding the shell script try running it in bin/bash rather than usr/bin/ksh

    Ive never used korn shell so can't tell if the script would run

  4. #14
    Join Date
    Sep 2008
    Location
    canada
    Beans
    Hidden!

    Re: Server Monitoring

    korn shell wont like substitution like this $() afaik I think you need to either use backticks `` or curly braces ${}

  5. #15
    Join Date
    Mar 2011
    Location
    England UK
    Beans
    52
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Server Monitoring

    Hi made a script today while bored for pinging, hope it might help you on your way. I was planning on making it email but got to rush out.

    Code:
    #!/bin/bash
    # Tool to ping a list of hosts and test if their responding.
    clear
    
    #holds the list of hosts to ping
    hostList=(
    www.google.co.uk 
    192.168.0.1 
    192.168.0.2 
    192.168.0.3 
    192.168.0.4 
    192.168.0.5 
    192.168.0.6 
    192.168.0.7 
    192.168.0.8 
    192.168.0.9 
    192.168.0.10
    )
    
    #Holds the up hosts that respond to the ping
    upList=()
    
    #Holds the list  of down hosts who dont respond to ping
    downList=()
    
    #Ping request time out 1= fast(but unreliable for non LAN use) recomend 5 for WAN pinging 
    timeOut=1
    
    
    #Ping every host in the list
    for host in ${hostList[@]}
    do
    	STRC=`ping -W $timeOut -c 1 $host | grep "1 received" | cut -f5 -d ' '`
    	if [ "$STRC" = "received," ]
    	then
    	echo $host reachable
    	upList=( "${upList[@]}" $host )
    		
    	else
    	echo $host unreachable
    	downList=( "${downList[@]}" $host )	
    	fi
    done
    echo
    
    #Give a summary
    echo Up:   ${upList[@]}
    echo Down: ${downList[@]}
    It will give you two arrays at the end with up hosts and down hosts so you should be able to use these lists to include in email
    Last edited by conneco; March 23rd, 2011 at 05:27 PM.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •