Graphical Internet and Website Server Monitor
Author: Carl Sassenrath This example requires REBOL/View Return to REBOL Cookbook
Here is the improved Internet server monitor that I use a lot these
days. It's different in a few ways from prior monitors:
- Monitors multiple servers.
- Can monitor web sites but also other services that allow TCP connections,
such as AltME worlds, game servers, etc.
- Updates every 10 minutes (or set it to whatever time period you want).
- Click any indicator button to check again. Right click to open web
browser to that site.
- Only makes the TCP connection - no data transferred (so should not
cause your website statistics be affected.)
- Cool looking graphical interface (with DRAW generated indocators).
Here's a screen shot of the site monitor. Green means good, red
means bad. The indicators are created from a DRAW description not an
image, so you can modify how they look just with a few small edits
to the script.
Special Notes:
- This approach uses a simple TCP connection. Sometimes a physical
server may make the connection, but the service itself (e.g. web
server) may not actually be down. It is rare, but it can happen.
This monitor will not detect such outages.
- Some web sites use redirection of the URL to the actual server.
The method here will not account for that redirection.
Here is the code. Just change the sites list for the servers you
want to monitor. Note the example that checks an AltME world by
specifying a check on port 5400.
REBOL [
Title: "GISMo - Graphical Internet Server Monitor"
File: %gismo.r
Version: 1.1.1
Author: "Carl Sassenrath"
Needs: [view 1.3.1]
]
time-out: 5 ; Seconds to wait for the connection (adjust it!)
poll-time: 0:10:00
system/schemes/default/timeout: time-out
system/schemes/http/timeout: time-out
sites: [
; List of URLs (http or tcp are allowed)
http://www.rebol.com
http://www.rebol.net
http://mail.rebol.net
http://mail.rebolot.com
tcp://www.altme.com:5400
]
foreach site sites [
; Convert any http to tcp on port 80
if find/match site http:// [
insert remove/part site 7 tcp://
append site ":80"
]
]
img: make image! [200x40 0.0.0.255]
draw img [
pen coal
fill-pen linear 0x0 0 44 89 1 1 silver gray coal silver
box 8.0 0x0 199x39
]
out: [backeffect [gradient 0x1 black coal]]
foreach site sites [
port: make port! site
append out compose/deep [
image img (form port/host) [check-site face] [browse face/data]
with [data: (site)]
]
]
append out [
pad 50x0
btn water 100 "Refresh" rate poll-time feel [
engage: func [f a e] [if find [time down] a [check-sites]]
]
]
color-face: func [face color] [
face/effect: reduce ['colorize color]
show face
]
check-site: func [face] [
color-face face gray
color-face face either attempt [close open face/data true][green][red]
]
check-sites: does [
foreach face out/pane [
if face/style = 'image [check-site face]
]
]
out: layout out
view/new out
check-sites
do-events
|
Depending on the speed of your Internet access and the location of
the server on the net, it may be necessary to adjust the time-out
value above.
|