Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-12-2002, 03:49 PM   #1
Don't tread on me
 
cobra's Avatar
 
Join Date: Mar 1999
Location: Florida
Posts: 2,121
Send a message via ICQ to cobra Send a message via AIM to cobra
Help parsing xml

ok, so I have a webserver, I use coolmon to collect stats from server usage, IE cpu%, memory, diusk space, threads, blah, blah,
Coolmon saves all this data to an xml file, what I want to do is, have it parsed out to an html page so I can have it viewed in a nice htnl format, rather than xml....(puzzle)
Here is the xml:

Quote:

-
-
0 days, 02 hrs, 03 mins, 21 secs
276
30
617
112
505
254
125
129
00.00
00.80
00.00
37,413.85
41,178.62
10.37.123.12
PNS
jds7472
Date 12/08/02 Time 15:49

31,593
i686


-
Proc %25: 00.00
Processes: 30 Threads: 276
0 days, 02 hrs, 03 mins, 21 secs
PageUsed: 112/PageTotal: 617
RAMUsed: 125/RAMTotal: 254
Date 12/08/02 Time 15:49
10.37.123.12
PNS
Threads: 276
RAMTotal: 254
RAMUsed: 125
RAMFree: 129
KB Read: 00.80
KB Write: 00.00
Date 12/08/02 Time 15:49
Drive C: 31,593
Processor: i686

crap, it won't even let me post the raw xml as code, or quote, big time suXors, nevermind.......
__________________
Miami, flee it like a native.

Last edited by cobra; 08-12-2002 at 03:51 PM.
cobra is offline   Reply With Quote
Old 08-13-2002, 07:23 AM   #2
Member (10 bit)
 
Join Date: Apr 2001
Location: Michigan
Posts: 850
Send a message via ICQ to HackinCowboy
Do you have access to a web server? Upload that xml file to it and we can look at the source from there. I've only used xml a limited amount, but why can't you just use that file, and structure it like the way you want?
HackinCowboy is offline   Reply With Quote
Old 08-18-2002, 04:43 AM   #3
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
You need to learn a programming language to parse XML, since you have a web server, I think PHP is a good choice, you can use PHP to parse the XML page and make an easy to read HTML page.
BTW, I don't think that the XML page is that hard to read.
aym is offline   Reply With Quote
Old 08-26-2002, 03:48 PM   #4
Don't tread on me
 
cobra's Avatar
 
Join Date: Mar 1999
Location: Florida
Posts: 2,121
Send a message via ICQ to cobra Send a message via AIM to cobra
I got it
here's a pic of it in action. Auto refreshes every 3 seconds.
Attached Images
File Type: jpg stats.jpg (64.6 KB, 48 views)
cobra is offline   Reply With Quote
Old 08-26-2002, 05:19 PM   #5
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
nice, how did you create it?
aym is offline   Reply With Quote
Old 08-26-2002, 06:39 PM   #6
Don't tread on me
 
cobra's Avatar
 
Join Date: Mar 1999
Location: Florida
Posts: 2,121
Send a message via ICQ to cobra Send a message via AIM to cobra
I will post the xml and html when I am at work tomorrow.
cobra is offline   Reply With Quote
Old 08-27-2002, 09:02 AM   #7
Don't tread on me
 
cobra's Avatar
 
Join Date: Mar 1999
Location: Florida
Posts: 2,121
Send a message via ICQ to cobra Send a message via AIM to cobra
I tried posting with the "code" tag, but it keeps "formatting it,
why oh why does it always do this to me?
oh well...vb is suXor anyway

Last edited by cobra; 08-27-2002 at 09:05 AM.
cobra is offline   Reply With Quote
Old 08-27-2002, 11:02 AM   #8
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Because it contains HTMl-like tags, use [ PHP ] instead.
aym is offline   Reply With Quote
Old 08-27-2002, 12:45 PM   #9
Don't tread on me
 
cobra's Avatar
 
Join Date: Mar 1999
Location: Florida
Posts: 2,121
Send a message via ICQ to cobra Send a message via AIM to cobra
html code:
Code:
PHP Code:
<head>  <LINK REL=stylesheet HREF="cool.css" TYPE="text/css">    <title>:::PNS Webserver Stats:::</title>     <script languageJavaScript type="text/javascript">       function UpdateReadings(){        dom = new ActiveXObject("Msxml.DOMDocument");         dom.async false;                                     dom.load("http://10.37.123.12:61300");               cpu_load.innerHTML dom.getElementsByTagName("Uptime")[0].firstChild.nodeValue;        cpu_thread.innerHTML dom.getElementsByTagName("System_Thread_Count")[0].firstChild.nodeValue;       cpu_proc.innerHTML dom.getElementsByTagName("System_Processes_Count")[0].firstChild.nodeValue;       cpu_pagetotal.innerHTML dom.getElementsByTagName("Item_3")[0].firstChild.nodeValue;       cpu_date.innerHTML dom.getElementsByTagName("Item_5")[0].firstChild.nodeValue;       cpu_usage.innerHTML dom.getElementsByTagName("Processor_Usage")[0].firstChild.nodeValue;       drive_space.innerHTML dom.getElementsByTagName("Drive_Space")[0].firstChild.nodeValue;       net_read.innerHTML dom.getElementsByTagName("Network_Bytes_Read")[0].firstChild.nodeValue;       net_write.innerHTML dom.getElementsByTagName("Network_Bytes_Written")[0].firstChild.nodeValue;    }     function CoolMon(){                                       window.setInterval('UpdateReadings()',3000);        }                                                      </script>  <link href="cool.css" rel="stylesheet" type="text/css"> </head>  <body onLoad="CoolMon()"> <table width="325" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#CCCCCC">   <tr class="medium">      <td width="27%" height="21" bordercolor="#FFFFFF" bgcolor="#CCCCCC" class="medium">        <!-- Make it run when loading the page -->       <!-- Insert data from the script into page flow -->       Uptime: </td>     <td width="73%" bgcolor="#CCCCCC" class="medium2"><span id="cpu_load" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td height="21" class="medium">Threads: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="cpu_thread" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium"> Processes: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="cpu_proc" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">Page Total: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="cpu_pagetotal" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">Date/Time:</td>     <td bgcolor="#CCCCCC" class="medium2"><span id="cpu_date" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">CPU%: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="cpu_usage" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">Drive Space: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="drive_space" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">Net Read: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="net_read" style="position:relative; font-face: verdana;"></span></td>   </tr>   <tr class="medium">      <td class="medium">Net Write: </td>     <td bgcolor="#CCCCCC" class="medium2"><span id="net_write" style="position:relative; font-face: verdana;"></span></td>   </tr> </table>    <p>&nbsp;</p> <p align="center" class="xbig">PNS Web Server Stats</p> <p align="center"><span class="xbig">Semi Live Data (delayed 3 seconds)</span>     <!-- SPAN ID must be the same as .InnerHTML property created in UpdateReadings() --></p>  </body> 
xml code:

Code:
PHP Code:
  <?xml version="1.0" encoding="UTF-8" ?>  - <CoolMon> - <Raw>   <Uptime>4 days, 04 hrs, 15 mins, 34 secs</Uptime>    <System_Thread_Count>355</System_Thread_Count>    <System_Processes_Count>33</System_Processes_Count>    <PageTotal>617</PageTotal>    <PageUsed>149</PageUsed>    <PageFree>467</PageFree>    <RAMTotal>254</RAMTotal>    <RAMUsed>171</RAMUsed>    <RAMFree>84</RAMFree>    <Processor_Usage>00.00</Processor_Usage>    <Network_Read_Stats>00.59</Network_Read_Stats>    <Network_Write_Stats>00.00</Network_Write_Stats>    <Network_Bytes_Read>440,403.69</Network_Bytes_Read>    <Network_Bytes_Written>106,498.16</Network_Bytes_Written>    <IP_Addresses>10.37.123.12</IP_Addresses>    <Computer_Name>PNS</Computer_Name>    <User_Name>jds7472</User_Name>    <Date_and_Time>Date 27/08/02 Time 12:43</Date_and_Time>    <Blank />    <Drive_Space>31,564</Drive_Space>    <Processor_Type>i686</Processor_Type>    <File_Line_Data />    </Raw> - <Formatted>   <Item_0>Proc %25: 00.00</Item_0>    <Item_1>Processes: 33 Threads: 355</Item_1>    <Item_2>4 days, 04 hrs, 15 mins, 34 secs</Item_2>    <Item_3>PageUsed: 149/PageTotal: 617</Item_3>    <Item_4>RAMUsed: 171/RAMTotal: 254</Item_4>    <Item_5>Date 27/08/02 Time 12:43</Item_5>    <Item_6>10.37.123.12</Item_6>    <Item_7>PNS</Item_7>    <Item_8>Threads: 355</Item_8>    <Item_9>RAMTotal: 254</Item_9>    <Item_10>RAMUsed: 171</Item_10>    <Item_11>RAMFree: 84</Item_11>    <Item_12>KB Read: 00.59</Item_12>    <Item_13>KB Write: 00.00</Item_13>    <Item_14>Date 27/08/02 Time 12:43</Item_14>    <Item_15>Drive C: 31,564</Item_15>    </Formatted>   </CoolMon>
cobra is offline   Reply With Quote
Old 08-29-2002, 07:38 AM   #10
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Hmm, I didn't know that JavaScript can parse XML, nice idea
aym is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:22 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2