Excellent job on this Jay. I've been needing to do this for some time myself.

For those using this I've tidied it up a bit so it also includes the down time for services.
Once again, I hope this helps some of you, and feel free to forward any improvements my way!


Instructions:
Rename to WhatsDown.asp
Place this file in your WhatsUp\Web folder
Browse to http://WhatsUp.YourDomain.com/WhatsDown.asp

-Dave

Jay Drew wrote:

Scott,
Here's the hack, apologies to Dave Habben.
It adds a link back to the topview page, It refreshes. Look for the spot to alter for the name of your WUG machine.


I blatantly copied Dave's stuff and repeated the test looking for downed service.
Note that the counter for down time for a service WILL ALWAYS BE ZERO.


It's attached as down.txt, rename to down.asp, put in the web directory and then create a link from topview to it.
I do that in the mainpage prefix file.


Jay

<HTML>
 <HEAD>
  <!--  
    v1.0 Dave Habben, Original file
    v1.1 Jay Drew, Additional hacks to add service (w/o counters)
    v1.2 Dave Habben, Add counters for services 

    Credits to: 
     David Jones, Scrolling Marque Idea
     Robert Glatt & Scott Taylor, Downtime JavaScript
  -->
  <TITLE>Name of Your WUG Machine Here - Down Page</TITLE>
  <META http-equiv=REFRESH content="<%APPLICATION_SETTINGS% WEB_REFRESH_RATE>">
 </HEAD>
 <BODY>
  <table border>
   <tr>
    <td bgcolor="#c0c0c0" bordercolor="#c0c0c0">
     <a href="default.asp">Top View</a>
    </td>
   </tr>
  </table>
  <table cellSpacing=0 cellPadding=3 width="98%" bgColor="#c0c0c0" border=2>
   <tr>
    <td align=left>Down Devices</td>
   </tr>
   <tr>
    <td vAlign=top width="98%">
     <table cellspacing="2" cellpadding="0" width="100%" bgcolor="#c0c0c0" border="0">
      <tbody>
       <tr>
        <th width="12%" align="left">Map</th>
        <th width="23%" align="left">Device</th>
        <th width="15%" align="left">Down Time</th>
        <th width="25%" align="left">Info2</th>
        <th width="25%" align="left">Notes</th>
       </tr>
       <%START_LOADED_MAP_LIST%>
        <%START_DEVICE_LIST%>
         <%IFNOT% IS_DEVICE_UP>
          <TR>
           <TD>
            <a href="map.asp?map=<%URL_ENCODE% (%MAP% FILENAME)>"><%MAP% NAME></A>
           </TD>
           <TD>
            <%IF% (%LESSTHAN% (%DEVICE% CURRENT_DOWN_COUNT, 2))>
             <a href="device.asp?map=<%MAP% FILENAME>&device=<%DEVICE% UNIQUE_ID>">
              <FONT COLOR=GREEN>
               <%DEVICE% DISPLAY_NAME>
              </FONT>
             </a>
            <%ELSEIF% (%LESSTHAN% (%DEVICE% CURRENT_DOWN_COUNT, 4))>
             <a href="device.asp?map=<%MAP% FILENAME>&device=<%DEVICE% UNIQUE_ID>">
              <FONT COLOR=YELLOW>
               <%DEVICE% DISPLAY_NAME>
              </FONT>
             </a>
            <%ELSE%>
             <a href="device.asp?map=<%MAP% FILENAME>&device=<%DEVICE% UNIQUE_ID>">
              <FONT COLOR=RED> 
               <%DEVICE% DISPLAY_NAME>
              </FONT>
             </a>
            <%ENDIF%>
           </TD>
           <TD>
            <SCRIPT LANGUAGE="JavaScript">
             var downtime = <%DEVICE% POLL_FREQUENCY>*<%DEVICE% 
CURRENT_DOWN_COUNT>*<%MAP% POLL_INTERVAL>;
             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 downhours = 0;
              var downminutes = Math.floor(downtime/60);
             }
             if (downhours == 0)
              document.write(downminutes + " min")
             else
              document.write(downhours + " hr : " + downminutes + " min")
            </SCRIPT>
           </TD>
           <TD><%DEVICE% INFO_LINE_2></TD>
           <TD><%DEVICE% NOTES></TD>
          </TR>
         <%ENDIF%>
         <%IF% IS_DEVICE_UP>
          <%IF% (%GREATERTHAN% (%DEVICE% MONITOR_DOWN_COUNT,0))>
           <TR>
            <TD>
             <a href="map.asp?map=<%URL_ENCODE% (%MAP% FILENAME)>">
              <%MAP% NAME>
             </A>
            </TD>
            <TD>
             <a href="device.asp?map=<%MAP% FILENAME>&device=<%DEVICE% UNIQUE_ID>">
              <FONT COLOR=GREEN>
               <%DEVICE% DISPLAY_NAME>
              </FONT>
             </a>
            </TD>
            <TD></TD>
            <TD>
             <%DEVICE% INFO_LINE_2>
            </TD>
            <TD>
             <%DEVICE% NOTES>
            </TD>
           </TR>
           <%START_SERVICE_STATISTICS_LIST%>
            <%IFNOT% IS_SERVICE_UP>
             <TR>
              <TD></TD>
              <TD>
               <%IF% (%LESSTHAN% (%SERVICE_STATISTICS% CURRENT_DOWN_COUNT, 2))>
                <FONT COLOR=GREEN>
                 <%SERVICE_STATISTICS% ABBREVIATED_NAME>&nbsp;<%SERVICE_STATISTICS% 
COMMENT>
                </FONT>
               <%ELSEIF% (%LESSTHAN% (%SERVICE_STATISTICS% CURRENT_DOWN_COUNT, 4))>
                <FONT COLOR=YELLOW>
                 <%SERVICE_STATISTICS% ABBREVIATED_NAME>&nbsp;<%SERVICE_STATISTICS% 
COMMENT>
                </FONT>
               <%ELSE%>
                <FONT COLOR=RED>
                 <%SERVICE_STATISTICS% ABBREVIATED_NAME>&nbsp;<%SERVICE_STATISTICS% 
COMMENT>
                </FONT>
               <%ENDIF%>
              </TD>
              <TD>
               <SCRIPT LANGUAGE="JavaScript">
                var downtime = <%DEVICE% POLL_FREQUENCY>*<%SERVICE_STATISTICS% 
CURRENT_DOWN_COUNT>*<%MAP% POLL_INTERVAL>;
                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 downhours = 0;
                 var downminutes = Math.floor(downtime/60);
                }
                if (downhours == 0)
                 document.write(downminutes + " min")
                else
                 document.write(downhours + " hr : " + downminutes + " min")
               </SCRIPT>
              </TD>
              <TD></TD>
              <TD></TD>
             </TR>
            <%ENDIF%>
           <%END_SERVICE_STATISTICS_LIST%>
          <%ENDIF%>
         <%ENDIF%>
        <%END_DEVICE_LIST%>
       <%END_LOADED_MAP_LIST%>
      </tbody>
     </table>
    </td>
   </tr>
  </table>
 </BODY>
</HTML>

Reply via email to