This Chumby widget will check your linux web server every 30 seconds and display the server uptime as well as the average load for the past minute, 5 minutes, and 15 minutes. If the widget can’t reach your server, the screen will turn red and an alarm will sound.
After you load this widget into your Chumby, you must do three things to get it to work:
- Create a PHP file for the Widget to talk to.
- Put a crossdomain.xml file on your server.
- Configure the Widget on the Chumby website.
A small php file must be created and posted on your website (this is the file that the widget will get the server uptime from).
Here’s the code:
$uptime = explode(” “, @exec(“cat /proc/uptime”));
$load = explode(” “, @exec(“cat /proc/loadavg”));
Drop that code into a file (I called mine uptime.php) and place it on your server.
Cross-domain XML File
In order for Flash to access data from a server, a crossdomain.xml file must exist on the top level of your website and must be setup properly. You can read more about it here. Below is the contents of my file which is also available at http://www.ryanc.com/crossdomain.xml
<!DOCTYPE cross-domain-policy SYSTEM “http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd”>
<allow-access-from domain=”*” />
Configure the Widget
When you configure this widget on the Chumby website, enter the full URL to the php file. You’ll also need to enter a password. By default, the password is “pass”, but you can change this on the 2nd line of the php code.
A few notes about this widget…
- If it can’t read the php file, the screen will turn red and an alarm will sound You should test this at least once by temporarily renaming or removing your php file.
- The widget checks your server every 30 seconds, but you can press anywhere on your Chumby’s screen to force a refresh.
- This widget is in beta and probably will stay that way. Please do not rely solely on this widget to monitor your server. I’m not responsible for any incorrect or inaccurate messages on this widget.
I’d appreciate your comments & suggestions..