Howard,
I can help you out with problem #1. You can calculate a device's down
time by multiplying the device poll frequency, device current down count
and the map poll interval together. Here's code to do it using
JavaScript that was posted on this forum a while back. It's also
attached as a .txt file in case the formatting gets screwed up. You
should be able to replace/modify the last if block to get it to display
the way you want.
Jim
<SCRIPT LANGUAGE="JavaScript">
var downdays = 0;
var downhours = 0;
var downminutes = 0;
var downtime = "<%DEVICE% POLL_FREQUENCY>"*"<%DEVICE%
CURRENT_DOWN_COUNT>"*"<%MAP% POLL_INTERVAL>"
if (downtime > 86399) {
var downtemp = downtime/86400;
var downdays = Math.floor(downtemp);
var downtemp = downdays*86400;
var downtime = downtime-downtemp;
var downtemp = downtime/3600;
var downhours = Math.floor(downtemp);
var downtemp = downhours*3600;
var downminutes = downtime-downtemp;
var downminutes = Math.floor(downminutes/60);
}
else if (downtime > 3599) {
var downtemp = downtime/3600;
var downhours = Math.floor(downtemp);
var downtemp = downhours*3600;
var downminutes = downtime-downtemp;
var downminutes = Math.floor(downminutes/60);
}
else {
var downminutes = Math.floor(downtime/60);
}
if ((downdays == 0) & (downhours == 0)) {
document.write(downminutes + " min")
}
else if (downdays == 0) {
document.write(downhours + " hr, " + downminutes + " min")
}
else {
document.write(downdays + " day, " + downhours + " hr, " +
downminutes + " min")
}
</SCRIPT>
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Howard Jones
Sent: Monday, October 10, 2005 11:01 AM
To: [email protected]
Subject: [WhatsUp Forum] WUG ASP questions...
Hi folks,
I'm in the process of updating our custom overview page in WUG 8.0, and
I have a couple of questions...
The way the page works is to have a client-side script fetch a
'data-only' page from WUG ASP, and process it on the client side to
produce a live display. I have all that working OK, and outputting a
JSON [1] formatted list of all my down devices, and sorting it before
updating the page.
My problems are:
1) Is there a %DEVICE% field that gives the time the device has been
down for *in this downed period*? The DOWN_TIME and CURRENT_DOWN_COUNT
both seem to be cummulative over time... I want my list to sort itself
so that the most recently failed items are at the top.
2) Does anyone know what the STATE numbers all mean? I think that 5 is
'device down', 1 is 'missed a poll', but what about the others?
Thanks in advance for any light that anyone can shed... Assuming I get
this thing working properly, I'll post a copy.
Best Regards,
Howard
[1] http://www.crockford.com/JSON/
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.
An Archive of this list is available at:
http://www.mail-archive.com/whatsup_forum%40list.ipswitch.com/
<SCRIPT LANGUAGE="JavaScript">
var downdays = 0;
var downhours = 0;
var downminutes = 0;
var downtime = "<%DEVICE% POLL_FREQUENCY>"*"<%DEVICE%
CURRENT_DOWN_COUNT>"*"<%MAP% POLL_INTERVAL>"
if (downtime > 86399) {
var downtemp = downtime/86400;
var downdays = Math.floor(downtemp);
var downtemp = downdays*86400;
var downtime = downtime-downtemp;
var downtemp = downtime/3600;
var downhours = Math.floor(downtemp);
var downtemp = downhours*3600;
var downminutes = downtime-downtemp;
var downminutes = Math.floor(downminutes/60);
}
else if (downtime > 3599) {
var downtemp = downtime/3600;
var downhours = Math.floor(downtemp);
var downtemp = downhours*3600;
var downminutes = downtime-downtemp;
var downminutes = Math.floor(downminutes/60);
}
else {
var downminutes = Math.floor(downtime/60);
}
if ((downdays == 0) & (downhours == 0)) {
document.write(downminutes + " min")
}
else if (downdays == 0) {
document.write(downhours + " hr, " + downminutes + " min")
}
else {
document.write(downdays + " day, " + downhours + " hr, " + downminutes + "
min")
}
</SCRIPT>