Ejemplo n.º 1
0
    http_send_data($content);
    exit;
}
ob_start();
html_start();
if (isset($_GET["tz"])) {
    $tz = $_GET["tz"];
} else {
    $tz = "EEST";
}
printf('<h2><a href="%s">%s</a></h2>' . "\n", $CONFIG['weburl'] . 'host?h=' . htmlentities($host) . '&tz=' . $tz, $host);
$term = array('2 hours' => 3600 * 2, '8 hours' => 3600 * 8, 'day' => 86400, 'week' => 86400 * 7, 'month' => 86400 * 31, 'quarter' => 86400 * 31 * 3, 'year' => 86400 * 365);
$args = $_GET;
print "<ul>\n";
foreach ($term as $key => $s) {
    $args['s'] = $s;
    printf('<li><a href="%s%s">%s</a></li>' . "\n", $CONFIG['weburl'], build_url('detail', $args), $key);
}
print "</ul>\n";
$plugins = collectd_plugins($host);
if (!$plugins) {
    echo "Unknown host\n";
    return false;
}
# show graph
printf('<img src="%s%s">' . "\n", $CONFIG['weburl'], build_url('graph', $_GET));
html_end();
$content = ob_get_clean();
http_cache_etag();
http_send_data($content);
$redis->setex($rediskey, 300, $content);
Ejemplo n.º 2
0
require_once 'conf/common.inc.php';
require_once 'inc/html.inc.php';
require_once 'inc/collectd.inc.php';
header("Content-Type: text/html");
$host = GET('h');
$plugin = GET('p');
$selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin);
html_start();
printf("<fieldset id=\"%s\">", htmlentities($host));
printf("<legend>%s</legend>", htmlentities($host));
echo <<<EOT
<input type="checkbox" id="navicon" class="navicon" />
<label for="navicon"></label>

EOT;
if (!strlen($host) || !($plugins = collectd_plugins($host))) {
    echo "Unknown host\n";
    return false;
}
plugins_list($host, $selected_plugins);
echo '<div class="graphs">';
foreach ($selected_plugins as $selected_plugin) {
    if (in_array($selected_plugin, $plugins)) {
        plugin_header($host, $selected_plugin);
        graphs_from_plugin($host, $selected_plugin, empty($plugin));
    }
}
echo '</div>';
printf("</fieldset>");
html_end();
Ejemplo n.º 3
0
function plugins_list($host, $selected_plugins = array())
{
    global $CONFIG;
    $plugins = collectd_plugins($host);
    echo '<div class="plugins">';
    echo '<h2>Plugins</h2>';
    echo '<ul>';
    printf("<li><a %shref=\"%shost.php?h=%s\">overview</a></li>\n", selected_overview($selected_plugins), htmlentities($CONFIG['weburl']), urlencode($host));
    # first the ones defined as ordered
    foreach ($CONFIG['overview'] as $plugin) {
        if (in_array($plugin, $plugins)) {
            printf("<li><a %shref=\"%shost.php?h=%s&amp;p=%s\">%s</a></li>\n", selected_plugin($plugin, $selected_plugins), htmlentities($CONFIG['weburl']), urlencode($host), urlencode($plugin), htmlentities($plugin));
        }
    }
    # other plugins
    foreach ($plugins as $plugin) {
        if (!in_array($plugin, $CONFIG['overview'])) {
            printf("<li><a %shref=\"%shost.php?h=%s&amp;p=%s\">%s</a></li>\n", selected_plugin($plugin, $selected_plugins), htmlentities($CONFIG['weburl']), urlencode($host), urlencode($plugin), htmlentities($plugin));
        }
    }
    echo '</ul>';
    echo '</div>';
}
Ejemplo n.º 4
0
$plugin = GET('p');
$pinstance = GET('pi');
$category = GET('c');
$type = GET('t');
$tinstance = GET('ti');
$seconds = GET('s');
$selected_plugins = !$plugin ? $CONFIG['overview'] : array($plugin);
html_start();
printf('<fieldset id="%s">', htmlentities($host));
printf('<legend>%s</legend>', htmlentities($host));
echo <<<EOT
<input type="checkbox" id="navicon" class="navicon" />
<label for="navicon"></label>

EOT;
if (!($plugins = collectd_plugins($host))) {
    echo "Unknown host\n";
    return false;
}
plugins_list($host, $selected_plugins);
echo '<div class="graphs">';
plugin_header($host, $plugin);
$args = GET();
print '<ul class="time-range">' . "\n";
foreach ($CONFIG['term'] as $key => $s) {
    $args['s'] = $s;
    $selected = selected_timerange($seconds, $s);
    printf('<li><a %s href="%s%s">%s</a></li>' . "\n", $selected, htmlentities($CONFIG['weburl']), htmlentities(build_url('detail.php', $args)), htmlentities($key));
}
print "</ul>\n";
if ($CONFIG['graph_type'] == 'canvas') {