X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fcollection.cgi;h=d364633e6ebe5036df9420a786f214e8933e7d98;hb=204cf4f8f68cadeac474a75584f27b7339aca4c4;hp=6990fb394516526b856213cdf77c216f40ad2257;hpb=4b2f7aa2d0d5accc01b1567834601a02e39c81ab;p=collectd.git diff --git a/contrib/collection.cgi b/contrib/collection.cgi index 6990fb39..d364633e 100755 --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@ -1,4 +1,25 @@ #!/usr/bin/perl +# Copyright (c) 2006-2010 Florian Forster +# Copyright (c) 2006-2008 Sebastian Harl +# Copyright (c) 2008 Mirko Buffoni +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. use strict; use warnings; @@ -13,6 +34,7 @@ use Data::Dumper (); our $Config = "/etc/collection.conf"; our @DataDirs = (); +our @DontShowTypes = (); our $LibDir; our $ValidTimespan = @@ -78,6 +100,10 @@ sub read_config $value =~ s#/*$##; $LibDir = $value; } + elsif ($key eq 'dontshowtype') + { + push (@DontShowTypes, $value); + } else { print STDERR "Unknown key: $key\n"; @@ -239,6 +265,7 @@ sub _find_types my $name = "$_"; $name =~ s/\.rrd$//i; my ($type, $instance) = split (m/-/, $name, 2); + if (grep { $_ eq $type } @DontShowTypes) { next; } $types{$type} = [] if (!$types{$type}); push (@{$types{$type}}, $instance) if (defined ($instance)); } @@ -970,6 +997,28 @@ sub load_graph_definitions 'GPRINT:avg:LAST:%5.1lf%s Last', 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l' ], + apache_connections => ['DEF:min={file}:count:MIN', + 'DEF:avg={file}:count:AVERAGE', + 'DEF:max={file}:count:MAX', + "AREA:max#$HalfBlue", + "AREA:min#$Canvas", + "LINE1:avg#$FullBlue:Connections", + 'GPRINT:min:MIN:%6.2lf Min,', + 'GPRINT:avg:AVERAGE:%6.2lf Avg,', + 'GPRINT:max:MAX:%6.2lf Max,', + 'GPRINT:avg:LAST:%6.2lf Last' + ], + apache_idle_workers => ['DEF:min={file}:count:MIN', + 'DEF:avg={file}:count:AVERAGE', + 'DEF:max={file}:count:MAX', + "AREA:max#$HalfBlue", + "AREA:min#$Canvas", + "LINE1:avg#$FullBlue:Idle Workers", + 'GPRINT:min:MIN:%6.2lf Min,', + 'GPRINT:avg:AVERAGE:%6.2lf Avg,', + 'GPRINT:max:MAX:%6.2lf Max,', + 'GPRINT:avg:LAST:%6.2lf Last' + ], apache_requests => ['DEF:min={file}:count:MIN', 'DEF:avg={file}:count:AVERAGE', 'DEF:max={file}:count:MAX', @@ -1290,9 +1339,9 @@ sub load_graph_definitions 'GPRINT:avg:LAST:%4.1lf Last\l' ], spam_check => [ - 'DEF:avg={file}:hits:AVERAGE', - 'DEF:min={file}:hits:MIN', - 'DEF:max={file}:hits:MAX', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', "AREA:max#$HalfMagenta", "AREA:min#$Canvas", "LINE1:avg#$FullMagenta:Count ", @@ -1301,6 +1350,18 @@ sub load_graph_definitions 'GPRINT:max:MAX:%4.1lf Max,', 'GPRINT:avg:LAST:%4.1lf Last\l' ], + conntrack => ['-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' + ], entropy => ['-v', 'Bits', 'DEF:avg={file}:entropy:AVERAGE', 'DEF:min={file}:entropy:MIN', @@ -2048,6 +2109,76 @@ sub load_graph_definitions 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,', 'GPRINT:ping_max:MAX:%4.1lf ms Max,', 'GPRINT:ping_avg:LAST:%4.1lf ms Last'], + pg_blks => ['DEF:pg_blks_avg={file}:value:AVERAGE', + 'DEF:pg_blks_min={file}:value:MIN', + 'DEF:pg_blks_max={file}:value:MAX', + "AREA:pg_blks_max#$HalfBlue", + "AREA:pg_blks_min#$Canvas", + "LINE1:pg_blks_avg#$FullBlue:Blocks", + 'GPRINT:pg_blks_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_blks_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_blks_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_blks_avg:LAST:%4.1lf%s Last'], + pg_db_size => ['DEF:pg_db_size_avg={file}:value:AVERAGE', + 'DEF:pg_db_size_min={file}:value:MIN', + 'DEF:pg_db_size_max={file}:value:MAX', + "AREA:pg_db_size_max#$HalfBlue", + "AREA:pg_db_size_min#$Canvas", + "LINE1:pg_db_size_avg#$FullBlue:Bytes", + 'GPRINT:pg_db_size_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_db_size_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_db_size_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_db_size_avg:LAST:%4.1lf%s Last'], + pg_n_tup_c => ['DEF:pg_n_tup_avg={file}:value:AVERAGE', + 'DEF:pg_n_tup_min={file}:value:MIN', + 'DEF:pg_n_tup_max={file}:value:MAX', + "AREA:pg_n_tup_max#$HalfBlue", + "AREA:pg_n_tup_min#$Canvas", + "LINE1:pg_n_tup_avg#$FullBlue:Tuples", + 'GPRINT:pg_n_tup_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_n_tup_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_n_tup_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_n_tup_avg:LAST:%4.1lf%s Last'], + pg_n_tup_g => ['DEF:pg_n_tup_avg={file}:value:AVERAGE', + 'DEF:pg_n_tup_min={file}:value:MIN', + 'DEF:pg_n_tup_max={file}:value:MAX', + "AREA:pg_n_tup_max#$HalfBlue", + "AREA:pg_n_tup_min#$Canvas", + "LINE1:pg_n_tup_avg#$FullBlue:Tuples", + 'GPRINT:pg_n_tup_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_n_tup_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_n_tup_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_n_tup_avg:LAST:%4.1lf%s Last'], + pg_numbackends => ['DEF:pg_numbackends_avg={file}:value:AVERAGE', + 'DEF:pg_numbackends_min={file}:value:MIN', + 'DEF:pg_numbackends_max={file}:value:MAX', + "AREA:pg_numbackends_max#$HalfBlue", + "AREA:pg_numbackends_min#$Canvas", + "LINE1:pg_numbackends_avg#$FullBlue:Backends", + 'GPRINT:pg_numbackends_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_numbackends_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_numbackends_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_numbackends_avg:LAST:%4.1lf%s Last'], + pg_scan => ['DEF:pg_scan_avg={file}:value:AVERAGE', + 'DEF:pg_scan_min={file}:value:MIN', + 'DEF:pg_scan_max={file}:value:MAX', + "AREA:pg_scan_max#$HalfBlue", + "AREA:pg_scan_min#$Canvas", + "LINE1:pg_scan_avg#$FullBlue:Scans", + 'GPRINT:pg_scan_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_scan_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_scan_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_scan_avg:LAST:%4.1lf%s Last'], + pg_xact => ['DEF:pg_xact_avg={file}:value:AVERAGE', + 'DEF:pg_xact_min={file}:value:MIN', + 'DEF:pg_xact_max={file}:value:MAX', + "AREA:pg_xact_max#$HalfBlue", + "AREA:pg_xact_min#$Canvas", + "LINE1:pg_xact_avg#$FullBlue:Transactions", + 'GPRINT:pg_xact_min:MIN:%4.1lf%s Min,', + 'GPRINT:pg_xact_avg:AVERAGE:%4.1lf%s Avg,', + 'GPRINT:pg_xact_max:MAX:%4.1lf%s Max,', + 'GPRINT:pg_xact_avg:LAST:%4.1lf%s Last'], power => ['-v', 'Watt', 'DEF:avg={file}:value:AVERAGE', 'DEF:min={file}:value:MIN', @@ -2542,6 +2673,20 @@ sub load_graph_definitions 'GPRINT:max:MAX:%4.1lf Max,', 'GPRINT:avg:LAST:%4.1lf Last\l' ], + virt_cpu_total => ['-v', 'Milliseconds', + 'DEF:avg_raw={file}:ns:AVERAGE', + 'DEF:min_raw={file}:ns:MIN', + 'DEF:max_raw={file}:ns:MAX', + 'CDEF:avg=avg_raw,1000000,/', + 'CDEF:min=min_raw,1000000,/', + 'CDEF:max=max_raw,1000000,/', + "AREA:avg#$HalfBlue", + "LINE1:avg#$FullBlue:CPU time", + '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->{'if_multicast'} = $GraphDefs->{'ipt_packets'}; $GraphDefs->{'if_tx_errors'} = $GraphDefs->{'if_rx_errors'}; @@ -2549,6 +2694,7 @@ sub load_graph_definitions $GraphDefs->{'dns_rcode'} = $GraphDefs->{'dns_opcode'}; $GraphDefs->{'vmpage_io-memory'} = $GraphDefs->{'vmpage_io'}; $GraphDefs->{'vmpage_io-swap'} = $GraphDefs->{'vmpage_io'}; + $GraphDefs->{'virt_cpu_total'} = $GraphDefs->{'virt_cpu_total'}; $MetaGraphDefs->{'cpu'} = \&meta_graph_cpu; $MetaGraphDefs->{'dns_qtype'} = \&meta_graph_dns;