Merge branch 'collectd-5.8'
[collectd.git] / contrib / php-collection / definitions.php
index 16dd2e6..7297d85 100644 (file)
@@ -48,9 +48,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
        $GraphDefs = array();
        $GraphDefs['apache_bytes'] = array(
                '-v', 'Bits/s',
-               'DEF:min_raw={file}:count:MIN',
-               'DEF:avg_raw={file}:count:AVERAGE',
-               'DEF:max_raw={file}:count:MAX',
+               'DEF:min_raw={file}:value:MIN',
+               'DEF:avg_raw={file}:value:AVERAGE',
+               'DEF:max_raw={file}:value:MAX',
                'CDEF:min=min_raw,8,*',
                'CDEF:avg=avg_raw,8,*',
                'CDEF:max=max_raw,8,*',
@@ -68,9 +68,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
                'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
        $GraphDefs['apache_requests'] = array(
                '-v', 'Requests/s',
-               'DEF:min={file}:count:MIN',
-               'DEF:avg={file}:count:AVERAGE',
-               'DEF:max={file}:count:MAX',
+               'DEF:min={file}:value:MIN',
+               'DEF:avg={file}:value:AVERAGE',
+               'DEF:max={file}:value:MAX',
                "AREA:max#$HalfBlue",
                "AREA:min#$Canvas",
                "LINE1:avg#$FullBlue:Requests/s",
@@ -79,9 +79,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
                'GPRINT:max:MAX:%6.2lf Max,',
                'GPRINT:avg:LAST:%6.2lf Last');
        $GraphDefs['apache_scoreboard'] = array(
-               'DEF:min={file}:count:MIN',
-               'DEF:avg={file}:count:AVERAGE',
-               'DEF:max={file}:count:MAX',
+               'DEF:min={file}:value:MIN',
+               'DEF:avg={file}:value:AVERAGE',
+               'DEF:max={file}:value:MAX',
                "AREA:max#$HalfBlue",
                "AREA:min#$Canvas",
                "LINE1:avg#$FullBlue:Processes",
@@ -386,6 +386,18 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
                'GPRINT:avg:AVERAGE:%4.1lf Avg,',
                'GPRINT:max:MAX:%4.1lf Max,',
                'GPRINT:avg:LAST:%4.1lf Last\l');
+       $GraphDefs['conntrack'] = array(
+               '-v', 'Entries',
+               'DEF:avg={file}:entropy:AVERAGE',
+               'DEF:min={file}:entropy:MIN',
+               'DEF:max={file}:entropy:MAX',
+               "AREA:max#$HalfBlue",
+               "AREA:min#$Canvas",
+               "LINE1:avg#$FullBlue:Count",
+               'GPRINT:min:MIN:%4.0lf Min,',
+               'GPRINT:avg:AVERAGE:%4.0lf Avg,',
+               'GPRINT:max:MAX:%4.0lf Max,',
+               'GPRINT:avg:LAST:%4.0lf Last\l');
        $GraphDefs['entropy'] = array(
                '-v', 'Bits',
                'DEF:avg={file}:entropy:AVERAGE',
@@ -1575,6 +1587,20 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
        $MetaGraphDefs['apache_scoreboard'] = 'meta_graph_apache_scoreboard';
        $MetaGraphDefs['mysql_commands']    = 'meta_graph_mysql_commands';
        $MetaGraphDefs['mysql_handler']     = 'meta_graph_mysql_commands';
+       $MetaGraphDefs['tcp_connections']   = 'meta_graph_tcp_connections';
+       $MetaGraphDefs['dns_opcode']        = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_qtype']         = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_qtype_cached']  = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_rcode']         = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_request']       = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_resolver']      = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_update']        = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_zops']          = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_response']      = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_query']         = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_reject']        = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_notify']        = 'meta_graph_dns_event';
+       $MetaGraphDefs['dns_transfer']      = 'meta_graph_dns_event';
 
        if (function_exists('load_graph_definitions_local'))
                load_graph_definitions_local($logarithmic, $tinylegend);
@@ -1705,13 +1731,20 @@ function meta_graph_memory($host, $plugin, $plugin_instance, $type, $type_instan
 
        $files = array();
        $opts['colors'] = array(
+               // Linux - System memoery
                'free'     => '00e000',
                'cached'   => '0000ff',
                'buffered' => 'ffb000',
-               'used'     => 'ff0000'
+               'used'     => 'ff0000',
+               // Bind - Server memory
+               'TotalUse'    => '00e000',
+               'InUse'       => 'ff0000',
+               'BlockSize'   => '8888dd',
+               'ContextSize' => '444499',
+               'Lost'        => '222222'
        );
 
-       $type_instances = array('free', 'cached', 'buffered', 'used');
+       $type_instances = array('free', 'cached', 'buffered', 'used',   'TotalUse', 'InUse', 'BlockSize', 'ContextSize', 'Lost');
        while (list($k, $inst) = each($type_instances)) {
                $file = '';
                foreach ($config['datadirs'] as $datadir)
@@ -1725,7 +1758,10 @@ function meta_graph_memory($host, $plugin, $plugin_instance, $type, $type_instan
                $sources[] = array('name'=>$inst, 'file'=>$file);
        }
 
-       return collectd_draw_meta_stack($opts, $sources);
+       if ($plugin == 'bind')
+               return collectd_draw_meta_line($opts, $sources);
+       else
+               return collectd_draw_meta_stack($opts, $sources);
 }
 
 function meta_graph_vs_threads($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
@@ -1988,7 +2024,7 @@ function meta_graph_apache_scoreboard($host, $plugin, $plugin_instance, $type, $
                if ($file == '')
                        continue;
 
-               $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'count');
+               $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'value');
        }
 
        return collectd_draw_meta_stack($opts, $sources);
@@ -2030,10 +2066,40 @@ function meta_graph_tcp_connections($host, $plugin, $plugin_instance, $type, $ty
                if ($file == '')
                        continue;
 
-               $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'count');
+               $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'value');
        }
 
        return collectd_draw_meta_stack($opts, $sources);
 }
 
+function meta_graph_dns_event($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', '-r', '-l', '0');
+
+       $files = array();
+//     $opts['colors'] = array(
+//     );
+
+//     $type_instances = array('IQUERY', 'NOTIFY');
+       while (list($k, $inst) = each($type_instances)) {
+               $file  = '';
+               $title = $opts['title'];
+               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);
+}
+
 ?>