2 Replies Latest reply on Jan 15, 2005 10:25 AM by masoncooper

    NetPerfMon-NetObjects.SnapShot

      Hello,

      Is there any code available using which I can display the NetPerfMon-NetObjects.SnapShot in IIS? Cause right now when I host the site with NetPerfMon-NetObjects.SnapShot default document ...It does not open the XML - instead asks to save.

      I searched for xml webhosting and found that I need to call the XML file using codes e.g. Java,XDL,CSS in a html page and so on.
      This is something I am not understanding....If any site which can guide me - It will be a great help.
        • Re: NetPerfMon-NetObjects.SnapShot
          Network_Guru
          Do a search in this forum for "XML".
          There have been other posts on this subject.

          -=Cheers=-
                    NG
          • Re: NetPerfMon-NetObjects.SnapShot
            Since the XML file if only data, you  need some way of describing how you want the data displayed.  The way I displayed our snapshot file was by loading an XML stylesheet (XSL) and applied the XML data to it.

            The entire process requires 3 files and no server-side processing (it's all done at the client-side)

            First, I have my XSL sheet, it is fairly basic but it allows us to see what we need to see
            --------Systems.xsl--------
            <?xml version="1.0"?>

            <xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

            <xsl:template match="/">
              <html>
              <body>
                <h2>System Status for <xsl:value-of select="NetPerfmon/Snapshot/@TimeStamp"/></h2>
                <table border="1">
                <tr bgcolor="#9acd32">
                  <th align="left">Device</th>
                  <th align="left">Interface</th>
                  <th align="left">Status</th>
                  <th align="left">% In</th>
                  <th align="left">% Out</th>
                  <th aligh="left">In</th>
                  <th aligh="left">Out</th>
                  <th aligh="left">Max In Today</th>
                  <th aligh="left">Max Out Today</th>
                </tr>
            <xsl:for-each select="NetPerfMon/NetworkNodes/NetworkNode/Interfaces/Interface">
                <tr>
                  <td><xsl:value-of select="../../@NodeName"/></td>
                  <td><xsl:value-of select="@InterfaceCaption"/></td>
                  <td><xsl:value-of select="@OperStatus"/></td>
            <xsl:choose>
              <xsl:when test="RawData/@InPercentUtil > 50">
                  <td bgcolor="red"><xsl:value-of select="@InPercentUtil"/></td>
              </xsl:when>
              <xsl:otherwise>
                  <td><xsl:value-of select="@InPercentUtil"/></td>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="RawData/@OutPercentUtil > 50">
                  <td bgcolor="red"><xsl:value-of select="@OutPercentUtil"/></td>
              </xsl:when>
              <xsl:otherwise>
                  <td><xsl:value-of select="@OutPercentUtil"/></td>
              </xsl:otherwise>
            </xsl:choose>

                  <td><xsl:value-of select="@InBps"/></td>
                  <td><xsl:value-of select="@OutBps"/></td>
                  <td><xsl:value-of select="@MaxInBpsToday"/></td>
                  <td><xsl:value-of select="@MaxOutBpsToday"/></td>
                </tr>
                </xsl:for-each>
                </table>
              </body>
              </html>
            </xsl:template></xsl:stylesheet>
            --------Systems.xsl--------
            Notice the xsl:for-each, this will go through all interfaces in NetPerfMon/NetworkNodes/NetworkNode/Interfaces

            And of course you have your NetPerfMon-NetObjects.Snapshot file

            And lastly you bring the two together with a basic HTML file
            -------SystemStatus.htm-------
            <html>
            <head><META HTTP-EQUIV="refresh" content="300"></head>
            <body><script type="text/javascript">// Load XML
            var xml = new ActiveXObject("Microsoft.XMLDOM")
            xml.async = false
            xml.load("NetPerfMon-NetObjects.SnapShot")

            // Load XSL
            var xsl = new ActiveXObject("Microsoft.XMLDOM")
            xsl.async = false
            xsl.load("Systems.xsl")

            // Transform
            document.write(xml.transformNode(xsl))</script>

            </body>
            </html>
            -------SystemStatus.htm-------
            This is also pretty basic, just a little bit of javascript.
            We load both files into XMLDOM objects and then use the transformNode method of the XML file to create our new layout.

            I'd strongly recommend looking at http://www.w3schools.com/xsl/xsl_languages.asp for more info on stylesheets, they are pretty powerful and best of all, they don't necessarily require server-side processing.

            Hope this helps!

            Cooper & Scully
            900 Jackson St Suite 100
            Dallas, TX 75202
            mason.cooper@cooperscully.com