Łatanie collection.modified.cgi

--- collection.modified.cgi.orig        2012-12-31 01:51:09.000000000 +0100
+++ collection.modified.cgi     2016-03-01 10:26:15.949841521 +0100
@@ -27,7 +27,7 @@ use URI::Escape    ('uri_escape');
 use RRDs           ();
 use Data::Dumper   ();
 use JSON ('to_json');
-our $Config   = "/etc/collectd/collection.conf";
+our $Config   = "/usr/local/etc/collectd-web.conf";
 our @DataDirs = ();
 our $LibDir;
 our $make_transparent = 1;
@@ -39,6 +39,9 @@ our $ValidTimespan    = {
     year  => 366 * 86400
 };

+# --- wy/l/aczenie logowania b/l/ed/ow w logacha serwera www. U/zywa/c z rozs/adkiem - s/lu/zy do poprawek
+#
+##$CGI::LIST_CONTEXT_WARN = 0;

 our @RRDDefaultArgs = (
 '--rigid', '-w', '500', '-h', '160', '--alt-autoscale-max', '--alt-y-grid',
@@ -191,7 +194,9 @@ sub _get_menu_buttons {
 sub _get_param_host {
     my %all_hosts = map { $_ => 1 } ( _find_hosts() );
     my @selected_hosts = ();
-    for ( param('host') ) {
+    my @loc_hosts = ();
+    push @loc_hosts, scalar param('host');
+    for ( @loc_hosts ) {
         if ( defined( $all_hosts{$_} ) ) {
             push( @selected_hosts, "$_" );
         }
@@ -619,7 +624,7 @@ sub action_show_plugin_json {
         $plugins_per_host->{ $hosts[$i] } = _find_files_for_host( $hosts[$i] );
         _files_union( $all_plugins, $plugins_per_host->{ $hosts[$i] } );
     }
-    for ( param('plugin') ) {
+    for ( scalar param('plugin') ) {
         if ( defined( $all_plugins->{$_} ) ) {
             $selected_plugins->{$_} = 1;
         }
@@ -1059,6 +1064,35 @@ sub load_graph_definitions {
             'GPRINT:max:MAX:%6.2lf Max,',
             'GPRINT:avg:LAST:%6.2lf Last'
         ],
+        io_octets => [
+        'DEF:out_min={file}:tx:MIN',
+        'DEF:out_avg={file}:tx:AVERAGE',
+        'DEF:out_max={file}:tx:MAX',
+        'DEF:inc_min={file}:rx:MIN',
+        'DEF:inc_avg={file}:rx:AVERAGE',
+        'DEF:inc_max={file}:rx:MAX',
+        'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
+        'CDEF:mytime=out_avg,TIME,TIME,IF',
+        'CDEF:sample_len_raw=mytime,PREV(mytime),-',
+        'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
+        'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
+        'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
+        'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
+        'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
+        "AREA:out_avg#$HalfGreen",
+        "AREA:inc_avg#$HalfBlue",
+        "AREA:overlap#$HalfBlueGreen",
+        "LINE1:out_avg#$FullGreen:Written",
+        'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
+        'GPRINT:out_max:MAX:%5.1lf%s Max,',
+        'GPRINT:out_avg:LAST:%5.1lf%s Last',
+        'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
+        "LINE1:inc_avg#$FullBlue:Read   ",
+        'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
+        'GPRINT:inc_max:MAX:%5.1lf%s Max,',
+        'GPRINT:inc_avg:LAST:%5.1lf%s Last',
+        'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
+        ],
         cache_result => [
             'DEF:min={file}:value:MIN',
             'DEF:avg={file}:value:AVERAGE',
@@ -1071,6 +1105,18 @@ sub load_graph_definitions {
             'GPRINT:max:MAX:%6.2lf Max,',
             'GPRINT:avg:LAST:%6.2lf Last'
         ],
+        cache_size => [
+        'DEF:min={file}:value:MIN',
+        'DEF:avg={file}:value:AVERAGE',
+        'DEF:max={file}:value:MAX',
+        "AREA:max#$HalfBlue",
+        "AREA:min#$Canvas",
+        "LINE1:avg#$FullBlue:ARC cache size (Bytes)",
+        'GPRINT:min:MIN:%6.2lf%s Min,',
+        'GPRINT:avg:AVERAGE:%6.2lf%s Avg,',
+        'GPRINT:max:MAX:%6.2lf%s Max,',
+        'GPRINT:avg:LAST:%6.2lf%s Last'
+        ],
         apache_scoreboard => [
             'DEF:min={file}:value:MIN',
             'DEF:avg={file}:value:AVERAGE',
@@ -3215,13 +3261,28 @@ sub load_graph_definitions {
             'GPRINT:avg:LAST:%6.2lf Last'
         ],
 # jaf-18aug11 END
-
-
+        bytes => ['-v', 'Bytes',
+        'DEF:avg={file}:value:AVERAGE',
+        'DEF:min={file}:value:MIN',
+        'DEF:max={file}:value:MAX',
+        "AREA:max#$HalfGreen",
+        "AREA:min#$Canvas",
+        "LINE1:avg#$FullGreen:Bytes",
+        'GPRINT:min:MIN:%4.1lf Min,',
+        'GPRINT:avg:AVERAGE:%4.1lf Avg,',
+        'GPRINT:max:MAX:%4.1lf Max,',
+        'GPRINT:avg:LAST:%4.1lf Last\l'
+        ],
     };
+    $GraphDefs->{'ps_code'}             = $GraphDefs->{'ps_state'};
+    $GraphDefs->{'ps_data'}             = $GraphDefs->{'ps_state'};
+    $GraphDefs->{'ps_stacksize'}        = $GraphDefs->{'ps_state'};
+    $GraphDefs->{'ps_vm'}               = $GraphDefs->{'ps_state'};
     $GraphDefs->{'if_multicast'}        = $GraphDefs->{'ipt_packets'};
     $GraphDefs->{'if_tx_errors'}        = $GraphDefs->{'if_rx_errors'};
     $GraphDefs->{'dns_qtype'}           = $GraphDefs->{'dns_opcode'};
     $GraphDefs->{'dns_rcode'}           = $GraphDefs->{'dns_opcode'};
+    $GraphDefs->{'full_join'}        = $GraphDefs->{'mysql_qcache'};
 # jaf-18aug11 additional Varnish graphs
     $GraphDefs->{'memcached_command'}       = $GraphDefs->{'total_operations'};
     $GraphDefs->{'memcached_connections'}   = $GraphDefs->{'apache_connections'};
@@ -3234,6 +3295,14 @@ sub load_graph_definitions {
 # jaf-18aug11 END
     $GraphDefs->{'vmpage_io-memory'}    = $GraphDefs->{'vmpage_io'};
     $GraphDefs->{'vmpage_io-swap'}      = $GraphDefs->{'vmpage_io'};
+    $GraphDefs->{'cache_ratio'}         = $GraphDefs->{'cache_result'};
+    $GraphDefs->{'cache_eviction'}      = $GraphDefs->{'cache_result'};
+    $GraphDefs->{'cache_operation'}     = $GraphDefs->{'cache_result'};
+    $GraphDefs->{'mutex_operations'}    = $GraphDefs->{'cache_result'};
+    $GraphDefs->{'hash_collisions'}     = $GraphDefs->{'cache_result'};
+    $GraphDefs->{'operations'} = $GraphDefs->{'derive'};
+    $GraphDefs->{'queue_length'} = $GraphDefs->{'gauge'};
+    $GraphDefs->{'total_values'} = $GraphDefs->{'gauge'};
     $MetaGraphDefs->{'cpu'}             = \&meta_graph_cpu;
     $MetaGraphDefs->{'df_complex'}      = \&meta_graph_df_complex;
     $MetaGraphDefs->{'dns_qtype'}       = \&meta_graph_dns;
@@ -3246,6 +3315,8 @@ sub load_graph_definitions {
     $MetaGraphDefs->{'swap'}            = \&meta_graph_swap;
     $MetaGraphDefs->{'mysql_commands'}  = \&meta_graph_mysql_commands;
     $MetaGraphDefs->{'mysql_handler'}   = \&meta_graph_mysql_commands;
+    $MetaGraphDefs->{'mysql_select'}    = \&meta_graph_mysql_commands;
+    $MetaGraphDefs->{'mysql_sort'}      = \&meta_graph_mysql_commands;
     $MetaGraphDefs->{'tcp_connections'} = \&meta_graph_tcp_connections;
     $MetaGraphDefs->{'vmpage_number'}   = \&meta_graph_vmpage_number;
     $MetaGraphDefs->{'vmpage_action'}   = \&meta_graph_vmpage_action;
@@ -3468,7 +3539,7 @@ sub meta_graph_dns

   @$type_instances = sort @$type_instances;

-  $opts->{'colors'} = _get_n_colors ($type_instances);
+  ###$opts->{'colors'} = _get_n_colors ($type_instances);

   for (@$type_instances)
   {


{i}  (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.