2005-09-12 Jason Schoonover Uptime plugin The uptime plugin used to be more of a joke, it used to do nothing except get the uptime of the unnoc server and display it nice and neatly on the main page. However, as of unnoc 1.0.2, it will grab all of the uptimes of all the devices and servers that it knows about via SNMP and will find the mean uptime via sysUptime MIBs, and then display that on the main page. It can display the mean value (the averaged value of all of the uptimes), the max value (display the server who has been up the longest), the min value (the server who has been rebooted most recently). The mean value generally will give a good assessment of how good/bad things are going. To config it, use the uptime variable. If you would like to use it, you need to include the two .js files in your index.php file (or whatever file you choose). uptime-script.js goes in the definition uptime-body.js goes in the tag (main clock display) The way it works is like this: 1. All of the uptimes are collected with the perl scripts and update the database with the uptime ticks. 2. Then, update-uptimes.pl will run (however often you want it to) and will read in all of the uptimes, calculate the meantime, the max time and the min time and will write them to respective txt files in the plugins/uptime directory. 3. Then when you load the page, this calls uptime-script.js which will read in the txt files and will run a counter on now() vs. whatever value you've configured it to use (mean, max or min) I know what you're thinking: why don't' you just write a javascript page that reads the SQL db directly and calculates the mean time. That is true, I could skip all of this, however (as far as I know) that would require a SQL call every 1 second which seems that it would put a bit of a strain on the server. Plus I suck at javascript, so if there's a way to do this in javascript that wouldn't require a ton of calls to the SQL server, then I would *love* to hear about it. uptime = mean The scripts will do the rest. That's about it. Credits: I know hardly any javascript at all, I can only squeeze by. The original uptime javascript code was downloaded from: http://javascript.internet.com/clocks/digital-countdown.html Original algorithm was written by someone named "DendE PhisH". I don't have an email address or anything to credit him, but that's who the javascript came from. vim:tw=72:wm=1