Exemplo n.º 1
0
function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array())
{
    global $config;
    $sources = array();
    $title = "{$host}/{$plugin}" . (!is_null($plugin_instance) ? "-{$plugin_instance}" : '') . "/{$type}";
    if (!isset($opts['title'])) {
        $opts['title'] = $title;
    }
    $opts['rrd_opts'] = array('-v', 'Events');
    $files = array();
    /*	$opts['colors'] = array(
    		'ham'     => '00e000',
    		'spam'    => '0000ff',
    		'malware' => '990000',
    
    		'sent'     => '00e000',
    		'deferred' => 'a0e000',
    		'reject'   => 'ff0000',
    		'bounced'  => 'a00050'
    	);
    
    	$type_instances = array('ham', 'spam', 'malware',  'sent', 'deferred', 'reject', 'bounced'); */
    foreach ($type_instances as $inst) {
        $file = '';
        foreach ($config['datadirs'] as $datadir) {
            if (is_file($datadir . '/' . $title . '-' . $inst . '.rrd')) {
                $file = $datadir . '/' . $title . '-' . $inst . '.rrd';
                break;
            }
        }
        if ($file == '') {
            continue;
        }
        $sources[] = array('name' => $inst, 'file' => $file);
    }
    //	return collectd_draw_meta_stack($opts, $sources);
    return collectd_draw_meta_line($opts, $sources);
}
Exemplo n.º 2
0
function meta_graph_vs_memory($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array())
{
    global $config;
    $sources = array();
    $title = "{$host}/{$plugin}" . (!is_null($plugin_instance) ? "-{$plugin_instance}" : '') . "/{$type}";
    if (!isset($opts['title'])) {
        $opts['title'] = $title;
    }
    $opts['number_format'] = '%5.1lf%s';
    $opts['rrd_opts'] = array('-b', '1024', '-v', 'Bytes');
    $opts['colors'] = array('vm' => 'F0A000', 'vml' => 'FF0000', 'rss' => '00E000', 'anon' => '0000FF');
    $type_instances = array('anon', 'rss', 'vml', 'vm');
    while (list($k, $inst) = each($type_instances)) {
        $file = '';
        foreach ($config['datadirs'] as $datadir) {
            if (is_file($datadir . '/' . $title . '-' . $inst . '.rrd')) {
                $file = $datadir . '/' . $title . '-' . $inst . '.rrd';
                break;
            }
        }
        if ($file == '') {
            continue;
        }
        $sources[] = array('name' => $inst, 'file' => $file);
    }
    return collectd_draw_meta_line($opts, $sources);
}