Example #1
0
<?php

/*
 * Run this script to see if the basic configuration works and connection
 * to symux host work.
 */
require_once 'config/config.php';
require_once 'lib/Symon.php';
// create the symon object with the symux host information in the config
$symon = new Symon($config['SymuxAddress'], $config['SymuxPort']);
// determine the host to retrieve the stats for
if (is_array($config['SymonHost'])) {
    $host = $config['SymonHost'][0];
} else {
    $host = $config['SymonHost'];
}
// get the stats
$symon->get($host);
echo "<pre>Symon stats for host '{$host}'\n";
print_r($symon->parse());
echo "</pre>";
?>
If you see any info above, it worked.  :)
<br />
Otherwise, it did not work.  :(
Example #2
0
require_once "templates/proc.php";
require_once "templates/sensor.php";
require_once "templates/phpsymon_form.php";
/**********************************************************************
 * Determine the connection information (what symux host to connect to)
 * as well as what host stats to grab.
 *********************************************************************/
$address = getparam($_GET, 'address', $config['SymuxAddress']);
$port = getparam($_GET, 'port', $config['SymuxPort']);
$host = getparam($_GET, 'host', $config['SymonHost']);
$maxTries = getparam($_GET, 'maxTries', $config['MaxTries']);
$refresh = getparam($_GET, 'refresh', $config['AutoRefresh']);
/**********************************************************************
 * Retrieve symon stats
 *********************************************************************/
$symon = new Symon($address, $port);
$times['beforeGetSymon'] = microtime(true);
$symon->get($host, $maxTries);
$times['afterGetSymon'] = microtime(true);
/* construct a php assoc-array of the symon data (easier to parse) */
$symonData = $symon->parse();
/**********************************************************************
 * Start displaying the page.
 * Only the overall structure/layout of the page is listed below.
 * All of the details are in the template files under the templates/
 * sub-directory.
 *********************************************************************/
?>
<html>
<head>
   <title>phpSymon for <?php