Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html><head>
- <title>SimpleNode Network Monitor</title>
- <meta charset="UTF-8">
- <meta name="description" content="" />
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
- <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
- <script type="text/javascript" src="js/prettify.js"></script> <!-- PRETTIFY -->
- <script type="text/javascript" src="js/kickstart.js"></script> <!-- KICKSTART -->
- <link rel="stylesheet" type="text/css" href="css/kickstart.css" media="all" /> <!-- KICKSTART -->
- <link rel="stylesheet" type="text/css" href="style.css" media="all" /> <!-- CUSTOM STYLES -->
- </head><body><a id="top-of-page"></a><div id="wrap" class="clearfix">
- <!-- ===================================== END HEADER ===================================== -->
- <?php
- //Node 1 (Argon)
- //$node1xml = file_get_contents("https://argon.node.simpleno.de/phpsysinfo/xml.php");
- $node1xml = file_get_contents("xmlcache/node1.xml");
- $node1 = new SimpleXMLElement($node1xml);
- //Node 2 (Beryllium)
- //$node2xml = file_get_contents("http://beryllium.node.simpleno.de/phpsysinfo/xml.php");
- $node2xml = file_get_contents("xmlcache/node2.xml");
- $node2 = new SimpleXMLElement($node2xml);
- //Gets Uptime from all nodes
- //Node 1 (Argon)
- //Extracts RAM amount from the XML
- $node1uptime = $node1->Vitals['Uptime'];
- //Converts Array -> Floating Point
- $node1uptime = (float)$node1uptime;
- //Converts Seconds -> Days
- $node1up = $node1uptime/86400;
- //Node 1 (Argon)
- //Extracts RAM amount from the XML
- $node2uptime = $node2->Vitals['Uptime'];
- //Converts Array -> Floating Point
- $node2uptime = (float)$node2uptime;
- //Converts Seconds -> Days
- $node2up = $node2uptime/86400;
- //Get CPU Usage from all nodes
- //Node 1 (Argon)
- $node1cpuusage = $node1->Vitals['CPULoad'];
- //Converts Array -> Floating Point
- $node1cpu = (float)$node1cpuusage;
- //Node 1 (Argon)
- $node2cpuusage = $node2->Vitals['CPULoad'];
- //Converts Array -> Floating Point
- $node2cpu = (float)$node2cpuusage;
- //Gets RAM from all nodes
- //Node 1 (Argon)
- //Extracts RAM amount from the XML
- $node1mem = $node1->Memory->Details['App'];
- //Converts Array -> Floating Point
- $node1mem = (float)$node1mem;
- //Converts Bytes -> Gigabytes
- $node1ram = $node1mem/1073751824;
- //Node 2 (Beryllium)
- //Extracts RAM amount from the XML
- $node2mem = $node2->Memory->Details['App'];
- //Converts Array -> Floating Point
- $node2mem = (float)$node2mem;
- //Converts Bytes -> Gigabytes
- $node2ram = $node2mem/1073751824;
- //Adds RAM together
- $ramusage = $node1ram + $node2ram;
- //Rounds Number to 2 decimal places
- $ramusage = round($ramusage, 2);
- //Gets usage of /vz from all nodes
- //Node 1 (Argon)
- //Extracts HDD usage of /vz from XML
- $node1drive = $node1->FileSystem->Mount[3]['Used'];
- //Converts Array -> Floating Point
- $node1drive = (float)$node1drive;
- //Converts Bytes -> Gigabytes
- $node1hdd = $node1drive/1073751824;
- //Node 2 (Beryllium)
- //Extracts HDD usage of /vz from XML
- $node2drive = $node2->FileSystem->Mount[3]['Used'];
- //Converts Array -> Floating Point
- $node2drive = (float)$node2drive;
- //Converts Bytes -> Gigabytes
- $node2hdd = $node2drive/1073751824;
- //Adds Disk usage together
- $diskusage = $node1hdd + $node2hdd;
- //Rounds Number to 1 decimal place
- $diskusage = round($diskusage, 1);
- //Gets bandwidth usage since last restart from all nodes
- //Node 1 (Argon)
- //Gets B/W usage in and out
- $node1bwRX = $node1->Network->NetDevice[1]['RxBytes'];
- $node1bwTX = $node1->Network->NetDevice[1]['TxBytes'];
- //Converts Arrays -> Floating Points
- $node1bwRX = (float)$node1bwRX;
- $node1bwTX = (float)$node1bwTX;
- //Adds Tx and Rx together
- $node1bwtotal = $node1bwRX + $node1bwTX;
- //Converts Bytes -> Terabytes
- $node1bw = $node1bwtotal/1099521867780;
- //Node 2 (Beryllium)
- //Gets B/W usage in and out
- $node2bwRX = $node2->Network->NetDevice[1]['RxBytes'];
- $node2bwTX = $node2->Network->NetDevice[1]['TxBytes'];
- //Converts Arrays -> Floating Points
- $node2bwRX = (float)$node2bwRX;
- $node2bwTX = (float)$node2bwTX;
- //Adds Tx and Rx together
- $node2bwtotal = $node2bwRX + $node2bwTX;
- //Converts Bytes -> Terabytes
- $node2bw = $node2bwtotal/1099521867780;
- //Adds Bandwidth usage together
- $bandwidth = $node2bw + $node1bw;
- //Rounds to 2 decimal places
- $bandwidth = round($bandwidth, 2);
- ?>
- <div class="col_12">
- <h1 style="text-align:center;">SimpleNode Network Monitor</h1>
- <br/>
- <h4>Detailed Statistics</h4>
- <div>
- <table cellspacing="0" cellpadding="0" class="striped">
- <thead><tr>
- <th> </th>
- <th>Online</th>
- <th>RAM Usage</th>
- <th>CPU Usage</th>
- <th>Bandwidth Usage</th>
- <th>Hard Disk Usage</th>
- <th>Uptime</th>
- </tr></thead>
- <tbody><tr>
- <th>Node 1 (Argon)</th>
- <td><span class="icon green medium" data-icon="C"></span></td>
- <td><?php echo round($node1ram, 2)." GB"; ?></td>
- <td><?php echo round($node1cpu, 2)."%"; ?></td>
- <td><?php echo round($node1bw, 2)." TB"; ?></td>
- <td><?php echo round($node1hdd, 2)." GB"; ?></td>
- <td><?php echo round($node1up, 2)." Days"; ?></td>
- </tr><tr>
- <th>Node 2 (Beryllium)</th>
- <td><span class="icon green medium" data-icon="C"></span></td>
- <td><?php echo round($node2ram, 2)." GB"; ?></td>
- <td><?php echo round($node2cpu, 2)."%"; ?></td>
- <td><?php echo round($node2bw, 2)." TB"; ?></td>
- <td><?php echo round($node2hdd, 2)." GB"; ?></td>
- <td><?php echo round($node2up, 2)." Days"; ?></td>
- </tr></tbody>
- </table>
- </div>
- </div>
- <!-- ===================================== START FOOTER ===================================== -->
- </div>
- </div><!-- END WRAP -->
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement