[AddOn] WIO, Who is Online: Host up/down availability monitor with rrdtool and Fritz

ramik

Neuer User
Mitglied seit
3 Mai 2007
Beiträge
168
Punkte für Reaktionen
0
Punkte
16
I've always need a method to monitor the up/down time of my machines, but I didn't want to go in the long complicated methods (snmp servers, monitor, etc), so yesterday with the help of google (and the WhoIsOnline [wio] IPCOP project for graphs, hence the name wio), I came out with this script to run on my fritz:

On a regular interval, it pings IP's defined in a text file, and logs the data with rrdtool, which can be later viewed as a graph

Screen Shot 2011-08-23 at 7.19.00 PM.pngScreen Shot 2011-08-23 at 7.19.18 PM.png

I am attaching the initial script as it is.

To run, unzip the file to the USB storage attached to the fritz box (currently, the scrips will look for files in this directory: /var/media/ftp/uStor01/wio, if you put the files in other locations, you need to change the hard-coded path), then edit the hosts.ip file with the desired hosts to monitor, then start run.sh on the telnet/ssh, this will put a web server on port 94, and starts the process of ping every 10 minutes. After a while you'll start getting the graphs.

This script is still in early stages (started yesterday) and still need work to be done, such as make the interval of checking more dynamic, more configurable, better interface to view the graphs with more intervals (day/week/month), and it will be great if it can be made as a Freetz package (which I have never done).

Update 1: v0.2
I've made small changes:
  • now you can define an alias for the IP address
  • a config file to set paths, and web server port, still useless as each shell script which uses it does an include with the absolute path

Update 2: v0.3
Updated the status webpage:
  • Now the rrdgraph is only executed when you open the web page (slower than before, but better than generating all graphs every 10 minutes)
  • Graphs are also available for other periods (12 hours, 1 day, 1 week, 1 month, 1 year), configurable in the config.inc file
  • The wio.cgi does a relative include of the config.inc, no more need to change absolute file path there.
  • included the checkip shell script into the update.sh, 1 less file

Feedback (& help) are welcomed....
 

Anhänge

  • wio.zip
    48.9 KB · Aufrufe: 8
  • wio_0.2.zip
    14 KB · Aufrufe: 1
  • wio_0.3.zip
    22.3 KB · Aufrufe: 12
Zuletzt bearbeitet:
Hey, nice idea, ramik.
Maybe I'll test it at this weekend.
 
great thing. Thanks a lot.
I have testet it. It is a bit to do to modify all path, but if you do it everywhere it will work.
I have modified: wio.cgi, update.sh, run.sh and the host.ip list.

The only thing is the index.html and maybee other need the right rights otherwise - like in my case - you will see: "The requested URL was not found" :)

A nice addon would be if the IPaddress on the webpage has also a hostname.
Sometimes i forget which ip address has which Mediaplayer, TV, PC, Phone, ... ;)
 
Zuletzt bearbeitet:
A nice addon would be if the IPaddress on the webpage has also a hostname.
Sometimes i forget which ip address has which Mediaplayer, TV, PC, Phone, ... ;)

I have this in mind, the only problem is that I'm not much of shell programmer and don't have much experience in shell regexp or awk.
 
me too, but this is a short (maybee not good) implementation for this idea

=> cgi-bin/wio.cgi
Code:
cgi_begin "Fritz!Box Host Monitor" 'stats'

cat $ROOT/host.ip | while  read IP;do
        [B]IPonly=`echo $IP | awk '{print $1}'`
        IPhostname=`echo $IP | awk '{print $2}'`[/B]
        [B]sec_begin "Host: $IPonly / $IPhostname"
[/B]
        cat << EOF
        <img src="/stats/[B]$IPonly[/B]-day.png" alt="Host $IPonly" border="0"/>
EOF

=> update.sh
Code:
cat host.ip [B]| awk '{print $1}'[/B] | while  read IP;do
        result=`$ROOT/checkip $IP`
#       echo "Host $IP: $result"

Now you can put in the host.ip two values in the file
Code:
192.x.x.x   router2
192.x.x.x   nasserver
...
 
thanks waldoo, but before seeing your post I already found a way to put a host name / alias.

my next step is to change the method the graphs are generated, in a way that they are generated when the page is opened, and not every 10 minutes, with the ability to select one host and see graphs for week/month/year, as the rrdstats
 
and yet another update (v0.3), check first post for changelog
 
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.