3cc24c32590f9226f21bbf6c5fd8c7130abcb0d6
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 use Carp (qw(cluck confess));
7 use CGI (':cgi');
8 use CGI::Carp ('fatalsToBrowser');
9 use HTML::Entities ('encode_entities');
10 use URI::Escape ('uri_escape');
11 use RRDs ();
12 use Data::Dumper ();
14 our $Config = "/etc/collection.conf";
15 our @DataDirs = ();
16 our $LibDir;
18 our $ValidTimespan =
19 {
20 hour => 3600,
21 day => 86400,
22 week => 7 * 86400,
23 month => 31 * 86400,
24 year => 366 * 86400
25 };
27 our @RRDDefaultArgs = ('-w', '400');
29 our $Args = {};
31 our $GraphDefs;
32 our $MetaGraphDefs = {};
33 load_graph_definitions ();
35 for (qw(action host plugin plugin_instance type type_instance timespan))
36 {
37 $Args->{$_} = param ($_);
38 }
40 exit (main ());
42 sub read_config
43 {
44 my $fh;
45 open ($fh, "< $Config") or confess ("open ($Config): $!");
46 while (my $line = <$fh>)
47 {
48 chomp ($line);
49 next if (!$line);
50 next if ($line =~ m/^\s*#/);
51 next if ($line =~ m/^\s*$/);
53 my $key;
54 my $value;
56 if ($line =~ m/^([A-Za-z]+):\s*"((?:[^"\\]+|\\.)*)"$/)
57 {
58 $key = lc ($1); $value = $2;
59 $value =~ s/\\(.)/$1/g;
60 }
61 elsif ($line =~ m/([A-Za-z]+):\s*([0-9]+)$/)
62 {
63 $key = lc ($1); $value = 0 + $2;
64 }
65 else
66 {
67 print STDERR "Cannot parse line: $line\n";
68 next;
69 }
71 if ($key eq 'datadir')
72 {
73 $value =~ s#/*$##;
74 push (@DataDirs, $value);
75 }
76 elsif ($key eq 'libdir')
77 {
78 $value =~ s#/*$##;
79 $LibDir = $value;
80 }
81 else
82 {
83 print STDERR "Unknown key: $key\n";
84 }
85 }
86 close ($fh);
87 } # read_config
89 sub validate_args
90 {
91 if ($Args->{'action'} && ($Args->{'action'} =~ m/^(overview|show_host|show_plugin|show_type|show_graph)$/))
92 {
93 $Args->{'action'} = $1;
94 }
95 else
96 {
97 $Args->{'action'} = 'overview';
98 }
100 if ($Args->{'host'} && ($Args->{'host'} =~ m#/#))
101 {
102 delete ($Args->{'host'});
103 }
105 if ($Args->{'plugin'} && ($Args->{'plugin'} =~ m#/#))
106 {
107 delete ($Args->{'plugin'});
108 }
110 if ($Args->{'type'} && ($Args->{'type'} =~ m#/#))
111 {
112 delete ($Args->{'type'});
113 }
115 if (!$Args->{'plugin'} || ($Args->{'plugin_instance'}
116 && ($Args->{'plugin_instance'} =~ m#/#)))
117 {
118 delete ($Args->{'plugin_instance'});
119 }
121 if (!$Args->{'type'} || ($Args->{'type_instance'}
122 && ($Args->{'type_instance'} =~ m#/#)))
123 {
124 delete ($Args->{'type_instance'});
125 }
127 if (defined ($Args->{'timespan'})
128 && ($Args->{'timespan'} =~ m/^(hour|day|week|month|year)$/))
129 {
130 $Args->{'timespan'} = $1;
131 }
132 else
133 {
134 $Args->{'timespan'} = 'day';
135 }
136 } # validate_args
138 {
139 my $hosts;
140 sub _find_hosts
141 {
142 if (defined ($hosts))
143 {
144 return (keys %$hosts);
145 }
147 $hosts = {};
149 for (my $i = 0; $i < @DataDirs; $i++)
150 {
151 my @tmp;
152 my $dh;
154 opendir ($dh, $DataDirs[$i]) or next;
155 @tmp = grep { ($_ !~ m/^\./) && (-d $DataDirs[$i] . '/' . $_) } (readdir ($dh));
156 closedir ($dh);
158 $hosts->{$_} = 1 for (@tmp);
159 } # for (@DataDirs)
161 return (keys %$hosts);
162 } # _find_hosts
163 }
165 sub _get_param_host
166 {
167 my %all_hosts = map { $_ => 1 } (_find_hosts ());
168 my @selected_hosts = ();
169 for (param ('host'))
170 {
171 if (defined ($all_hosts{$_}))
172 {
173 push (@selected_hosts, "$_");
174 }
175 }
176 return (@selected_hosts);
177 } # _get_param_host
179 sub _get_param_timespan
180 {
181 my $timespan = param ('timespan');
183 $timespan ||= 'day';
184 $timespan = lc ($timespan);
186 if (!defined ($ValidTimespan->{$timespan}))
187 {
188 $timespan = 'day';
189 }
191 return ($timespan);
192 } # _get_param_timespan
194 sub _find_plugins
195 {
196 my $host = shift;
197 my %plugins = ();
199 for (my $i = 0; $i < @DataDirs; $i++)
200 {
201 my $dir = $DataDirs[$i] . "/$host";
202 my @tmp;
203 my $dh;
205 opendir ($dh, $dir) or next;
206 @tmp = grep { ($_ !~ m/^\./) && (-d "$dir/$_") } (readdir ($dh));
207 closedir ($dh);
209 for (@tmp)
210 {
211 my ($plugin, $instance) = split (m/-/, $_, 2);
212 $plugins{$plugin} = [] if (!exists $plugins{$plugin});
213 push (@{$plugins{$plugin}}, $instance);
214 }
215 } # for (@DataDirs)
217 return (%plugins);
218 } # _find_plugins
220 sub _find_types
221 {
222 my $host = shift;
223 my $plugin = shift;
224 my $plugin_instance = shift;
225 my %types = ();
227 for (my $i = 0; $i < @DataDirs; $i++)
228 {
229 my $dir = $DataDirs[$i] . "/$host/$plugin" . (defined ($plugin_instance) ? "-$plugin_instance" : '');
230 my @tmp;
231 my $dh;
233 opendir ($dh, $dir) or next;
234 @tmp = grep { ($_ !~ m/^\./) && ($_ =~ m/\.rrd$/i) && (-f "$dir/$_") } (readdir ($dh));
235 closedir ($dh);
237 for (@tmp)
238 {
239 my $name = "$_";
240 $name =~ s/\.rrd$//i;
241 my ($type, $instance) = split (m/-/, $name, 2);
242 $types{$type} = [] if (!$types{$type});
243 push (@{$types{$type}}, $instance) if (defined ($instance));
244 }
245 } # for (@DataDirs)
247 return (%types);
248 } # _find_types
250 sub _find_files_for_host
251 {
252 my $host = shift;
253 my $ret = {};
255 my %plugins = _find_plugins ($host);
256 for (keys %plugins)
257 {
258 my $plugin = $_;
259 my $plugin_instances = $plugins{$plugin};
261 if (!$plugin_instances || !@$plugin_instances)
262 {
263 $plugin_instances = ['-'];
264 }
266 $ret->{$plugin} = {};
268 for (@$plugin_instances)
269 {
270 my $plugin_instance = defined ($_) ? $_ : '-';
271 my %types = _find_types ($host, $plugin,
272 ($plugin_instance ne '-')
273 ? $plugin_instance
274 : undef);
276 $ret->{$plugin}{$plugin_instance} = {};
278 for (keys %types)
279 {
280 my $type = $_;
281 my $type_instances = $types{$type};
283 $ret->{$plugin}{$plugin_instance}{$type} = {};
285 for (@$type_instances)
286 {
287 $ret->{$plugin}{$plugin_instance}{$type}{$_} = 1;
288 }
290 if (!@$type_instances)
291 {
292 $ret->{$plugin}{$plugin_instance}{$type}{'-'} = 1;
293 }
294 } # for (keys %types)
295 } # for (@$plugin_instances)
296 } # for (keys %plugins)
298 return ($ret);
299 } # _find_files_for_host
301 sub _find_files_for_hosts
302 {
303 my @hosts = @_;
304 my $all_plugins = {};
306 for (my $i = 0; $i < @hosts; $i++)
307 {
308 my $tmp = _find_files_for_host ($hosts[$i]);
309 _files_union ($all_plugins, $tmp);
310 }
312 return ($all_plugins);
313 } # _find_files_for_hosts
315 sub _files_union
316 {
317 my $dest = shift;
318 my $src = shift;
320 for (keys %$src)
321 {
322 my $plugin = $_;
323 $dest->{$plugin} ||= {};
325 for (keys %{$src->{$plugin}})
326 {
327 my $pinst = $_;
328 $dest->{$plugin}{$pinst} ||= {};
330 for (keys %{$src->{$plugin}{$pinst}})
331 {
332 my $type = $_;
333 $dest->{$plugin}{$pinst}{$type} ||= {};
335 for (keys %{$src->{$plugin}{$pinst}{$type}})
336 {
337 my $tinst = $_;
338 $dest->{$plugin}{$pinst}{$type}{$tinst} = 1;
339 }
340 }
341 }
342 }
343 } # _files_union
345 sub _files_plugin_inst_count
346 {
347 my $src = shift;
348 my $i = 0;
350 for (keys %$src)
351 {
352 if (exists ($MetaGraphDefs->{$_}))
353 {
354 $i++;
355 }
356 else
357 {
358 $i = $i + keys %{$src->{$_}};
359 }
360 }
361 return ($i);
362 } # _files_plugin_count
364 sub list_hosts
365 {
366 my @hosts = _find_hosts ();
367 @hosts = sort (@hosts);
369 print "<ul>\n";
370 for (my $i = 0; $i < @hosts; $i++)
371 {
372 my $host_html = encode_entities ($hosts[$i]);
373 my $host_url = uri_escape ($hosts[$i]);
375 print qq( <li><a href="${\script_name ()}?action=show_host;host=$host_url">$host_html</a></li>\n);
376 }
377 print "</ul>\n";
378 } # list_hosts
380 sub _string_to_color
381 {
382 my $color = shift;
383 if ($color =~ m/([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])/)
384 {
385 return ([hex ($1) / 255.0, hex ($2) / 255.0, hex ($3) / 255.0]);
386 }
387 return;
388 } # _string_to_color
390 sub _color_to_string
391 {
392 confess ("Wrong number of arguments") if (@_ != 1);
393 return (sprintf ('%02hx%02hx%02hx', map { int (255.0 * $_) } @{$_[0]}));
394 } # _color_to_string
396 sub _get_random_color
397 {
398 my ($r, $g, $b) = (rand (), rand ());
399 my $min = 0.0;
400 my $max = 1.0;
402 if (($r + $g) < 1.0)
403 {
404 $min = 1.0 - ($r + $g);
405 }
406 else
407 {
408 $max = 2.0 - ($r + $g);
409 }
411 $b = $min + (rand () * ($max - $min));
413 return ([$r, $g, $b]);
414 } # _get_random_color
416 sub _get_n_colors
417 {
418 my $instances = shift;
419 my $num = scalar @$instances;
420 my $ret = {};
422 for (my $i = 0; $i < $num; $i++)
423 {
424 my $pos = 6 * $i / $num;
425 my $n = int ($pos);
426 my $p = $pos - $n;
427 my $q = 1 - $p;
429 my $red = 0;
430 my $green = 0;
431 my $blue = 0;
433 my $color;
435 if ($n == 0)
436 {
437 $red = 255;
438 $blue = 255 * $p;
439 }
440 elsif ($n == 1)
441 {
442 $red = 255 * $q;
443 $blue = 255;
444 }
445 elsif ($n == 2)
446 {
447 $green = 255 * $p;
448 $blue = 255;
449 }
450 elsif ($n == 3)
451 {
452 $green = 255;
453 $blue = 255 * $q;
454 }
455 elsif ($n == 4)
456 {
457 $red = 255 * $p;
458 $green = 255;
459 }
460 elsif ($n == 5)
461 {
462 $red = 255;
463 $green = 255 * $q;
464 }
465 else { die; }
467 $color = sprintf ("%02x%02x%02x", $red, $green, $blue);
468 $ret->{$instances->[$i]} = $color;
469 }
471 return ($ret);
472 } # _get_n_colors
474 sub _get_faded_color
475 {
476 my $fg = shift;
477 my $bg;
478 my %opts = @_;
479 my $ret = [undef, undef, undef];
481 $opts{'background'} ||= [1.0, 1.0, 1.0];
482 $opts{'alpha'} ||= 0.25;
484 if (!ref ($opts{'background'}))
485 {
486 $opts{'background'} = _string_to_color ($opts{'background'})
487 or confess ("Cannot parse background color " . $opts{'background'});
488 }
489 $bg = $opts{'background'};
491 for (my $i = 0; $i < 3; $i++)
492 {
493 $ret->[$i] = ($opts{'alpha'} * $fg->[$i])
494 + ((1.0 - $opts{'alpha'}) * $bg->[$i]);
495 }
497 return ($ret);
498 } # _get_faded_color
500 sub _custom_sort_arrayref
501 {
502 my $array_ref = shift;
503 my $array_sort = shift;
505 my %elements = map { $_ => 1 } (@$array_ref);
506 splice (@$array_ref, 0);
508 for (@$array_sort)
509 {
510 next if (!exists ($elements{$_}));
511 push (@$array_ref, $_);
512 delete ($elements{$_});
513 }
514 push (@$array_ref, sort (keys %elements));
515 } # _custom_sort_arrayref
517 sub action_show_host
518 {
519 my @hosts = _get_param_host ();
520 @hosts = sort (@hosts);
522 my $timespan = _get_param_timespan ();
523 my $all_plugins = _find_files_for_hosts (@hosts);
525 my $url_prefix = script_name () . '?action=show_plugin'
526 . join ('', map { ';host=' . uri_escape ($_) } (@hosts))
527 . ';timespan=' . uri_escape ($timespan);
529 print qq( <div><a href="${\script_name ()}?action=overview">Back to list of hosts</a></div>\n);
531 print " <p>Available plugins:</p>\n"
532 . " <ul>\n";
533 for (sort (keys %$all_plugins))
534 {
535 my $plugin = $_;
536 my $plugin_html = encode_entities ($plugin);
537 my $url_plugin = $url_prefix . ';plugin=' . uri_escape ($plugin);
538 print qq( <li><a href="$url_plugin">$plugin_html</a></li>\n);
539 }
540 print " </ul>\n";
541 } # action_show_host
543 sub action_show_plugin
544 {
545 my @hosts = _get_param_host ();
546 my $plugin = shift;
547 my $plugin_instance = shift;
548 my $timespan = _get_param_timespan ();
550 my $hosts_url = join (';', map { 'host=' . uri_escape ($_) } (@hosts));
551 my $url_prefix = script_name () . "?$hosts_url";
553 my $all_plugins = {};
554 my $plugins_per_host = {};
555 my $selected_plugins = {};
557 for (my $i = 0; $i < @hosts; $i++)
558 {
559 $plugins_per_host->{$hosts[$i]} = _find_files_for_host ($hosts[$i]);
560 _files_union ($all_plugins, $plugins_per_host->{$hosts[$i]});
561 }
563 for (param ('plugin'))
564 {
565 if (defined ($all_plugins->{$_}))
566 {
567 $selected_plugins->{$_} = 1;
568 }
569 }
571 print qq( <div><a href="${\script_name ()}?action=show_host;$hosts_url">Back to list of plugins</a></div>\n);
573 # Print table header
574 print <<HTML;
575 <table class="graphs">
576 <tr>
577 <th>Plugins</th>
578 HTML
579 for (@hosts)
580 {
581 print "\t<th>", encode_entities ($_), "</th>\n";
582 }
583 print " </tr>\n";
585 for (sort (keys %$selected_plugins))
586 {
587 my $plugin = $_;
588 my $plugin_html = encode_entities ($plugin);
589 my $plugin_url = "$url_prefix;plugin=" . uri_escape ($plugin);
590 my $all_pinst = $all_plugins->{$plugin};
592 for (sort (keys %$all_pinst))
593 {
594 my $pinst = $_;
595 my $pinst_html = '';
596 my $pinst_url = $plugin_url;
598 if ($pinst ne '-')
599 {
600 $pinst_html = encode_entities ($pinst);
601 $pinst_url .= ';plugin_instance=' . uri_escape ($pinst);
602 }
604 my $files_printed = 0;
605 my $files_num = _files_plugin_inst_count ($all_pinst->{$pinst});
606 if ($files_num < 1)
607 {
608 next;
609 }
610 my $rowspan = ($files_num == 1) ? '' : qq( rowspan="$files_num");
612 for (sort (keys %{$all_plugins->{$plugin}{$pinst}}))
613 {
614 my $type = $_;
615 my $type_html = encode_entities ($type);
616 my $type_url = "$pinst_url;type=" . uri_escape ($type);
618 if ($files_printed == 0)
619 {
620 my $title = $plugin_html;
621 if ($pinst ne '-')
622 {
623 $title .= " ($pinst_html)";
624 }
625 print " <tr>\n";
626 print "\t<td$rowspan>$title</td>\n";
627 }
629 if (exists ($MetaGraphDefs->{$type}))
630 {
631 my $graph_url = script_name () . '?action=show_graph'
632 . ';plugin=' . uri_escape ($plugin)
633 . ';type=' . uri_escape ($type)
634 . ';timespan=' . uri_escape ($timespan);
635 if ($pinst ne '-')
636 {
637 $graph_url .= ';plugin_instance=' . uri_escape ($pinst);
638 }
640 if ($files_printed != 0)
641 {
642 print " <tr>\n";
643 }
645 for (@hosts)
646 {
647 my $host = $_;
648 my $host_graph_url = $graph_url . ';host=' . uri_escape ($host);
650 print "\t<td>";
651 if (exists $plugins_per_host->{$host}{$plugin}{$pinst}{$type})
652 {
653 print qq(<img src="$host_graph_url" />);
654 #print encode_entities (qq(<img src="${\script_name ()}?action=show_graph;host=$host_esc;$param_plugin;$param_type;timespan=$timespan" />));
655 }
656 print "</td>\n";
657 } # for (my $k = 0; $k < @hosts; $k++)
659 print " </tr>\n";
661 $files_printed++;
662 next; # pinst
663 } # if (exists ($MetaGraphDefs->{$type}))
665 for (sort (keys %{$all_plugins->{$plugin}{$pinst}{$type}}))
666 {
667 my $tinst = $_;
668 my $tinst_esc = encode_entities ($tinst);
669 my $graph_url = script_name () . '?action=show_graph'
670 . ';plugin=' . uri_escape ($plugin)
671 . ';type=' . uri_escape ($type)
672 . ';timespan=' . uri_escape ($timespan);
673 if ($pinst ne '-')
674 {
675 $graph_url .= ';plugin_instance=' . uri_escape ($pinst);
676 }
677 if ($tinst ne '-')
678 {
679 $graph_url .= ';type_instance=' . uri_escape ($tinst);
680 }
682 if ($files_printed != 0)
683 {
684 print " <tr>\n";
685 }
687 for (my $k = 0; $k < @hosts; $k++)
688 {
689 my $host = $hosts[$k];
690 my $host_graph_url = $graph_url . ';host=' . uri_escape ($host);
692 print "\t<td>";
693 if ($plugins_per_host->{$host}{$plugin}{$pinst}{$type}{$tinst})
694 {
695 print qq(<img src="$host_graph_url" />);
696 #print encode_entities (qq(<img src="${\script_name ()}?action=show_graph;host=$host_esc;$param_plugin;$param_type;timespan=$timespan" />));
697 }
698 print "</td>\n";
699 } # for (my $k = 0; $k < @hosts; $k++)
701 print " </tr>\n";
703 $files_printed++;
704 } # for ($tinst)
705 } # for ($type)
706 } # for ($pinst)
707 } # for ($plugin)
708 print " </table>\n";
709 } # action_show_plugin
711 sub action_show_type
712 {
713 my $host = shift;
714 my $plugin = shift;
715 my $plugin_instance = shift;
716 my $type = shift;
717 my $type_instance = shift;
719 my $host_url = uri_escape ($host);
720 my $plugin_url = uri_escape ($plugin);
721 my $plugin_html = encode_entities ($plugin);
722 my $plugin_instance_url = defined ($plugin_instance) ? uri_escape ($plugin_instance) : undef;
723 my $type_url = uri_escape ($type);
724 my $type_instance_url = defined ($type_instance) ? uri_escape ($type_instance) : undef;
726 my $url_prefix = script_name () . "?action=show_plugin;host=$host_url;plugin=$plugin_url";
727 $url_prefix .= ";plugin_instance=$plugin_instance_url" if (defined ($plugin_instance));
729 print qq( <div><a href="$url_prefix">Back to plugin "$plugin_html"</a></div>\n);
731 $url_prefix = script_name () . "?action=show_graph;host=$host_url;plugin=$plugin_url";
732 $url_prefix .= ";plugin_instance=$plugin_instance_url" if (defined ($plugin_instance));
733 $url_prefix .= ";type=$type_url";
734 $url_prefix .= ";type_instance=$type_instance_url" if (defined ($type_instance));
736 for (qw(hour day week month year))
737 {
738 my $timespan = $_;
740 print qq# <div><img src="$url_prefix;timespan=$timespan" /></div>\n#;
741 }
742 } # action_show_type
744 sub action_show_graph
745 {
746 my $host = shift;
747 my $plugin = shift;
748 my $plugin_instance = shift;
749 my $type = shift;
750 my $type_instance = shift;
751 my @rrd_args;
752 my $title;
754 my %times = (hour => -3600, day => -86400, week => 7 * -86400, month => 31 * -86400, year => 366 * -86400);
755 my $start_time = $times{$Args->{'timespan'}} || -86400;
757 #print STDERR Data::Dumper->Dump ([$Args], ['Args']);
759 # FIXME
760 if (exists ($MetaGraphDefs->{$type}))
761 {
762 my %types = _find_types ($host, $plugin, $plugin_instance);
763 return $MetaGraphDefs->{$type}->($host, $plugin, $plugin_instance, $type, $types{$type});
764 }
766 return if (!defined ($GraphDefs->{$type}));
767 @rrd_args = @{$GraphDefs->{$type}};
769 $title = "$host/$plugin" . (defined ($plugin_instance) ? "-$plugin_instance" : '')
770 . "/$type" . (defined ($type_instance) ? "-$type_instance" : '');
772 for (my $i = 0; $i < @DataDirs; $i++)
773 {
774 my $file = $DataDirs[$i] . "/$title.rrd";
775 next if (!-f $file);
777 $file =~ s/:/\\:/g;
778 s/{file}/$file/ for (@rrd_args);
780 RRDs::graph ('-', '-a', 'PNG', '-s', $start_time, '-t', $title, @RRDDefaultArgs, @rrd_args);
781 if (my $err = RRDs::error ())
782 {
783 die ("RRDs::graph: $err");
784 }
785 }
786 } # action_show_graph
788 sub print_selector
789 {
790 my @hosts = _find_hosts ();
791 @hosts = sort (@hosts);
793 my %selected_hosts = map { $_ => 1 } (_get_param_host ());
794 my $timespan_selected = _get_param_timespan ();
796 print <<HTML;
797 <form action="${\script_name ()}" method="get">
798 <fieldset>
799 <legend>Selector</legend>
800 <select name="host" multiple="multiple" size="10">
801 HTML
802 for (my $i = 0; $i < @hosts; $i++)
803 {
804 my $host = encode_entities ($hosts[$i]);
805 my $selected = defined ($selected_hosts{$hosts[$i]}) ? ' selected="selected"' : '';
806 print qq(\t <option value="$host"$selected>$host</option>\n);
807 }
808 print "\t</select>\n";
810 if (keys %selected_hosts)
811 {
812 my $all_plugins = _find_files_for_hosts (keys %selected_hosts);
813 my %selected_plugins = map { $_ => 1 } (param ('plugin'));
815 print qq(\t<select name="plugin" multiple="multiple" size="10">\n);
816 for (sort (keys %$all_plugins))
817 {
818 my $plugin = $_;
819 my $plugin_html = encode_entities ($plugin);
820 my $selected = (defined ($selected_plugins{$plugin})
821 ? ' selected="selected"' : '');
822 print qq(\t <option value="$plugin_html"$selected>$plugin</option>\n);
823 }
824 print "</select>\n";
825 } # if (keys %selected_hosts)
827 print qq(\t<select name="timespan">\n);
828 for (qw(Hour Day Week Month Year))
829 {
830 my $timespan_uc = $_;
831 my $timespan_lc = lc ($_);
832 my $selected = ($timespan_selected eq $timespan_lc)
833 ? ' selected="selected"' : '';
834 print qq(\t <option value="$timespan_lc"$selected>$timespan_uc</option>\n);
835 }
836 print <<HTML;
837 </select>
838 <input type="submit" name="button" value="Ok" />
839 </fieldset>
840 </form>
841 HTML
842 }
844 sub print_header
845 {
846 print <<HEAD;
847 Content-Type: application/xhtml+xml; charset=utf-8
848 Cache-Control: no-cache
850 <?xml version="1.0" encoding="utf-8"?>
851 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
852 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
854 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
855 <head>
856 <title>collection.cgi, Version 2</title>
857 <style type="text/css">
858 img
859 {
860 border: none;
861 }
862 table.graphs
863 {
864 border-collapse: collapse;
865 }
866 table.graphs td,
867 table.graphs th
868 {
869 border: 1px solid black;
870 empty-cells: hide;
871 }
872 </style>
873 </head>
875 <body>
876 HEAD
877 print_selector ();
878 } # print_header
880 sub print_footer
881 {
882 print <<FOOT;
883 </body>
884 </html>
885 FOOT
886 } # print_footer
888 sub main
889 {
890 read_config ();
891 validate_args ();
893 if (defined ($Args->{'host'})
894 && defined ($Args->{'plugin'})
895 && defined ($Args->{'type'})
896 && ($Args->{'action'} eq 'show_graph'))
897 {
898 $| = 1;
899 print STDOUT header (-Content_Type => 'image/png');
900 action_show_graph ($Args->{'host'},
901 $Args->{'plugin'}, $Args->{'plugin_instance'},
902 $Args->{'type'}, $Args->{'type_instance'});
903 return (0);
904 }
906 print_header ();
908 if (!$Args->{'host'})
909 {
910 list_hosts ();
911 }
912 elsif (!$Args->{'plugin'})
913 {
914 action_show_host ($Args->{'host'});
915 }
916 elsif (!$Args->{'type'})
917 {
918 action_show_plugin ($Args->{'plugin'}, $Args->{'plugin_instance'});
919 }
920 else
921 {
922 action_show_type ($Args->{'host'},
923 $Args->{'plugin'}, $Args->{'plugin_instance'},
924 $Args->{'type'}, $Args->{'type_instance'});
925 }
927 print_footer ();
929 return (0);
930 }
932 sub load_graph_definitions
933 {
934 my $Canvas = 'FFFFFF';
936 my $FullRed = 'FF0000';
937 my $FullGreen = '00E000';
938 my $FullBlue = '0000FF';
939 my $FullYellow = 'F0A000';
940 my $FullCyan = '00A0FF';
941 my $FullMagenta= 'A000FF';
943 my $HalfRed = 'F7B7B7';
944 my $HalfGreen = 'B7EFB7';
945 my $HalfBlue = 'B7B7F7';
946 my $HalfYellow = 'F3DFB7';
947 my $HalfCyan = 'B7DFF7';
948 my $HalfMagenta= 'DFB7F7';
950 my $HalfBlueGreen = '89B3C9';
952 $GraphDefs =
953 {
954 apache_bytes => ['DEF:min_raw={file}:count:MIN',
955 'DEF:avg_raw={file}:count:AVERAGE',
956 'DEF:max_raw={file}:count:MAX',
957 'CDEF:min=min_raw,8,*',
958 'CDEF:avg=avg_raw,8,*',
959 'CDEF:max=max_raw,8,*',
960 'CDEF:mytime=avg_raw,TIME,TIME,IF',
961 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
962 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
963 'CDEF:avg_sample=avg_raw,UN,0,avg_raw,IF,sample_len,*',
964 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
965 "AREA:avg#$HalfBlue",
966 "LINE1:avg#$FullBlue:Bit/s",
967 'GPRINT:min:MIN:%5.1lf%s Min,',
968 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
969 'GPRINT:max:MAX:%5.1lf%s Max,',
970 'GPRINT:avg:LAST:%5.1lf%s Last',
971 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
972 ],
973 apache_connections => ['DEF:min={file}:count:MIN',
974 'DEF:avg={file}:count:AVERAGE',
975 'DEF:max={file}:count:MAX',
976 "AREA:max#$HalfBlue",
977 "AREA:min#$Canvas",
978 "LINE1:avg#$FullBlue:Connections",
979 'GPRINT:min:MIN:%6.2lf Min,',
980 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
981 'GPRINT:max:MAX:%6.2lf Max,',
982 'GPRINT:avg:LAST:%6.2lf Last'
983 ],
984 apache_idle_workers => ['DEF:min={file}:count:MIN',
985 'DEF:avg={file}:count:AVERAGE',
986 'DEF:max={file}:count:MAX',
987 "AREA:max#$HalfBlue",
988 "AREA:min#$Canvas",
989 "LINE1:avg#$FullBlue:Idle Workers",
990 'GPRINT:min:MIN:%6.2lf Min,',
991 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
992 'GPRINT:max:MAX:%6.2lf Max,',
993 'GPRINT:avg:LAST:%6.2lf Last'
994 ],
995 apache_requests => ['DEF:min={file}:count:MIN',
996 'DEF:avg={file}:count:AVERAGE',
997 'DEF:max={file}:count:MAX',
998 "AREA:max#$HalfBlue",
999 "AREA:min#$Canvas",
1000 "LINE1:avg#$FullBlue:Requests/s",
1001 'GPRINT:min:MIN:%6.2lf Min,',
1002 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
1003 'GPRINT:max:MAX:%6.2lf Max,',
1004 'GPRINT:avg:LAST:%6.2lf Last'
1005 ],
1006 apache_scoreboard => ['DEF:min={file}:count:MIN',
1007 'DEF:avg={file}:count:AVERAGE',
1008 'DEF:max={file}:count:MAX',
1009 "AREA:max#$HalfBlue",
1010 "AREA:min#$Canvas",
1011 "LINE1:avg#$FullBlue:Processes",
1012 'GPRINT:min:MIN:%6.2lf Min,',
1013 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
1014 'GPRINT:max:MAX:%6.2lf Max,',
1015 'GPRINT:avg:LAST:%6.2lf Last'
1016 ],
1017 bitrate => ['-v', 'Bits/s',
1018 'DEF:avg={file}:value:AVERAGE',
1019 'DEF:min={file}:value:MIN',
1020 'DEF:max={file}:value:MAX',
1021 "AREA:max#$HalfBlue",
1022 "AREA:min#$Canvas",
1023 "LINE1:avg#$FullBlue:Bits/s",
1024 'GPRINT:min:MIN:%5.1lf%s Min,',
1025 'GPRINT:avg:AVERAGE:%5.1lf%s Average,',
1026 'GPRINT:max:MAX:%5.1lf%s Max,',
1027 'GPRINT:avg:LAST:%5.1lf%s Last\l'
1028 ],
1029 charge => ['-v', 'Ah',
1030 'DEF:avg={file}:value:AVERAGE',
1031 'DEF:min={file}:value:MIN',
1032 'DEF:max={file}:value:MAX',
1033 "AREA:max#$HalfBlue",
1034 "AREA:min#$Canvas",
1035 "LINE1:avg#$FullBlue:Charge",
1036 'GPRINT:min:MIN:%5.1lf%sAh Min,',
1037 'GPRINT:avg:AVERAGE:%5.1lf%sAh Avg,',
1038 'GPRINT:max:MAX:%5.1lf%sAh Max,',
1039 'GPRINT:avg:LAST:%5.1lf%sAh Last\l'
1040 ],
1041 connections => ['-v', 'Connections',
1042 'DEF:avg={file}:value:AVERAGE',
1043 'DEF:min={file}:value:MIN',
1044 'DEF:max={file}:value:MAX',
1045 "AREA:max#$HalfBlue",
1046 "AREA:min#$Canvas",
1047 "LINE1:avg#$FullBlue:Connections",
1048 'GPRINT:min:MIN:%4.1lf Min,',
1049 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1050 'GPRINT:max:MAX:%4.1lf Max,',
1051 'GPRINT:avg:LAST:%4.1lf Last\l'
1052 ],
1053 cpu => ['-v', 'CPU load',
1054 'DEF:avg={file}:value:AVERAGE',
1055 'DEF:min={file}:value:MIN',
1056 'DEF:max={file}:value:MAX',
1057 "AREA:max#$HalfBlue",
1058 "AREA:min#$Canvas",
1059 "LINE1:avg#$FullBlue:Percent",
1060 'GPRINT:min:MIN:%6.2lf%% Min,',
1061 'GPRINT:avg:AVERAGE:%6.2lf%% Avg,',
1062 'GPRINT:max:MAX:%6.2lf%% Max,',
1063 'GPRINT:avg:LAST:%6.2lf%% Last\l'
1064 ],
1065 current => ['-v', 'Ampere',
1066 'DEF:avg={file}:value:AVERAGE',
1067 'DEF:min={file}:value:MIN',
1068 'DEF:max={file}:value:MAX',
1069 "AREA:max#$HalfBlue",
1070 "AREA:min#$Canvas",
1071 "LINE1:avg#$FullBlue:Current",
1072 'GPRINT:min:MIN:%5.1lf%sA Min,',
1073 'GPRINT:avg:AVERAGE:%5.1lf%sA Avg,',
1074 'GPRINT:max:MAX:%5.1lf%sA Max,',
1075 'GPRINT:avg:LAST:%5.1lf%sA Last\l'
1076 ],
1077 df => ['-v', 'Percent', '-l', '0',
1078 'DEF:free_avg={file}:free:AVERAGE',
1079 'DEF:free_min={file}:free:MIN',
1080 'DEF:free_max={file}:free:MAX',
1081 'DEF:used_avg={file}:used:AVERAGE',
1082 'DEF:used_min={file}:used:MIN',
1083 'DEF:used_max={file}:used:MAX',
1084 'CDEF:total=free_avg,used_avg,+',
1085 'CDEF:free_pct=100,free_avg,*,total,/',
1086 'CDEF:used_pct=100,used_avg,*,total,/',
1087 'CDEF:free_acc=free_pct,used_pct,+',
1088 'CDEF:used_acc=used_pct',
1089 "AREA:free_acc#$HalfGreen",
1090 "AREA:used_acc#$HalfRed",
1091 "LINE1:free_acc#$FullGreen:Free",
1092 'GPRINT:free_min:MIN:%5.1lf%sB Min,',
1093 'GPRINT:free_avg:AVERAGE:%5.1lf%sB Avg,',
1094 'GPRINT:free_max:MAX:%5.1lf%sB Max,',
1095 'GPRINT:free_avg:LAST:%5.1lf%sB Last\l',
1096 "LINE1:used_acc#$FullRed:Used",
1097 'GPRINT:used_min:MIN:%5.1lf%sB Min,',
1098 'GPRINT:used_avg:AVERAGE:%5.1lf%sB Avg,',
1099 'GPRINT:used_max:MAX:%5.1lf%sB Max,',
1100 'GPRINT:used_avg:LAST:%5.1lf%sB Last\l'
1101 ],
1102 disk => [
1103 'DEF:rtime_avg={file}:rtime:AVERAGE',
1104 'DEF:rtime_min={file}:rtime:MIN',
1105 'DEF:rtime_max={file}:rtime:MAX',
1106 'DEF:wtime_avg={file}:wtime:AVERAGE',
1107 'DEF:wtime_min={file}:wtime:MIN',
1108 'DEF:wtime_max={file}:wtime:MAX',
1109 'CDEF:rtime_avg_ms=rtime_avg,1000,/',
1110 'CDEF:rtime_min_ms=rtime_min,1000,/',
1111 'CDEF:rtime_max_ms=rtime_max,1000,/',
1112 'CDEF:wtime_avg_ms=wtime_avg,1000,/',
1113 'CDEF:wtime_min_ms=wtime_min,1000,/',
1114 'CDEF:wtime_max_ms=wtime_max,1000,/',
1115 'CDEF:total_avg_ms=rtime_avg_ms,wtime_avg_ms,+',
1116 'CDEF:total_min_ms=rtime_min_ms,wtime_min_ms,+',
1117 'CDEF:total_max_ms=rtime_max_ms,wtime_max_ms,+',
1118 "AREA:total_max_ms#$HalfRed",
1119 "AREA:total_min_ms#$Canvas",
1120 "LINE1:wtime_avg_ms#$FullGreen:Write",
1121 'GPRINT:wtime_min_ms:MIN:%5.1lf%s Min,',
1122 'GPRINT:wtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
1123 'GPRINT:wtime_max_ms:MAX:%5.1lf%s Max,',
1124 'GPRINT:wtime_avg_ms:LAST:%5.1lf%s Last\n',
1125 "LINE1:rtime_avg_ms#$FullBlue:Read ",
1126 'GPRINT:rtime_min_ms:MIN:%5.1lf%s Min,',
1127 'GPRINT:rtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
1128 'GPRINT:rtime_max_ms:MAX:%5.1lf%s Max,',
1129 'GPRINT:rtime_avg_ms:LAST:%5.1lf%s Last\n',
1130 "LINE1:total_avg_ms#$FullRed:Total",
1131 'GPRINT:total_min_ms:MIN:%5.1lf%s Min,',
1132 'GPRINT:total_avg_ms:AVERAGE:%5.1lf%s Avg,',
1133 'GPRINT:total_max_ms:MAX:%5.1lf%s Max,',
1134 'GPRINT:total_avg_ms:LAST:%5.1lf%s Last'
1135 ],
1136 disk_octets => ['-v', 'Bytes/s',
1137 'DEF:out_min={file}:write:MIN',
1138 'DEF:out_avg={file}:write:AVERAGE',
1139 'DEF:out_max={file}:write:MAX',
1140 'DEF:inc_min={file}:read:MIN',
1141 'DEF:inc_avg={file}:read:AVERAGE',
1142 'DEF:inc_max={file}:read:MAX',
1143 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1144 'CDEF:mytime=out_avg,TIME,TIME,IF',
1145 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1146 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1147 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
1148 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
1149 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
1150 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
1151 "AREA:out_avg#$HalfGreen",
1152 "AREA:inc_avg#$HalfBlue",
1153 "AREA:overlap#$HalfBlueGreen",
1154 "LINE1:out_avg#$FullGreen:Written",
1155 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
1156 'GPRINT:out_max:MAX:%5.1lf%s Max,',
1157 'GPRINT:out_avg:LAST:%5.1lf%s Last',
1158 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1159 "LINE1:inc_avg#$FullBlue:Read ",
1160 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
1161 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
1162 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
1163 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
1164 ],
1165 disk_merged => ['-v', 'Merged Ops/s',
1166 'DEF:out_min={file}:write:MIN',
1167 'DEF:out_avg={file}:write:AVERAGE',
1168 'DEF:out_max={file}:write:MAX',
1169 'DEF:inc_min={file}:read:MIN',
1170 'DEF:inc_avg={file}:read:AVERAGE',
1171 'DEF:inc_max={file}:read:MAX',
1172 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1173 "AREA:out_avg#$HalfGreen",
1174 "AREA:inc_avg#$HalfBlue",
1175 "AREA:overlap#$HalfBlueGreen",
1176 "LINE1:out_avg#$FullGreen:Written",
1177 'GPRINT:out_avg:AVERAGE:%6.2lf Avg,',
1178 'GPRINT:out_max:MAX:%6.2lf Max,',
1179 'GPRINT:out_avg:LAST:%6.2lf Last\l',
1180 "LINE1:inc_avg#$FullBlue:Read ",
1181 'GPRINT:inc_avg:AVERAGE:%6.2lf Avg,',
1182 'GPRINT:inc_max:MAX:%6.2lf Max,',
1183 'GPRINT:inc_avg:LAST:%6.2lf Last\l'
1184 ],
1185 disk_ops => ['-v', 'Ops/s',
1186 'DEF:out_min={file}:write:MIN',
1187 'DEF:out_avg={file}:write:AVERAGE',
1188 'DEF:out_max={file}:write:MAX',
1189 'DEF:inc_min={file}:read:MIN',
1190 'DEF:inc_avg={file}:read:AVERAGE',
1191 'DEF:inc_max={file}:read:MAX',
1192 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1193 "AREA:out_avg#$HalfGreen",
1194 "AREA:inc_avg#$HalfBlue",
1195 "AREA:overlap#$HalfBlueGreen",
1196 "LINE1:out_avg#$FullGreen:Written",
1197 'GPRINT:out_avg:AVERAGE:%6.2lf Avg,',
1198 'GPRINT:out_max:MAX:%6.2lf Max,',
1199 'GPRINT:out_avg:LAST:%6.2lf Last\l',
1200 "LINE1:inc_avg#$FullBlue:Read ",
1201 'GPRINT:inc_avg:AVERAGE:%6.2lf Avg,',
1202 'GPRINT:inc_max:MAX:%6.2lf Max,',
1203 'GPRINT:inc_avg:LAST:%6.2lf Last\l'
1204 ],
1205 disk_time => ['-v', 'Seconds/s',
1206 'DEF:out_min_raw={file}:write:MIN',
1207 'DEF:out_avg_raw={file}:write:AVERAGE',
1208 'DEF:out_max_raw={file}:write:MAX',
1209 'DEF:inc_min_raw={file}:read:MIN',
1210 'DEF:inc_avg_raw={file}:read:AVERAGE',
1211 'DEF:inc_max_raw={file}:read:MAX',
1212 'CDEF:out_min=out_min_raw,1000,/',
1213 'CDEF:out_avg=out_avg_raw,1000,/',
1214 'CDEF:out_max=out_max_raw,1000,/',
1215 'CDEF:inc_min=inc_min_raw,1000,/',
1216 'CDEF:inc_avg=inc_avg_raw,1000,/',
1217 'CDEF:inc_max=inc_max_raw,1000,/',
1218 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1219 "AREA:out_avg#$HalfGreen",
1220 "AREA:inc_avg#$HalfBlue",
1221 "AREA:overlap#$HalfBlueGreen",
1222 "LINE1:out_avg#$FullGreen:Written",
1223 'GPRINT:out_avg:AVERAGE:%5.1lf%ss Avg,',
1224 'GPRINT:out_max:MAX:%5.1lf%ss Max,',
1225 'GPRINT:out_avg:LAST:%5.1lf%ss Last\l',
1226 "LINE1:inc_avg#$FullBlue:Read ",
1227 'GPRINT:inc_avg:AVERAGE:%5.1lf%ss Avg,',
1228 'GPRINT:inc_max:MAX:%5.1lf%ss Max,',
1229 'GPRINT:inc_avg:LAST:%5.1lf%ss Last\l'
1230 ],
1231 dns_octets => ['DEF:rsp_min_raw={file}:responses:MIN',
1232 'DEF:rsp_avg_raw={file}:responses:AVERAGE',
1233 'DEF:rsp_max_raw={file}:responses:MAX',
1234 'DEF:qry_min_raw={file}:queries:MIN',
1235 'DEF:qry_avg_raw={file}:queries:AVERAGE',
1236 'DEF:qry_max_raw={file}:queries:MAX',
1237 'CDEF:rsp_min=rsp_min_raw,8,*',
1238 'CDEF:rsp_avg=rsp_avg_raw,8,*',
1239 'CDEF:rsp_max=rsp_max_raw,8,*',
1240 'CDEF:qry_min=qry_min_raw,8,*',
1241 'CDEF:qry_avg=qry_avg_raw,8,*',
1242 'CDEF:qry_max=qry_max_raw,8,*',
1243 'CDEF:overlap=rsp_avg,qry_avg,GT,qry_avg,rsp_avg,IF',
1244 'CDEF:mytime=rsp_avg_raw,TIME,TIME,IF',
1245 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1246 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1247 'CDEF:rsp_avg_sample=rsp_avg_raw,UN,0,rsp_avg_raw,IF,sample_len,*',
1248 'CDEF:rsp_avg_sum=PREV,UN,0,PREV,IF,rsp_avg_sample,+',
1249 'CDEF:qry_avg_sample=qry_avg_raw,UN,0,qry_avg_raw,IF,sample_len,*',
1250 'CDEF:qry_avg_sum=PREV,UN,0,PREV,IF,qry_avg_sample,+',
1251 "AREA:rsp_avg#$HalfGreen",
1252 "AREA:qry_avg#$HalfBlue",
1253 "AREA:overlap#$HalfBlueGreen",
1254 "LINE1:rsp_avg#$FullGreen:Responses",
1255 'GPRINT:rsp_avg:AVERAGE:%5.1lf%s Avg,',
1256 'GPRINT:rsp_max:MAX:%5.1lf%s Max,',
1257 'GPRINT:rsp_avg:LAST:%5.1lf%s Last',
1258 'GPRINT:rsp_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1259 "LINE1:qry_avg#$FullBlue:Queries ",
1260 #'GPRINT:qry_min:MIN:%5.1lf %s Min,',
1261 'GPRINT:qry_avg:AVERAGE:%5.1lf%s Avg,',
1262 'GPRINT:qry_max:MAX:%5.1lf%s Max,',
1263 'GPRINT:qry_avg:LAST:%5.1lf%s Last',
1264 'GPRINT:qry_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
1265 ],
1266 dns_opcode => [
1267 'DEF:avg={file}:value:AVERAGE',
1268 'DEF:min={file}:value:MIN',
1269 'DEF:max={file}:value:MAX',
1270 "AREA:max#$HalfBlue",
1271 "AREA:min#$Canvas",
1272 "LINE1:avg#$FullBlue:Queries/s",
1273 'GPRINT:min:MIN:%9.3lf Min,',
1274 'GPRINT:avg:AVERAGE:%9.3lf Average,',
1275 'GPRINT:max:MAX:%9.3lf Max,',
1276 'GPRINT:avg:LAST:%9.3lf Last\l'
1277 ],
1278 email_count => ['-v', 'Mails',
1279 'DEF:avg={file}:value:AVERAGE',
1280 'DEF:min={file}:value:MIN',
1281 'DEF:max={file}:value:MAX',
1282 "AREA:max#$HalfMagenta",
1283 "AREA:min#$Canvas",
1284 "LINE1:avg#$FullMagenta:Count ",
1285 'GPRINT:min:MIN:%4.1lf Min,',
1286 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1287 'GPRINT:max:MAX:%4.1lf Max,',
1288 'GPRINT:avg:LAST:%4.1lf Last\l'
1289 ],
1290 email_size => ['-v', 'Bytes',
1291 'DEF:avg={file}:value:AVERAGE',
1292 'DEF:min={file}:value:MIN',
1293 'DEF:max={file}:value:MAX',
1294 "AREA:max#$HalfMagenta",
1295 "AREA:min#$Canvas",
1296 "LINE1:avg#$FullMagenta:Count ",
1297 'GPRINT:min:MIN:%4.1lf Min,',
1298 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1299 'GPRINT:max:MAX:%4.1lf Max,',
1300 'GPRINT:avg:LAST:%4.1lf Last\l'
1301 ],
1302 spam_score => ['-v', 'Score',
1303 'DEF:avg={file}:value:AVERAGE',
1304 'DEF:min={file}:value:MIN',
1305 'DEF:max={file}:value:MAX',
1306 "AREA:max#$HalfBlue",
1307 "AREA:min#$Canvas",
1308 "LINE1:avg#$FullBlue:Score ",
1309 'GPRINT:min:MIN:%4.1lf Min,',
1310 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1311 'GPRINT:max:MAX:%4.1lf Max,',
1312 'GPRINT:avg:LAST:%4.1lf Last\l'
1313 ],
1314 spam_check => [
1315 'DEF:avg={file}:value:AVERAGE',
1316 'DEF:min={file}:value:MIN',
1317 'DEF:max={file}:value:MAX',
1318 "AREA:max#$HalfMagenta",
1319 "AREA:min#$Canvas",
1320 "LINE1:avg#$FullMagenta:Count ",
1321 'GPRINT:min:MIN:%4.1lf Min,',
1322 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1323 'GPRINT:max:MAX:%4.1lf Max,',
1324 'GPRINT:avg:LAST:%4.1lf Last\l'
1325 ],
1326 conntrack => ['-v', 'Entries',
1327 'DEF:avg={file}:entropy:AVERAGE',
1328 'DEF:min={file}:entropy:MIN',
1329 'DEF:max={file}:entropy:MAX',
1330 "AREA:max#$HalfBlue",
1331 "AREA:min#$Canvas",
1332 "LINE1:avg#$FullBlue:Count",
1333 'GPRINT:min:MIN:%4.0lf Min,',
1334 'GPRINT:avg:AVERAGE:%4.0lf Avg,',
1335 'GPRINT:max:MAX:%4.0lf Max,',
1336 'GPRINT:avg:LAST:%4.0lf Last\l'
1337 ],
1338 entropy => ['-v', 'Bits',
1339 'DEF:avg={file}:entropy:AVERAGE',
1340 'DEF:min={file}:entropy:MIN',
1341 'DEF:max={file}:entropy:MAX',
1342 "AREA:max#$HalfBlue",
1343 "AREA:min#$Canvas",
1344 "LINE1:avg#$FullBlue:Bits",
1345 'GPRINT:min:MIN:%4.0lfbit Min,',
1346 'GPRINT:avg:AVERAGE:%4.0lfbit Avg,',
1347 'GPRINT:max:MAX:%4.0lfbit Max,',
1348 'GPRINT:avg:LAST:%4.0lfbit Last\l'
1349 ],
1350 fanspeed => ['-v', 'RPM',
1351 'DEF:avg={file}:value:AVERAGE',
1352 'DEF:min={file}:value:MIN',
1353 'DEF:max={file}:value:MAX',
1354 "AREA:max#$HalfMagenta",
1355 "AREA:min#$Canvas",
1356 "LINE1:avg#$FullMagenta:RPM",
1357 'GPRINT:min:MIN:%4.1lf Min,',
1358 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1359 'GPRINT:max:MAX:%4.1lf Max,',
1360 'GPRINT:avg:LAST:%4.1lf Last\l'
1361 ],
1362 frequency => ['-v', 'Hertz',
1363 'DEF:avg={file}:frequency:AVERAGE',
1364 'DEF:min={file}:frequency:MIN',
1365 'DEF:max={file}:frequency:MAX',
1366 "AREA:max#$HalfBlue",
1367 "AREA:min#$Canvas",
1368 "LINE1:avg#$FullBlue:Frequency [Hz]",
1369 'GPRINT:min:MIN:%4.1lf Min,',
1370 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1371 'GPRINT:max:MAX:%4.1lf Max,',
1372 'GPRINT:avg:LAST:%4.1lf Last\l'
1373 ],
1374 frequency_offset => [ # NTPd
1375 'DEF:ppm_avg={file}:ppm:AVERAGE',
1376 'DEF:ppm_min={file}:ppm:MIN',
1377 'DEF:ppm_max={file}:ppm:MAX',
1378 "AREA:ppm_max#$HalfBlue",
1379 "AREA:ppm_min#$Canvas",
1380 "LINE1:ppm_avg#$FullBlue:{inst}",
1381 'GPRINT:ppm_min:MIN:%5.2lf Min,',
1382 'GPRINT:ppm_avg:AVERAGE:%5.2lf Avg,',
1383 'GPRINT:ppm_max:MAX:%5.2lf Max,',
1384 'GPRINT:ppm_avg:LAST:%5.2lf Last'
1385 ],
1386 gauge => ['-v', 'Exec value',
1387 'DEF:temp_avg={file}:value:AVERAGE',
1388 'DEF:temp_min={file}:value:MIN',
1389 'DEF:temp_max={file}:value:MAX',
1390 "AREA:temp_max#$HalfBlue",
1391 "AREA:temp_min#$Canvas",
1392 "LINE1:temp_avg#$FullBlue:Exec value",
1393 'GPRINT:temp_min:MIN:%6.2lf Min,',
1394 'GPRINT:temp_avg:AVERAGE:%6.2lf Avg,',
1395 'GPRINT:temp_max:MAX:%6.2lf Max,',
1396 'GPRINT:temp_avg:LAST:%6.2lf Last\l'
1397 ],
1398 hddtemp => [
1399 'DEF:temp_avg={file}:value:AVERAGE',
1400 'DEF:temp_min={file}:value:MIN',
1401 'DEF:temp_max={file}:value:MAX',
1402 "AREA:temp_max#$HalfRed",
1403 "AREA:temp_min#$Canvas",
1404 "LINE1:temp_avg#$FullRed:Temperature",
1405 'GPRINT:temp_min:MIN:%4.1lf Min,',
1406 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
1407 'GPRINT:temp_max:MAX:%4.1lf Max,',
1408 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
1409 ],
1410 humidity => ['-v', 'Percent',
1411 'DEF:temp_avg={file}:value:AVERAGE',
1412 'DEF:temp_min={file}:value:MIN',
1413 'DEF:temp_max={file}:value:MAX',
1414 "AREA:temp_max#$HalfGreen",
1415 "AREA:temp_min#$Canvas",
1416 "LINE1:temp_avg#$FullGreen:Temperature",
1417 'GPRINT:temp_min:MIN:%4.1lf%% Min,',
1418 'GPRINT:temp_avg:AVERAGE:%4.1lf%% Avg,',
1419 'GPRINT:temp_max:MAX:%4.1lf%% Max,',
1420 'GPRINT:temp_avg:LAST:%4.1lf%% Last\l'
1421 ],
1422 if_errors => ['-v', 'Errors/s',
1423 'DEF:tx_min={file}:tx:MIN',
1424 'DEF:tx_avg={file}:tx:AVERAGE',
1425 'DEF:tx_max={file}:tx:MAX',
1426 'DEF:rx_min={file}:rx:MIN',
1427 'DEF:rx_avg={file}:rx:AVERAGE',
1428 'DEF:rx_max={file}:rx:MAX',
1429 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
1430 'CDEF:mytime=tx_avg,TIME,TIME,IF',
1431 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1432 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1433 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
1434 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
1435 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
1436 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
1437 "AREA:tx_avg#$HalfGreen",
1438 "AREA:rx_avg#$HalfBlue",
1439 "AREA:overlap#$HalfBlueGreen",
1440 "LINE1:tx_avg#$FullGreen:TX",
1441 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
1442 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
1443 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
1444 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
1445 "LINE1:rx_avg#$FullBlue:RX",
1446 #'GPRINT:rx_min:MIN:%5.1lf %s Min,',
1447 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
1448 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
1449 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
1450 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l'
1451 ],
1452 if_collisions => ['-v', 'Collisions/s',
1453 'DEF:min_raw={file}:value:MIN',
1454 'DEF:avg_raw={file}:value:AVERAGE',
1455 'DEF:max_raw={file}:value:MAX',
1456 'CDEF:min=min_raw,8,*',
1457 'CDEF:avg=avg_raw,8,*',
1458 'CDEF:max=max_raw,8,*',
1459 "AREA:max#$HalfBlue",
1460 "AREA:min#$Canvas",
1461 "LINE1:avg#$FullBlue:Collisions/s",
1462 'GPRINT:min:MIN:%5.1lf %s Min,',
1463 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1464 'GPRINT:max:MAX:%5.1lf%s Max,',
1465 'GPRINT:avg:LAST:%5.1lf%s Last\l'
1466 ],
1467 if_dropped => ['-v', 'Packets/s',
1468 'DEF:tx_min={file}:tx:MIN',
1469 'DEF:tx_avg={file}:tx:AVERAGE',
1470 'DEF:tx_max={file}:tx:MAX',
1471 'DEF:rx_min={file}:rx:MIN',
1472 'DEF:rx_avg={file}:rx:AVERAGE',
1473 'DEF:rx_max={file}:rx:MAX',
1474 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
1475 'CDEF:mytime=tx_avg,TIME,TIME,IF',
1476 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1477 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1478 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
1479 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
1480 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
1481 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
1482 "AREA:tx_avg#$HalfGreen",
1483 "AREA:rx_avg#$HalfBlue",
1484 "AREA:overlap#$HalfBlueGreen",
1485 "LINE1:tx_avg#$FullGreen:TX",
1486 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
1487 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
1488 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
1489 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
1490 "LINE1:rx_avg#$FullBlue:RX",
1491 #'GPRINT:rx_min:MIN:%5.1lf %s Min,',
1492 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
1493 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
1494 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
1495 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l'
1496 ],
1497 if_packets => ['-v', 'Packets/s',
1498 'DEF:tx_min={file}:tx:MIN',
1499 'DEF:tx_avg={file}:tx:AVERAGE',
1500 'DEF:tx_max={file}:tx:MAX',
1501 'DEF:rx_min={file}:rx:MIN',
1502 'DEF:rx_avg={file}:rx:AVERAGE',
1503 'DEF:rx_max={file}:rx:MAX',
1504 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
1505 'CDEF:mytime=tx_avg,TIME,TIME,IF',
1506 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1507 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1508 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
1509 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
1510 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
1511 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
1512 "AREA:tx_avg#$HalfGreen",
1513 "AREA:rx_avg#$HalfBlue",
1514 "AREA:overlap#$HalfBlueGreen",
1515 "LINE1:tx_avg#$FullGreen:TX",
1516 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
1517 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
1518 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
1519 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
1520 "LINE1:rx_avg#$FullBlue:RX",
1521 #'GPRINT:rx_min:MIN:%5.1lf %s Min,',
1522 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
1523 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
1524 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
1525 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l'
1526 ],
1527 if_rx_errors => ['-v', 'Errors/s',
1528 'DEF:min={file}:value:MIN',
1529 'DEF:avg={file}:value:AVERAGE',
1530 'DEF:max={file}:value:MAX',
1531 'CDEF:mytime=avg,TIME,TIME,IF',
1532 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1533 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1534 'CDEF:avg_sample=avg,UN,0,avg,IF,sample_len,*',
1535 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
1536 "AREA:avg#$HalfBlue",
1537 "LINE1:avg#$FullBlue:Errors/s",
1538 'GPRINT:avg:AVERAGE:%3.1lf%s Avg,',
1539 'GPRINT:max:MAX:%3.1lf%s Max,',
1540 'GPRINT:avg:LAST:%3.1lf%s Last',
1541 'GPRINT:avg_sum:LAST:(ca. %2.0lf%s Total)\l'
1542 ],
1543 ipt_bytes => ['-v', 'Bits/s',
1544 'DEF:min_raw={file}:value:MIN',
1545 'DEF:avg_raw={file}:value:AVERAGE',
1546 'DEF:max_raw={file}:value:MAX',
1547 'CDEF:min=min_raw,8,*',
1548 'CDEF:avg=avg_raw,8,*',
1549 'CDEF:max=max_raw,8,*',
1550 'CDEF:mytime=avg_raw,TIME,TIME,IF',
1551 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1552 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1553 'CDEF:avg_sample=avg_raw,UN,0,avg_raw,IF,sample_len,*',
1554 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
1555 "AREA:max#$HalfBlue",
1556 "AREA:min#$Canvas",
1557 "LINE1:avg#$FullBlue:Bits/s",
1558 #'GPRINT:min:MIN:%5.1lf %s Min,',
1559 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1560 'GPRINT:max:MAX:%5.1lf%s Max,',
1561 'GPRINT:avg:LAST:%5.1lf%s Last',
1562 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
1563 ],
1564 ipt_packets => ['-v', 'Packets/s',
1565 'DEF:min_raw={file}:value:MIN',
1566 'DEF:avg_raw={file}:value:AVERAGE',
1567 'DEF:max_raw={file}:value:MAX',
1568 'CDEF:min=min_raw,8,*',
1569 'CDEF:avg=avg_raw,8,*',
1570 'CDEF:max=max_raw,8,*',
1571 "AREA:max#$HalfBlue",
1572 "AREA:min#$Canvas",
1573 "LINE1:avg#$FullBlue:Packets/s",
1574 'GPRINT:min:MIN:%5.1lf %s Min,',
1575 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1576 'GPRINT:max:MAX:%5.1lf%s Max,',
1577 'GPRINT:avg:LAST:%5.1lf%s Last\l'
1578 ],
1579 irq => ['-v', 'Issues/s',
1580 'DEF:avg={file}:value:AVERAGE',
1581 'DEF:min={file}:value:MIN',
1582 'DEF:max={file}:value:MAX',
1583 "AREA:max#$HalfBlue",
1584 "AREA:min#$Canvas",
1585 "LINE1:avg#$FullBlue:Issues/s",
1586 'GPRINT:min:MIN:%6.2lf Min,',
1587 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
1588 'GPRINT:max:MAX:%6.2lf Max,',
1589 'GPRINT:avg:LAST:%6.2lf Last\l'
1590 ],
1591 load => ['-v', 'System load',
1592 'DEF:s_avg={file}:shortterm:AVERAGE',
1593 'DEF:s_min={file}:shortterm:MIN',
1594 'DEF:s_max={file}:shortterm:MAX',
1595 'DEF:m_avg={file}:midterm:AVERAGE',
1596 'DEF:m_min={file}:midterm:MIN',
1597 'DEF:m_max={file}:midterm:MAX',
1598 'DEF:l_avg={file}:longterm:AVERAGE',
1599 'DEF:l_min={file}:longterm:MIN',
1600 'DEF:l_max={file}:longterm:MAX',
1601 "AREA:s_max#$HalfGreen",
1602 "AREA:s_min#$Canvas",
1603 "LINE1:s_avg#$FullGreen: 1m average",
1604 'GPRINT:s_min:MIN:%4.2lf Min,',
1605 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
1606 'GPRINT:s_max:MAX:%4.2lf Max,',
1607 'GPRINT:s_avg:LAST:%4.2lf Last\n',
1608 "LINE1:m_avg#$FullBlue: 5m average",
1609 'GPRINT:m_min:MIN:%4.2lf Min,',
1610 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
1611 'GPRINT:m_max:MAX:%4.2lf Max,',
1612 'GPRINT:m_avg:LAST:%4.2lf Last\n',
1613 "LINE1:l_avg#$FullRed:15m average",
1614 'GPRINT:l_min:MIN:%4.2lf Min,',
1615 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
1616 'GPRINT:l_max:MAX:%4.2lf Max,',
1617 'GPRINT:l_avg:LAST:%4.2lf Last'
1618 ],
1619 load_percent => [
1620 'DEF:avg={file}:percent:AVERAGE',
1621 'DEF:min={file}:percent:MIN',
1622 'DEF:max={file}:percent:MAX',
1623 "AREA:max#$HalfBlue",
1624 "AREA:min#$Canvas",
1625 "LINE1:avg#$FullBlue:Load",
1626 'GPRINT:min:MIN:%5.1lf%s%% Min,',
1627 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
1628 'GPRINT:max:MAX:%5.1lf%s%% Max,',
1629 'GPRINT:avg:LAST:%5.1lf%s%% Last\l'
1630 ],
1631 mails => ['DEF:rawgood={file}:good:AVERAGE',
1632 'DEF:rawspam={file}:spam:AVERAGE',
1633 'CDEF:good=rawgood,UN,0,rawgood,IF',
1634 'CDEF:spam=rawspam,UN,0,rawspam,IF',
1635 'CDEF:negspam=spam,-1,*',
1636 "AREA:good#$HalfGreen",
1637 "LINE1:good#$FullGreen:Good mails",
1638 'GPRINT:good:AVERAGE:%4.1lf Avg,',
1639 'GPRINT:good:MAX:%4.1lf Max,',
1640 'GPRINT:good:LAST:%4.1lf Last\n',
1641 "AREA:negspam#$HalfRed",
1642 "LINE1:negspam#$FullRed:Spam mails",
1643 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
1644 'GPRINT:spam:MAX:%4.1lf Max,',
1645 'GPRINT:spam:LAST:%4.1lf Last',
1646 'HRULE:0#000000'
1647 ],
1648 memcached_command => ['-v', 'Commands',
1649 'DEF:avg={file}:value:AVERAGE',
1650 'DEF:min={file}:value:MIN',
1651 'DEF:max={file}:value:MAX',
1652 "AREA:max#$HalfBlue",
1653 "AREA:min#$Canvas",
1654 "LINE1:avg#$FullBlue:Commands",
1655 'GPRINT:min:MIN:%5.1lf%s Min,',
1656 'GPRINT:avg:AVERAGE:%5.1lf Avg,',
1657 'GPRINT:max:MAX:%5.1lf Max,',
1658 'GPRINT:avg:LAST:%5.1lf Last\l'
1659 ],
1660 memcached_connections => ['-v', 'Connections',
1661 'DEF:avg={file}:value:AVERAGE',
1662 'DEF:min={file}:value:MIN',
1663 'DEF:max={file}:value:MAX',
1664 "AREA:max#$HalfBlue",
1665 "AREA:min#$Canvas",
1666 "LINE1:avg#$FullBlue:Connections",
1667 'GPRINT:min:MIN:%4.1lf Min,',
1668 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1669 'GPRINT:max:MAX:%4.1lf Max,',
1670 'GPRINT:avg:LAST:%4.1lf Last\l'
1671 ],
1672 memcached_items => ['-v', 'Items',
1673 'DEF:avg={file}:value:AVERAGE',
1674 'DEF:min={file}:value:MIN',
1675 'DEF:max={file}:value:MAX',
1676 "AREA:max#$HalfBlue",
1677 "AREA:min#$Canvas",
1678 "LINE1:avg#$FullBlue:Items",
1679 'GPRINT:min:MIN:%4.1lf Min,',
1680 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1681 'GPRINT:max:MAX:%4.1lf Max,',
1682 'GPRINT:avg:LAST:%4.1lf Last\l'
1683 ],
1684 memcached_octets => ['-v', 'Bits/s',
1685 'DEF:out_min={file}:tx:MIN',
1686 'DEF:out_avg={file}:tx:AVERAGE',
1687 'DEF:out_max={file}:tx:MAX',
1688 'DEF:inc_min={file}:rx:MIN',
1689 'DEF:inc_avg={file}:rx:AVERAGE',
1690 'DEF:inc_max={file}:rx:MAX',
1691 'CDEF:mytime=out_avg,TIME,TIME,IF',
1692 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1693 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1694 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
1695 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
1696 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
1697 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
1698 'CDEF:out_bit_min=out_min,8,*',
1699 'CDEF:out_bit_avg=out_avg,8,*',
1700 'CDEF:out_bit_max=out_max,8,*',
1701 'CDEF:inc_bit_min=inc_min,8,*',
1702 'CDEF:inc_bit_avg=inc_avg,8,*',
1703 'CDEF:inc_bit_max=inc_max,8,*',
1704 'CDEF:overlap=out_bit_avg,inc_bit_avg,GT,inc_bit_avg,out_bit_avg,IF',
1705 "AREA:out_bit_avg#$HalfGreen",
1706 "AREA:inc_bit_avg#$HalfBlue",
1707 "AREA:overlap#$HalfBlueGreen",
1708 "LINE1:out_bit_avg#$FullGreen:Written",
1709 'GPRINT:out_bit_avg:AVERAGE:%5.1lf%s Avg,',
1710 'GPRINT:out_bit_max:MAX:%5.1lf%s Max,',
1711 'GPRINT:out_bit_avg:LAST:%5.1lf%s Last',
1712 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1713 "LINE1:inc_bit_avg#$FullBlue:Read ",
1714 'GPRINT:inc_bit_avg:AVERAGE:%5.1lf%s Avg,',
1715 'GPRINT:inc_bit_max:MAX:%5.1lf%s Max,',
1716 'GPRINT:inc_bit_avg:LAST:%5.1lf%s Last',
1717 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
1718 ],
1719 memcached_ops => ['-v', 'Ops',
1720 'DEF:avg={file}:value:AVERAGE',
1721 'DEF:min={file}:value:MIN',
1722 'DEF:max={file}:value:MAX',
1723 "AREA:max#$HalfBlue",
1724 "AREA:min#$Canvas",
1725 "LINE1:avg#$FullBlue:Ops",
1726 'GPRINT:min:MIN:%4.1lf Min,',
1727 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1728 'GPRINT:max:MAX:%4.1lf Max,',
1729 'GPRINT:avg:LAST:%4.1lf Last\l'
1730 ],
1731 memory => ['-b', '1024', '-v', 'Bytes',
1732 'DEF:avg={file}:value:AVERAGE',
1733 'DEF:min={file}:value:MIN',
1734 'DEF:max={file}:value:MAX',
1735 "AREA:max#$HalfBlue",
1736 "AREA:min#$Canvas",
1737 "LINE1:avg#$FullBlue:Memory",
1738 'GPRINT:min:MIN:%5.1lf%sbyte Min,',
1739 'GPRINT:avg:AVERAGE:%5.1lf%sbyte Avg,',
1740 'GPRINT:max:MAX:%5.1lf%sbyte Max,',
1741 'GPRINT:avg:LAST:%5.1lf%sbyte Last\l'
1742 ],
1743 old_memory => [
1744 'DEF:used_avg={file}:used:AVERAGE',
1745 'DEF:free_avg={file}:free:AVERAGE',
1746 'DEF:buffers_avg={file}:buffers:AVERAGE',
1747 'DEF:cached_avg={file}:cached:AVERAGE',
1748 'DEF:used_min={file}:used:MIN',
1749 'DEF:free_min={file}:free:MIN',
1750 'DEF:buffers_min={file}:buffers:MIN',
1751 'DEF:cached_min={file}:cached:MIN',
1752 'DEF:used_max={file}:used:MAX',
1753 'DEF:free_max={file}:free:MAX',
1754 'DEF:buffers_max={file}:buffers:MAX',
1755 'DEF:cached_max={file}:cached:MAX',
1756 'CDEF:cached_avg_nn=cached_avg,UN,0,cached_avg,IF',
1757 'CDEF:buffers_avg_nn=buffers_avg,UN,0,buffers_avg,IF',
1758 'CDEF:free_cached_buffers_used=free_avg,cached_avg_nn,+,buffers_avg_nn,+,used_avg,+',
1759 'CDEF:cached_buffers_used=cached_avg,buffers_avg_nn,+,used_avg,+',
1760 'CDEF:buffers_used=buffers_avg,used_avg,+',
1761 "AREA:free_cached_buffers_used#$HalfGreen",
1762 "AREA:cached_buffers_used#$HalfBlue",
1763 "AREA:buffers_used#$HalfYellow",
1764 "AREA:used_avg#$HalfRed",
1765 "LINE1:free_cached_buffers_used#$FullGreen:Free ",
1766 'GPRINT:free_min:MIN:%5.1lf%s Min,',
1767 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
1768 'GPRINT:free_max:MAX:%5.1lf%s Max,',
1769 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
1770 "LINE1:cached_buffers_used#$FullBlue:Page cache ",
1771 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
1772 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
1773 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
1774 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
1775 "LINE1:buffers_used#$FullYellow:Buffer cache",
1776 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
1777 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
1778 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
1779 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
1780 "LINE1:used_avg#$FullRed:Used ",
1781 'GPRINT:used_min:MIN:%5.1lf%s Min,',
1782 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
1783 'GPRINT:used_max:MAX:%5.1lf%s Max,',
1784 'GPRINT:used_avg:LAST:%5.1lf%s Last'
1785 ],
1786 mysql_commands => ['-v', 'Issues/s',
1787 "DEF:val_avg={file}:value:AVERAGE",
1788 "DEF:val_min={file}:value:MIN",
1789 "DEF:val_max={file}:value:MAX",
1790 "AREA:val_max#$HalfBlue",
1791 "AREA:val_min#$Canvas",
1792 "LINE1:val_avg#$FullBlue:Issues/s",
1793 'GPRINT:val_min:MIN:%5.2lf Min,',
1794 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
1795 'GPRINT:val_max:MAX:%5.2lf Max,',
1796 'GPRINT:val_avg:LAST:%5.2lf Last'
1797 ],
1798 mysql_handler => ['-v', 'Issues/s',
1799 "DEF:val_avg={file}:value:AVERAGE",
1800 "DEF:val_min={file}:value:MIN",
1801 "DEF:val_max={file}:value:MAX",
1802 "AREA:val_max#$HalfBlue",
1803 "AREA:val_min#$Canvas",
1804 "LINE1:val_avg#$FullBlue:Issues/s",
1805 'GPRINT:val_min:MIN:%5.2lf Min,',
1806 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
1807 'GPRINT:val_max:MAX:%5.2lf Max,',
1808 'GPRINT:val_avg:LAST:%5.2lf Last'
1809 ],
1810 mysql_octets => ['-v', 'Bits/s',
1811 'DEF:out_min={file}:tx:MIN',
1812 'DEF:out_avg={file}:tx:AVERAGE',
1813 'DEF:out_max={file}:tx:MAX',
1814 'DEF:inc_min={file}:rx:MIN',
1815 'DEF:inc_avg={file}:rx:AVERAGE',
1816 'DEF:inc_max={file}:rx:MAX',
1817 'CDEF:mytime=out_avg,TIME,TIME,IF',
1818 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1819 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1820 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
1821 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
1822 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
1823 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
1824 'CDEF:out_bit_min=out_min,8,*',
1825 'CDEF:out_bit_avg=out_avg,8,*',
1826 'CDEF:out_bit_max=out_max,8,*',
1827 'CDEF:inc_bit_min=inc_min,8,*',
1828 'CDEF:inc_bit_avg=inc_avg,8,*',
1829 'CDEF:inc_bit_max=inc_max,8,*',
1830 'CDEF:overlap=out_bit_avg,inc_bit_avg,GT,inc_bit_avg,out_bit_avg,IF',
1831 "AREA:out_bit_avg#$HalfGreen",
1832 "AREA:inc_bit_avg#$HalfBlue",
1833 "AREA:overlap#$HalfBlueGreen",
1834 "LINE1:out_bit_avg#$FullGreen:Written",
1835 'GPRINT:out_bit_avg:AVERAGE:%5.1lf%s Avg,',
1836 'GPRINT:out_bit_max:MAX:%5.1lf%s Max,',
1837 'GPRINT:out_bit_avg:LAST:%5.1lf%s Last',
1838 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1839 "LINE1:inc_bit_avg#$FullBlue:Read ",
1840 'GPRINT:inc_bit_avg:AVERAGE:%5.1lf%s Avg,',
1841 'GPRINT:inc_bit_max:MAX:%5.1lf%s Max,',
1842 'GPRINT:inc_bit_avg:LAST:%5.1lf%s Last',
1843 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
1844 ],
1845 mysql_qcache => ['-v', 'Queries/s',
1846 "DEF:hits_min={file}:hits:MIN",
1847 "DEF:hits_avg={file}:hits:AVERAGE",
1848 "DEF:hits_max={file}:hits:MAX",
1849 "DEF:inserts_min={file}:inserts:MIN",
1850 "DEF:inserts_avg={file}:inserts:AVERAGE",
1851 "DEF:inserts_max={file}:inserts:MAX",
1852 "DEF:not_cached_min={file}:not_cached:MIN",
1853 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
1854 "DEF:not_cached_max={file}:not_cached:MAX",
1855 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
1856 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
1857 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
1858 "DEF:queries_min={file}:queries_in_cache:MIN",
1859 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
1860 "DEF:queries_max={file}:queries_in_cache:MAX",
1861 "CDEF:unknown=queries_avg,UNKN,+",
1862 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
1863 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
1864 "CDEF:hits_agg=hits_avg",
1865 "AREA:not_cached_agg#$HalfYellow",
1866 "AREA:inserts_agg#$HalfBlue",
1867 "AREA:hits_agg#$HalfGreen",
1868 "LINE1:not_cached_agg#$FullYellow:Not Cached ",
1869 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
1870 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
1871 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
1872 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
1873 "LINE1:inserts_agg#$FullBlue:Inserts ",
1874 'GPRINT:inserts_min:MIN:%5.2lf Min,',
1875 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
1876 'GPRINT:inserts_max:MAX:%5.2lf Max,',
1877 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
1878 "LINE1:hits_agg#$FullGreen:Hits ",
1879 'GPRINT:hits_min:MIN:%5.2lf Min,',
1880 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
1881 'GPRINT:hits_max:MAX:%5.2lf Max,',
1882 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
1883 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes ",
1884 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
1885 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
1886 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
1887 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
1888 "LINE1:unknown#$Canvas:Queries in cache",
1889 'GPRINT:queries_min:MIN:%5.0lf Min,',
1890 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
1891 'GPRINT:queries_max:MAX:%5.0lf Max,',
1892 'GPRINT:queries_avg:LAST:%5.0lf Last\l'
1893 ],
1894 mysql_threads => ['-v', 'Threads',
1895 "DEF:running_min={file}:running:MIN",
1896 "DEF:running_avg={file}:running:AVERAGE",
1897 "DEF:running_max={file}:running:MAX",
1898 "DEF:connected_min={file}:connected:MIN",
1899 "DEF:connected_avg={file}:connected:AVERAGE",
1900 "DEF:connected_max={file}:connected:MAX",
1901 "DEF:cached_min={file}:cached:MIN",
1902 "DEF:cached_avg={file}:cached:AVERAGE",
1903 "DEF:cached_max={file}:cached:MAX",
1904 "DEF:created_min={file}:created:MIN",
1905 "DEF:created_avg={file}:created:AVERAGE",
1906 "DEF:created_max={file}:created:MAX",
1907 "CDEF:unknown=created_avg,UNKN,+",
1908 "CDEF:cached_agg=connected_avg,cached_avg,+",
1909 "AREA:cached_agg#$HalfGreen",
1910 "AREA:connected_avg#$HalfBlue",
1911 "AREA:running_avg#$HalfRed",
1912 "LINE1:cached_agg#$FullGreen:Cached ",
1913 'GPRINT:cached_min:MIN:%5.1lf Min,',
1914 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
1915 'GPRINT:cached_max:MAX:%5.1lf Max,',
1916 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
1917 "LINE1:connected_avg#$FullBlue:Connected",
1918 'GPRINT:connected_min:MIN:%5.1lf Min,',
1919 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
1920 'GPRINT:connected_max:MAX:%5.1lf Max,',
1921 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
1922 "LINE1:running_avg#$FullRed:Running ",
1923 'GPRINT:running_min:MIN:%5.1lf Min,',
1924 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
1925 'GPRINT:running_max:MAX:%5.1lf Max,',
1926 'GPRINT:running_avg:LAST:%5.1lf Last\l',
1927 "LINE1:unknown#$Canvas:Created ",
1928 'GPRINT:created_min:MIN:%5.0lf Min,',
1929 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
1930 'GPRINT:created_max:MAX:%5.0lf Max,',
1931 'GPRINT:created_avg:LAST:%5.0lf Last\l'
1932 ],
1933 nfs_procedure => ['-v', 'Issues/s',
1934 'DEF:avg={file}:value:AVERAGE',
1935 'DEF:min={file}:value:MIN',
1936 'DEF:max={file}:value:MAX',
1937 "AREA:max#$HalfBlue",
1938 "AREA:min#$Canvas",
1939 "LINE1:avg#$FullBlue:Issues/s",
1940 'GPRINT:min:MIN:%6.2lf Min,',
1941 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
1942 'GPRINT:max:MAX:%6.2lf Max,',
1943 'GPRINT:avg:LAST:%6.2lf Last\l'
1944 ],
1945 nfs3_procedures => [
1946 "DEF:null_avg={file}:null:AVERAGE",
1947 "DEF:getattr_avg={file}:getattr:AVERAGE",
1948 "DEF:setattr_avg={file}:setattr:AVERAGE",
1949 "DEF:lookup_avg={file}:lookup:AVERAGE",
1950 "DEF:access_avg={file}:access:AVERAGE",
1951 "DEF:readlink_avg={file}:readlink:AVERAGE",
1952 "DEF:read_avg={file}:read:AVERAGE",
1953 "DEF:write_avg={file}:write:AVERAGE",
1954 "DEF:create_avg={file}:create:AVERAGE",
1955 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
1956 "DEF:symlink_avg={file}:symlink:AVERAGE",
1957 "DEF:mknod_avg={file}:mknod:AVERAGE",
1958 "DEF:remove_avg={file}:remove:AVERAGE",
1959 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
1960 "DEF:rename_avg={file}:rename:AVERAGE",
1961 "DEF:link_avg={file}:link:AVERAGE",
1962 "DEF:readdir_avg={file}:readdir:AVERAGE",
1963 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
1964 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
1965 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
1966 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
1967 "DEF:commit_avg={file}:commit:AVERAGE",
1968 "DEF:null_max={file}:null:MAX",
1969 "DEF:getattr_max={file}:getattr:MAX",
1970 "DEF:setattr_max={file}:setattr:MAX",
1971 "DEF:lookup_max={file}:lookup:MAX",
1972 "DEF:access_max={file}:access:MAX",
1973 "DEF:readlink_max={file}:readlink:MAX",
1974 "DEF:read_max={file}:read:MAX",
1975 "DEF:write_max={file}:write:MAX",
1976 "DEF:create_max={file}:create:MAX",
1977 "DEF:mkdir_max={file}:mkdir:MAX",
1978 "DEF:symlink_max={file}:symlink:MAX",
1979 "DEF:mknod_max={file}:mknod:MAX",
1980 "DEF:remove_max={file}:remove:MAX",
1981 "DEF:rmdir_max={file}:rmdir:MAX",
1982 "DEF:rename_max={file}:rename:MAX",
1983 "DEF:link_max={file}:link:MAX",
1984 "DEF:readdir_max={file}:readdir:MAX",
1985 "DEF:readdirplus_max={file}:readdirplus:MAX",
1986 "DEF:fsstat_max={file}:fsstat:MAX",
1987 "DEF:fsinfo_max={file}:fsinfo:MAX",
1988 "DEF:pathconf_max={file}:pathconf:MAX",
1989 "DEF:commit_max={file}:commit:MAX",
1990 "CDEF:other_avg=null_avg,readlink_avg,create_avg,mkdir_avg,symlink_avg,mknod_avg,remove_avg,rmdir_avg,rename_avg,link_avg,readdir_avg,readdirplus_avg,fsstat_avg,fsinfo_avg,pathconf_avg,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
1991 "CDEF:other_max=null_max,readlink_max,create_max,mkdir_max,symlink_max,mknod_max,remove_max,rmdir_max,rename_max,link_max,readdir_max,readdirplus_max,fsstat_max,fsinfo_max,pathconf_max,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
1992 "CDEF:stack_read=read_avg",
1993 "CDEF:stack_getattr=stack_read,getattr_avg,+",
1994 "CDEF:stack_access=stack_getattr,access_avg,+",
1995 "CDEF:stack_lookup=stack_access,lookup_avg,+",
1996 "CDEF:stack_write=stack_lookup,write_avg,+",
1997 "CDEF:stack_commit=stack_write,commit_avg,+",
1998 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
1999 "CDEF:stack_other=stack_setattr,other_avg,+",
2000 "AREA:stack_other#$HalfRed",
2001 "AREA:stack_setattr#$HalfGreen",
2002 "AREA:stack_commit#$HalfYellow",
2003 "AREA:stack_write#$HalfGreen",
2004 "AREA:stack_lookup#$HalfBlue",
2005 "AREA:stack_access#$HalfMagenta",
2006 "AREA:stack_getattr#$HalfCyan",
2007 "AREA:stack_read#$HalfBlue",
2008 "LINE1:stack_other#$FullRed:Other ",
2009 'GPRINT:other_max:MAX:%5.1lf Max,',
2010 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
2011 'GPRINT:other_avg:LAST:%5.1lf Last\l',
2012 "LINE1:stack_setattr#$FullGreen:setattr",
2013 'GPRINT:setattr_max:MAX:%5.1lf Max,',
2014 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
2015 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
2016 "LINE1:stack_commit#$FullYellow:commit ",
2017 'GPRINT:commit_max:MAX:%5.1lf Max,',
2018 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
2019 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
2020 "LINE1:stack_write#$FullGreen:write ",
2021 'GPRINT:write_max:MAX:%5.1lf Max,',
2022 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
2023 'GPRINT:write_avg:LAST:%5.1lf Last\l',
2024 "LINE1:stack_lookup#$FullBlue:lookup ",
2025 'GPRINT:lookup_max:MAX:%5.1lf Max,',
2026 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
2027 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
2028 "LINE1:stack_access#$FullMagenta:access ",
2029 'GPRINT:access_max:MAX:%5.1lf Max,',
2030 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
2031 'GPRINT:access_avg:LAST:%5.1lf Last\l',
2032 "LINE1:stack_getattr#$FullCyan:getattr",
2033 'GPRINT:getattr_max:MAX:%5.1lf Max,',
2034 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
2035 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
2036 "LINE1:stack_read#$FullBlue:read ",
2037 'GPRINT:read_max:MAX:%5.1lf Max,',
2038 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
2039 'GPRINT:read_avg:LAST:%5.1lf Last\l'
2040 ],
2041 partition => [
2042 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
2043 "DEF:rbyte_min={file}:rbytes:MIN",
2044 "DEF:rbyte_max={file}:rbytes:MAX",
2045 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
2046 "DEF:wbyte_min={file}:wbytes:MIN",
2047 "DEF:wbyte_max={file}:wbytes:MAX",
2048 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
2049 "AREA:wbyte_avg#$HalfGreen",
2050 "AREA:rbyte_avg#$HalfBlue",
2051 "AREA:overlap#$HalfBlueGreen",
2052 "LINE1:wbyte_avg#$FullGreen:Write",
2053 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
2054 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
2055 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
2056 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
2057 "LINE1:rbyte_avg#$FullBlue:Read ",
2058 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
2059 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
2060 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
2061 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l'
2062 ],
2063 percent => ['-v', 'Percent',
2064 'DEF:avg={file}:percent:AVERAGE',
2065 'DEF:min={file}:percent:MIN',
2066 'DEF:max={file}:percent:MAX',
2067 "AREA:max#$HalfBlue",
2068 "AREA:min#$Canvas",
2069 "LINE1:avg#$FullBlue:Percent",
2070 'GPRINT:min:MIN:%5.1lf%% Min,',
2071 'GPRINT:avg:AVERAGE:%5.1lf%% Avg,',
2072 'GPRINT:max:MAX:%5.1lf%% Max,',
2073 'GPRINT:avg:LAST:%5.1lf%% Last\l'
2074 ],
2075 ping => ['DEF:ping_avg={file}:ping:AVERAGE',
2076 'DEF:ping_min={file}:ping:MIN',
2077 'DEF:ping_max={file}:ping:MAX',
2078 "AREA:ping_max#$HalfBlue",
2079 "AREA:ping_min#$Canvas",
2080 "LINE1:ping_avg#$FullBlue:Ping",
2081 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
2082 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
2083 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
2084 'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
2085 pg_blks => ['DEF:pg_blks_avg={file}:value:AVERAGE',
2086 'DEF:pg_blks_min={file}:value:MIN',
2087 'DEF:pg_blks_max={file}:value:MAX',
2088 "AREA:pg_blks_max#$HalfBlue",
2089 "AREA:pg_blks_min#$Canvas",
2090 "LINE1:pg_blks_avg#$FullBlue:Blocks",
2091 'GPRINT:pg_blks_min:MIN:%4.1lf%s Min,',
2092 'GPRINT:pg_blks_avg:AVERAGE:%4.1lf%s Avg,',
2093 'GPRINT:pg_blks_max:MAX:%4.1lf%s Max,',
2094 'GPRINT:pg_blks_avg:LAST:%4.1lf%s Last'],
2095 pg_db_size => ['DEF:pg_db_size_avg={file}:value:AVERAGE',
2096 'DEF:pg_db_size_min={file}:value:MIN',
2097 'DEF:pg_db_size_max={file}:value:MAX',
2098 "AREA:pg_db_size_max#$HalfBlue",
2099 "AREA:pg_db_size_min#$Canvas",
2100 "LINE1:pg_db_size_avg#$FullBlue:Bytes",
2101 'GPRINT:pg_db_size_min:MIN:%4.1lf%s Min,',
2102 'GPRINT:pg_db_size_avg:AVERAGE:%4.1lf%s Avg,',
2103 'GPRINT:pg_db_size_max:MAX:%4.1lf%s Max,',
2104 'GPRINT:pg_db_size_avg:LAST:%4.1lf%s Last'],
2105 pg_n_tup_c => ['DEF:pg_n_tup_avg={file}:value:AVERAGE',
2106 'DEF:pg_n_tup_min={file}:value:MIN',
2107 'DEF:pg_n_tup_max={file}:value:MAX',
2108 "AREA:pg_n_tup_max#$HalfBlue",
2109 "AREA:pg_n_tup_min#$Canvas",
2110 "LINE1:pg_n_tup_avg#$FullBlue:Tuples",
2111 'GPRINT:pg_n_tup_min:MIN:%4.1lf%s Min,',
2112 'GPRINT:pg_n_tup_avg:AVERAGE:%4.1lf%s Avg,',
2113 'GPRINT:pg_n_tup_max:MAX:%4.1lf%s Max,',
2114 'GPRINT:pg_n_tup_avg:LAST:%4.1lf%s Last'],
2115 pg_n_tup_g => ['DEF:pg_n_tup_avg={file}:value:AVERAGE',
2116 'DEF:pg_n_tup_min={file}:value:MIN',
2117 'DEF:pg_n_tup_max={file}:value:MAX',
2118 "AREA:pg_n_tup_max#$HalfBlue",
2119 "AREA:pg_n_tup_min#$Canvas",
2120 "LINE1:pg_n_tup_avg#$FullBlue:Tuples",
2121 'GPRINT:pg_n_tup_min:MIN:%4.1lf%s Min,',
2122 'GPRINT:pg_n_tup_avg:AVERAGE:%4.1lf%s Avg,',
2123 'GPRINT:pg_n_tup_max:MAX:%4.1lf%s Max,',
2124 'GPRINT:pg_n_tup_avg:LAST:%4.1lf%s Last'],
2125 pg_numbackends => ['DEF:pg_numbackends_avg={file}:value:AVERAGE',
2126 'DEF:pg_numbackends_min={file}:value:MIN',
2127 'DEF:pg_numbackends_max={file}:value:MAX',
2128 "AREA:pg_numbackends_max#$HalfBlue",
2129 "AREA:pg_numbackends_min#$Canvas",
2130 "LINE1:pg_numbackends_avg#$FullBlue:Backends",
2131 'GPRINT:pg_numbackends_min:MIN:%4.1lf%s Min,',
2132 'GPRINT:pg_numbackends_avg:AVERAGE:%4.1lf%s Avg,',
2133 'GPRINT:pg_numbackends_max:MAX:%4.1lf%s Max,',
2134 'GPRINT:pg_numbackends_avg:LAST:%4.1lf%s Last'],
2135 pg_scan => ['DEF:pg_scan_avg={file}:value:AVERAGE',
2136 'DEF:pg_scan_min={file}:value:MIN',
2137 'DEF:pg_scan_max={file}:value:MAX',
2138 "AREA:pg_scan_max#$HalfBlue",
2139 "AREA:pg_scan_min#$Canvas",
2140 "LINE1:pg_scan_avg#$FullBlue:Scans",
2141 'GPRINT:pg_scan_min:MIN:%4.1lf%s Min,',
2142 'GPRINT:pg_scan_avg:AVERAGE:%4.1lf%s Avg,',
2143 'GPRINT:pg_scan_max:MAX:%4.1lf%s Max,',
2144 'GPRINT:pg_scan_avg:LAST:%4.1lf%s Last'],
2145 pg_xact => ['DEF:pg_xact_avg={file}:value:AVERAGE',
2146 'DEF:pg_xact_min={file}:value:MIN',
2147 'DEF:pg_xact_max={file}:value:MAX',
2148 "AREA:pg_xact_max#$HalfBlue",
2149 "AREA:pg_xact_min#$Canvas",
2150 "LINE1:pg_xact_avg#$FullBlue:Transactions",
2151 'GPRINT:pg_xact_min:MIN:%4.1lf%s Min,',
2152 'GPRINT:pg_xact_avg:AVERAGE:%4.1lf%s Avg,',
2153 'GPRINT:pg_xact_max:MAX:%4.1lf%s Max,',
2154 'GPRINT:pg_xact_avg:LAST:%4.1lf%s Last'],
2155 power => ['-v', 'Watt',
2156 'DEF:avg={file}:value:AVERAGE',
2157 'DEF:min={file}:value:MIN',
2158 'DEF:max={file}:value:MAX',
2159 "AREA:max#$HalfBlue",
2160 "AREA:min#$Canvas",
2161 "LINE1:avg#$FullBlue:Watt",
2162 'GPRINT:min:MIN:%5.1lf%sW Min,',
2163 'GPRINT:avg:AVERAGE:%5.1lf%sW Avg,',
2164 'GPRINT:max:MAX:%5.1lf%sW Max,',
2165 'GPRINT:avg:LAST:%5.1lf%sW Last\l'
2166 ],
2167 processes => [
2168 "DEF:running_avg={file}:running:AVERAGE",
2169 "DEF:running_min={file}:running:MIN",
2170 "DEF:running_max={file}:running:MAX",
2171 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
2172 "DEF:sleeping_min={file}:sleeping:MIN",
2173 "DEF:sleeping_max={file}:sleeping:MAX",
2174 "DEF:zombies_avg={file}:zombies:AVERAGE",
2175 "DEF:zombies_min={file}:zombies:MIN",
2176 "DEF:zombies_max={file}:zombies:MAX",
2177 "DEF:stopped_avg={file}:stopped:AVERAGE",
2178 "DEF:stopped_min={file}:stopped:MIN",
2179 "DEF:stopped_max={file}:stopped:MAX",
2180 "DEF:paging_avg={file}:paging:AVERAGE",
2181 "DEF:paging_min={file}:paging:MIN",
2182 "DEF:paging_max={file}:paging:MAX",
2183 "DEF:blocked_avg={file}:blocked:AVERAGE",
2184 "DEF:blocked_min={file}:blocked:MIN",
2185 "DEF:blocked_max={file}:blocked:MAX",
2186 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
2187 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
2188 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
2189 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
2190 'CDEF:running_acc=sleeping_avg,running_avg,+',
2191 'CDEF:sleeping_acc=sleeping_avg',
2192 "AREA:paging_acc#$HalfYellow",
2193 "AREA:blocked_acc#$HalfCyan",
2194 "AREA:zombies_acc#$HalfRed",
2195 "AREA:stopped_acc#$HalfMagenta",
2196 "AREA:running_acc#$HalfGreen",
2197 "AREA:sleeping_acc#$HalfBlue",
2198 "LINE1:paging_acc#$FullYellow:Paging ",
2199 'GPRINT:paging_min:MIN:%5.1lf Min,',
2200 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
2201 'GPRINT:paging_max:MAX:%5.1lf Max,',
2202 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
2203 "LINE1:blocked_acc#$FullCyan:Blocked ",
2204 'GPRINT:blocked_min:MIN:%5.1lf Min,',
2205 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
2206 'GPRINT:blocked_max:MAX:%5.1lf Max,',
2207 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
2208 "LINE1:zombies_acc#$FullRed:Zombies ",
2209 'GPRINT:zombies_min:MIN:%5.1lf Min,',
2210 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
2211 'GPRINT:zombies_max:MAX:%5.1lf Max,',
2212 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
2213 "LINE1:stopped_acc#$FullMagenta:Stopped ",
2214 'GPRINT:stopped_min:MIN:%5.1lf Min,',
2215 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
2216 'GPRINT:stopped_max:MAX:%5.1lf Max,',
2217 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
2218 "LINE1:running_acc#$FullGreen:Running ",
2219 'GPRINT:running_min:MIN:%5.1lf Min,',
2220 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
2221 'GPRINT:running_max:MAX:%5.1lf Max,',
2222 'GPRINT:running_avg:LAST:%5.1lf Last\l',
2223 "LINE1:sleeping_acc#$FullBlue:Sleeping",
2224 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
2225 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
2226 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
2227 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
2228 ],
2229 ps_count => ['-v', 'Processes',
2230 'DEF:procs_avg={file}:processes:AVERAGE',
2231 'DEF:procs_min={file}:processes:MIN',
2232 'DEF:procs_max={file}:processes:MAX',
2233 'DEF:thrds_avg={file}:threads:AVERAGE',
2234 'DEF:thrds_min={file}:threads:MIN',
2235 'DEF:thrds_max={file}:threads:MAX',
2236 "AREA:thrds_avg#$HalfBlue",
2237 "AREA:procs_avg#$HalfRed",
2238 "LINE1:thrds_avg#$FullBlue:Threads ",
2239 'GPRINT:thrds_min:MIN:%5.1lf Min,',
2240 'GPRINT:thrds_avg:AVERAGE:%5.1lf Avg,',
2241 'GPRINT:thrds_max:MAX:%5.1lf Max,',
2242 'GPRINT:thrds_avg:LAST:%5.1lf Last\l',
2243 "LINE1:procs_avg#$FullRed:Processes",
2244 'GPRINT:procs_min:MIN:%5.1lf Min,',
2245 'GPRINT:procs_avg:AVERAGE:%5.1lf Avg,',
2246 'GPRINT:procs_max:MAX:%5.1lf Max,',
2247 'GPRINT:procs_avg:LAST:%5.1lf Last\l'
2248 ],
2249 ps_cputime => ['-v', 'Jiffies',
2250 'DEF:user_avg_raw={file}:user:AVERAGE',
2251 'DEF:user_min_raw={file}:user:MIN',
2252 'DEF:user_max_raw={file}:user:MAX',
2253 'DEF:syst_avg_raw={file}:syst:AVERAGE',
2254 'DEF:syst_min_raw={file}:syst:MIN',
2255 'DEF:syst_max_raw={file}:syst:MAX',
2256 'CDEF:user_avg=user_avg_raw,1000000,/',
2257 'CDEF:user_min=user_min_raw,1000000,/',
2258 'CDEF:user_max=user_max_raw,1000000,/',
2259 'CDEF:syst_avg=syst_avg_raw,1000000,/',
2260 'CDEF:syst_min=syst_min_raw,1000000,/',
2261 'CDEF:syst_max=syst_max_raw,1000000,/',
2262 'CDEF:user_syst=syst_avg,UN,0,syst_avg,IF,user_avg,+',
2263 "AREA:user_syst#$HalfBlue",
2264 "AREA:syst_avg#$HalfRed",
2265 "LINE1:user_syst#$FullBlue:User ",
2266 'GPRINT:user_min:MIN:%5.1lf%s Min,',
2267 'GPRINT:user_avg:AVERAGE:%5.1lf%s Avg,',
2268 'GPRINT:user_max:MAX:%5.1lf%s Max,',
2269 'GPRINT:user_avg:LAST:%5.1lf%s Last\l',
2270 "LINE1:syst_avg#$FullRed:System",
2271 'GPRINT:syst_min:MIN:%5.1lf%s Min,',
2272 'GPRINT:syst_avg:AVERAGE:%5.1lf%s Avg,',
2273 'GPRINT:syst_max:MAX:%5.1lf%s Max,',
2274 'GPRINT:syst_avg:LAST:%5.1lf%s Last\l'
2275 ],
2276 ps_pagefaults => ['-v', 'Pagefaults/s',
2277 'DEF:minor_avg={file}:minflt:AVERAGE',
2278 'DEF:minor_min={file}:minflt:MIN',
2279 'DEF:minor_max={file}:minflt:MAX',
2280 'DEF:major_avg={file}:majflt:AVERAGE',
2281 'DEF:major_min={file}:majflt:MIN',
2282 'DEF:major_max={file}:majflt:MAX',
2283 'CDEF:minor_major=major_avg,UN,0,major_avg,IF,minor_avg,+',
2284 "AREA:minor_major#$HalfBlue",
2285 "AREA:major_avg#$HalfRed",
2286 "LINE1:minor_major#$FullBlue:Minor",
2287 'GPRINT:minor_min:MIN:%5.1lf%s Min,',
2288 'GPRINT:minor_avg:AVERAGE:%5.1lf%s Avg,',
2289 'GPRINT:minor_max:MAX:%5.1lf%s Max,',
2290 'GPRINT:minor_avg:LAST:%5.1lf%s Last\l',
2291 "LINE1:major_avg#$FullRed:Major",
2292 'GPRINT:major_min:MIN:%5.1lf%s Min,',
2293 'GPRINT:major_avg:AVERAGE:%5.1lf%s Avg,',
2294 'GPRINT:major_max:MAX:%5.1lf%s Max,',
2295 'GPRINT:major_avg:LAST:%5.1lf%s Last\l'
2296 ],
2297 ps_rss => ['-v', 'Bytes',
2298 'DEF:avg={file}:value:AVERAGE',
2299 'DEF:min={file}:value:MIN',
2300 'DEF:max={file}:value:MAX',
2301 "AREA:avg#$HalfBlue",
2302 "LINE1:avg#$FullBlue:RSS",
2303 'GPRINT:min:MIN:%5.1lf%s Min,',
2304 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
2305 'GPRINT:max:MAX:%5.1lf%s Max,',
2306 'GPRINT:avg:LAST:%5.1lf%s Last\l'
2307 ],
2308 ps_state => ['-v', 'Processes',
2309 'DEF:avg={file}:value:AVERAGE',
2310 'DEF:min={file}:value:MIN',
2311 'DEF:max={file}:value:MAX',
2312 "AREA:max#$HalfBlue",
2313 "AREA:min#$Canvas",
2314 "LINE1:avg#$FullBlue:Processes",
2315 'GPRINT:min:MIN:%6.2lf Min,',
2316 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
2317 'GPRINT:max:MAX:%6.2lf Max,',
2318 'GPRINT:avg:LAST:%6.2lf Last\l'
2319 ],
2320 signal_noise => ['-v', 'dBm',
2321 'DEF:avg={file}:value:AVERAGE',
2322 'DEF:min={file}:value:MIN',
2323 'DEF:max={file}:value:MAX',
2324 "AREA:max#$HalfBlue",
2325 "AREA:min#$Canvas",
2326 "LINE1:avg#$FullBlue:Noise",
2327 'GPRINT:min:MIN:%5.1lf%sdBm Min,',
2328 'GPRINT:avg:AVERAGE:%5.1lf%sdBm Avg,',
2329 'GPRINT:max:MAX:%5.1lf%sdBm Max,',
2330 'GPRINT:avg:LAST:%5.1lf%sdBm Last\l'
2331 ],
2332 signal_power => ['-v', 'dBm',
2333 'DEF:avg={file}:value:AVERAGE',
2334 'DEF:min={file}:value:MIN',
2335 'DEF:max={file}:value:MAX',
2336 "AREA:max#$HalfBlue",
2337 "AREA:min#$Canvas",
2338 "LINE1:avg#$FullBlue:Power",
2339 'GPRINT:min:MIN:%5.1lf%sdBm Min,',
2340 'GPRINT:avg:AVERAGE:%5.1lf%sdBm Avg,',
2341 'GPRINT:max:MAX:%5.1lf%sdBm Max,',
2342 'GPRINT:avg:LAST:%5.1lf%sdBm Last\l'
2343 ],
2344 signal_quality => ['-v', '%',
2345 'DEF:avg={file}:value:AVERAGE',
2346 'DEF:min={file}:value:MIN',
2347 'DEF:max={file}:value:MAX',
2348 "AREA:max#$HalfBlue",
2349 "AREA:min#$Canvas",
2350 "LINE1:avg#$FullBlue:Quality",
2351 'GPRINT:min:MIN:%5.1lf%s%% Min,',
2352 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
2353 'GPRINT:max:MAX:%5.1lf%s%% Max,',
2354 'GPRINT:avg:LAST:%5.1lf%s%% Last\l'
2355 ],
2356 swap => ['-v', 'Bytes', '-b', '1024',
2357 'DEF:avg={file}:value:AVERAGE',
2358 'DEF:min={file}:value:MIN',
2359 'DEF:max={file}:value:MAX',
2360 "AREA:max#$HalfBlue",
2361 "AREA:min#$Canvas",
2362 "LINE1:avg#$FullBlue:Bytes",
2363 'GPRINT:min:MIN:%6.2lf%sByte Min,',
2364 'GPRINT:avg:AVERAGE:%6.2lf%sByte Avg,',
2365 'GPRINT:max:MAX:%6.2lf%sByte Max,',
2366 'GPRINT:avg:LAST:%6.2lf%sByte Last\l'
2367 ],
2368 old_swap => [
2369 'DEF:used_avg={file}:used:AVERAGE',
2370 'DEF:used_min={file}:used:MIN',
2371 'DEF:used_max={file}:used:MAX',
2372 'DEF:free_avg={file}:free:AVERAGE',
2373 'DEF:free_min={file}:free:MIN',
2374 'DEF:free_max={file}:free:MAX',
2375 'DEF:cach_avg={file}:cached:AVERAGE',
2376 'DEF:cach_min={file}:cached:MIN',
2377 'DEF:cach_max={file}:cached:MAX',
2378 'DEF:resv_avg={file}:resv:AVERAGE',
2379 'DEF:resv_min={file}:resv:MIN',
2380 'DEF:resv_max={file}:resv:MAX',
2381 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
2382 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
2383 'CDEF:used_acc=used_avg',
2384 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
2385 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
2386 'CDEF:free_acc=cach_acc,free_avg,+',
2387 "AREA:free_acc#$HalfGreen",
2388 "AREA:cach_acc#$HalfBlue",
2389 "AREA:resv_acc#$HalfYellow",
2390 "AREA:used_acc#$HalfRed",
2391 "LINE1:free_acc#$FullGreen:Free ",
2392 'GPRINT:free_min:MIN:%5.1lf%s Min,',
2393 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
2394 'GPRINT:free_max:MAX:%5.1lf%s Max,',
2395 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
2396 "LINE1:cach_acc#$FullBlue:Cached ",
2397 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
2398 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
2399 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
2400 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
2401 "LINE1:resv_acc#$FullYellow:Reserved",
2402 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
2403 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
2404 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
2405 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
2406 "LINE1:used_acc#$FullRed:Used ",
2407 'GPRINT:used_min:MIN:%5.1lf%s Min,',
2408 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
2409 'GPRINT:used_max:MAX:%5.1lf%s Max,',
2410 'GPRINT:used_avg:LAST:%5.1lf%s Last\l'
2411 ],
2412 tcp_connections => ['-v', 'Connections',
2413 'DEF:avg={file}:value:AVERAGE',
2414 'DEF:min={file}:value:MIN',
2415 'DEF:max={file}:value:MAX',
2416 "AREA:max#$HalfBlue",
2417 "AREA:min#$Canvas",
2418 "LINE1:avg#$FullBlue:Connections",
2419 'GPRINT:min:MIN:%4.1lf Min,',
2420 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
2421 'GPRINT:max:MAX:%4.1lf Max,',
2422 'GPRINT:avg:LAST:%4.1lf Last\l'
2423 ],
2424 temperature => ['-v', 'Celsius',
2425 'DEF:temp_avg={file}:value:AVERAGE',
2426 'DEF:temp_min={file}:value:MIN',
2427 'DEF:temp_max={file}:value:MAX',
2428 'CDEF:average=temp_avg,0.2,*,PREV,UN,temp_avg,PREV,IF,0.8,*,+',
2429 "AREA:temp_max#$HalfRed",
2430 "AREA:temp_min#$Canvas",
2431 "LINE1:temp_avg#$FullRed:Temperature",
2432 'GPRINT:temp_min:MIN:%4.1lf Min,',
2433 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
2434 'GPRINT:temp_max:MAX:%4.1lf Max,',
2435 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
2436 ],
2437 timeleft => ['-v', 'Minutes',
2438 'DEF:avg={file}:timeleft:AVERAGE',
2439 'DEF:min={file}:timeleft:MIN',
2440 'DEF:max={file}:timeleft:MAX',
2441 "AREA:max#$HalfBlue",
2442 "AREA:min#$Canvas",
2443 "LINE1:avg#$FullBlue:Time left [min]",
2444 'GPRINT:min:MIN:%5.1lf%s Min,',
2445 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
2446 'GPRINT:max:MAX:%5.1lf%s Max,',
2447 'GPRINT:avg:LAST:%5.1lf%s Last\l'
2448 ],
2449 time_offset => [ # NTPd
2450 'DEF:s_avg={file}:seconds:AVERAGE',
2451 'DEF:s_min={file}:seconds:MIN',
2452 'DEF:s_max={file}:seconds:MAX',
2453 "AREA:s_max#$HalfBlue",
2454 "AREA:s_min#$Canvas",
2455 "LINE1:s_avg#$FullBlue:{inst}",
2456 'GPRINT:s_min:MIN:%7.3lf%s Min,',
2457 'GPRINT:s_avg:AVERAGE:%7.3lf%s Avg,',
2458 'GPRINT:s_max:MAX:%7.3lf%s Max,',
2459 'GPRINT:s_avg:LAST:%7.3lf%s Last'
2460 ],
2461 if_octets => ['-v', 'Bits/s', '-l', '0',
2462 'DEF:out_min_raw={file}:tx:MIN',
2463 'DEF:out_avg_raw={file}:tx:AVERAGE',
2464 'DEF:out_max_raw={file}:tx:MAX',
2465 'DEF:inc_min_raw={file}:rx:MIN',
2466 'DEF:inc_avg_raw={file}:rx:AVERAGE',
2467 'DEF:inc_max_raw={file}:rx:MAX',
2468 'CDEF:out_min=out_min_raw,8,*',
2469 'CDEF:out_avg=out_avg_raw,8,*',
2470 'CDEF:out_max=out_max_raw,8,*',
2471 'CDEF:inc_min=inc_min_raw,8,*',
2472 'CDEF:inc_avg=inc_avg_raw,8,*',
2473 'CDEF:inc_max=inc_max_raw,8,*',
2474 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
2475 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
2476 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
2477 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
2478 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
2479 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
2480 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
2481 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
2482 "AREA:out_avg#$HalfGreen",
2483 "AREA:inc_avg#$HalfBlue",
2484 "AREA:overlap#$HalfBlueGreen",
2485 "LINE1:out_avg#$FullGreen:Outgoing",
2486 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
2487 'GPRINT:out_max:MAX:%5.1lf%s Max,',
2488 'GPRINT:out_avg:LAST:%5.1lf%s Last',
2489 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
2490 "LINE1:inc_avg#$FullBlue:Incoming",
2491 #'GPRINT:inc_min:MIN:%5.1lf %s Min,',
2492 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
2493 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
2494 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
2495 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
2496 ],
2497 cpufreq => [
2498 'DEF:cpufreq_avg={file}:value:AVERAGE',
2499 'DEF:cpufreq_min={file}:value:MIN',
2500 'DEF:cpufreq_max={file}:value:MAX',
2501 "AREA:cpufreq_max#$HalfBlue",
2502 "AREA:cpufreq_min#$Canvas",
2503 "LINE1:cpufreq_avg#$FullBlue:Frequency",
2504 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
2505 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
2506 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
2507 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l'
2508 ],
2509 multimeter => [
2510 'DEF:multimeter_avg={file}:value:AVERAGE',
2511 'DEF:multimeter_min={file}:value:MIN',
2512 'DEF:multimeter_max={file}:value:MAX',
2513 "AREA:multimeter_max#$HalfBlue",
2514 "AREA:multimeter_min#$Canvas",
2515 "LINE1:multimeter_avg#$FullBlue:Multimeter",
2516 'GPRINT:multimeter_min:MIN:%4.1lf Min,',
2517 'GPRINT:multimeter_avg:AVERAGE:%4.1lf Average,',
2518 'GPRINT:multimeter_max:MAX:%4.1lf Max,',
2519 'GPRINT:multimeter_avg:LAST:%4.1lf Last\l'
2520 ],
2521 users => ['-v', 'Users',
2522 'DEF:users_avg={file}:users:AVERAGE',
2523 'DEF:users_min={file}:users:MIN',
2524 'DEF:users_max={file}:users:MAX',
2525 "AREA:users_max#$HalfBlue",
2526 "AREA:users_min#$Canvas",
2527 "LINE1:users_avg#$FullBlue:Users",
2528 'GPRINT:users_min:MIN:%4.1lf Min,',
2529 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
2530 'GPRINT:users_max:MAX:%4.1lf Max,',
2531 'GPRINT:users_avg:LAST:%4.1lf Last\l'
2532 ],
2533 voltage => ['-v', 'Voltage',
2534 'DEF:avg={file}:value:AVERAGE',
2535 'DEF:min={file}:value:MIN',
2536 'DEF:max={file}:value:MAX',
2537 "AREA:max#$HalfBlue",
2538 "AREA:min#$Canvas",
2539 "LINE1:avg#$FullBlue:Voltage",
2540 'GPRINT:min:MIN:%5.1lf%sV Min,',
2541 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
2542 'GPRINT:max:MAX:%5.1lf%sV Max,',
2543 'GPRINT:avg:LAST:%5.1lf%sV Last\l'
2544 ],
2545 vs_threads => [
2546 "DEF:avg={file}:value:AVERAGE",
2547 "DEF:min={file}:value:MIN",
2548 "DEF:max={file}:value:MAX",
2549 "AREA:max#$HalfBlue",
2550 "AREA:min#$Canvas",
2551 "LINE1:avg#$FullBlue:Threads",
2552 'GPRINT:min:MIN:%5.1lf Min,',
2553 'GPRINT:avg:AVERAGE:%5.1lf Avg.,',
2554 'GPRINT:max:MAX:%5.1lf Max,',
2555 'GPRINT:avg:LAST:%5.1lf Last\l',
2556 ],
2557 vs_memory => ['-b', '1024', '-v', 'Bytes',
2558 "DEF:avg={file}:value:AVERAGE",
2559 "DEF:min={file}:value:MIN",
2560 "DEF:max={file}:value:MAX",
2561 "AREA:max#$HalfBlue",
2562 "AREA:min#$Canvas",
2563 "LINE1:avg#$FullBlue:",
2564 'GPRINT:min:MIN:%5.1lf%sbytes Min,',
2565 'GPRINT:avg:AVERAGE:%5.1lf%sbytes Avg.,',
2566 'GPRINT:max:MAX:%5.1lf%sbytes Max,',
2567 'GPRINT:avg:LAST:%5.1lf%sbytes Last\l',
2568 ],
2569 vs_processes => [
2570 "DEF:avg={file}:value:AVERAGE",
2571 "DEF:min={file}:value:MIN",
2572 "DEF:max={file}:value:MAX",
2573 "AREA:max#$HalfBlue",
2574 "AREA:min#$Canvas",
2575 "LINE1:avg#$FullBlue:Processes",
2576 'GPRINT:min:MIN:%5.1lf Min,',
2577 'GPRINT:avg:AVERAGE:%5.1lf Avg.,',
2578 'GPRINT:max:MAX:%5.1lf Max,',
2579 'GPRINT:avg:LAST:%5.1lf Last\l',
2580 ],
2581 vmpage_number => ['-v', 'Pages',
2582 'DEF:avg={file}:value:AVERAGE',
2583 'DEF:min={file}:value:MIN',
2584 'DEF:max={file}:value:MAX',
2585 "AREA:max#$HalfBlue",
2586 "AREA:min#$Canvas",
2587 "LINE1:avg#$FullBlue:Number",
2588 'GPRINT:min:MIN:%4.1lf Min,',
2589 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
2590 'GPRINT:max:MAX:%4.1lf Max,',
2591 'GPRINT:avg:LAST:%4.1lf Last\l'
2592 ],
2593 vmpage_faults => [
2594 "DEF:minf_avg={file}:minflt:AVERAGE",
2595 "DEF:minf_min={file}:minflt:MIN",
2596 "DEF:minf_max={file}:minflt:MAX",
2597 "DEF:majf_avg={file}:majflt:AVERAGE",
2598 "DEF:majf_min={file}:majflt:MIN",
2599 "DEF:majf_max={file}:majflt:MAX",
2600 'CDEF:overlap=majf_avg,minf_avg,GT,minf_avg,majf_avg,IF',
2601 "AREA:majf_avg#$HalfGreen",
2602 "AREA:minf_avg#$HalfBlue",
2603 "AREA:overlap#$HalfBlueGreen",
2604 "LINE1:majf_avg#$FullGreen:Major",
2605 'GPRINT:majf_min:MIN:%5.1lf%s Min,',
2606 'GPRINT:majf_avg:AVERAGE:%5.1lf%s Avg,',
2607 'GPRINT:majf_max:MAX:%5.1lf%s Max,',
2608 'GPRINT:majf_avg:LAST:%5.1lf%s Last\l',
2609 "LINE1:minf_avg#$FullBlue:Minor",
2610 'GPRINT:minf_min:MIN:%5.1lf%s Min,',
2611 'GPRINT:minf_avg:AVERAGE:%5.1lf%s Avg,',
2612 'GPRINT:minf_max:MAX:%5.1lf%s Max,',
2613 'GPRINT:minf_avg:LAST:%5.1lf%s Last\l'
2614 ],
2615 vmpage_io => [
2616 "DEF:rpag_avg={file}:in:AVERAGE",
2617 "DEF:rpag_min={file}:in:MIN",
2618 "DEF:rpag_max={file}:in:MAX",
2619 "DEF:wpag_avg={file}:out:AVERAGE",
2620 "DEF:wpag_min={file}:out:MIN",
2621 "DEF:wpag_max={file}:out:MAX",
2622 'CDEF:overlap=wpag_avg,rpag_avg,GT,rpag_avg,wpag_avg,IF',
2623 "AREA:wpag_avg#$HalfGreen",
2624 "AREA:rpag_avg#$HalfBlue",
2625 "AREA:overlap#$HalfBlueGreen",
2626 "LINE1:wpag_avg#$FullGreen:OUT",
2627 'GPRINT:wpag_min:MIN:%5.1lf%s Min,',
2628 'GPRINT:wpag_avg:AVERAGE:%5.1lf%s Avg,',
2629 'GPRINT:wpag_max:MAX:%5.1lf%s Max,',
2630 'GPRINT:wpag_avg:LAST:%5.1lf%s Last\l',
2631 "LINE1:rpag_avg#$FullBlue:IN ",
2632 'GPRINT:rpag_min:MIN:%5.1lf%s Min,',
2633 'GPRINT:rpag_avg:AVERAGE:%5.1lf%s Avg,',
2634 'GPRINT:rpag_max:MAX:%5.1lf%s Max,',
2635 'GPRINT:rpag_avg:LAST:%5.1lf%s Last\l'
2636 ],
2637 vmpage_action => ['-v', 'Pages',
2638 'DEF:avg={file}:value:AVERAGE',
2639 'DEF:min={file}:value:MIN',
2640 'DEF:max={file}:value:MAX',
2641 "AREA:max#$HalfBlue",
2642 "AREA:min#$Canvas",
2643 "LINE1:avg#$FullBlue:Number",
2644 'GPRINT:min:MIN:%4.1lf Min,',
2645 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
2646 'GPRINT:max:MAX:%4.1lf Max,',
2647 'GPRINT:avg:LAST:%4.1lf Last\l'
2648 ],
2649 virt_cpu_total => ['-v', 'Milliseconds',
2650 'DEF:avg_raw={file}:ns:AVERAGE',
2651 'DEF:min_raw={file}:ns:MIN',
2652 'DEF:max_raw={file}:ns:MAX',
2653 'CDEF:avg=avg_raw,1000000,/',
2654 'CDEF:min=min_raw,1000000,/',
2655 'CDEF:max=max_raw,1000000,/',
2656 "AREA:avg#$HalfBlue",
2657 "LINE1:avg#$FullBlue:CPU time",
2658 'GPRINT:min:MIN:%4.1lf Min,',
2659 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
2660 'GPRINT:max:MAX:%4.1lf Max,',
2661 'GPRINT:avg:LAST:%4.1lf Last\l'
2662 ],
2663 };
2664 $GraphDefs->{'if_multicast'} = $GraphDefs->{'ipt_packets'};
2665 $GraphDefs->{'if_tx_errors'} = $GraphDefs->{'if_rx_errors'};
2666 $GraphDefs->{'dns_qtype'} = $GraphDefs->{'dns_opcode'};
2667 $GraphDefs->{'dns_rcode'} = $GraphDefs->{'dns_opcode'};
2668 $GraphDefs->{'vmpage_io-memory'} = $GraphDefs->{'vmpage_io'};
2669 $GraphDefs->{'vmpage_io-swap'} = $GraphDefs->{'vmpage_io'};
2670 $GraphDefs->{'virt_cpu_total'} = $GraphDefs->{'virt_cpu_total'};
2672 $MetaGraphDefs->{'cpu'} = \&meta_graph_cpu;
2673 $MetaGraphDefs->{'dns_qtype'} = \&meta_graph_dns;
2674 $MetaGraphDefs->{'dns_rcode'} = \&meta_graph_dns;
2675 $MetaGraphDefs->{'if_rx_errors'} = \&meta_graph_if_rx_errors;
2676 $MetaGraphDefs->{'if_tx_errors'} = \&meta_graph_if_rx_errors;
2677 $MetaGraphDefs->{'memory'} = \&meta_graph_memory;
2678 $MetaGraphDefs->{'nfs_procedure'} = \&meta_graph_nfs_procedure;
2679 $MetaGraphDefs->{'ps_state'} = \&meta_graph_ps_state;
2680 $MetaGraphDefs->{'swap'} = \&meta_graph_swap;
2681 $MetaGraphDefs->{'mysql_commands'} = \&meta_graph_mysql_commands;
2682 $MetaGraphDefs->{'mysql_handler'} = \&meta_graph_mysql_commands;
2683 $MetaGraphDefs->{'tcp_connections'} = \&meta_graph_tcp_connections;
2684 $MetaGraphDefs->{'vmpage_number'} = \&meta_graph_vmpage_number;
2685 $MetaGraphDefs->{'vmpage_action'} = \&meta_graph_vmpage_action;
2686 } # load_graph_definitions
2688 sub meta_graph_generic_stack
2689 {
2690 confess ("Wrong number of arguments") if (@_ != 2);
2692 my $opts = shift;
2693 my $sources = shift;
2694 my $i;
2696 my $timespan_str = _get_param_timespan ();
2697 my $timespan_int = (-1) * $ValidTimespan->{$timespan_str};
2699 $opts->{'title'} ||= 'Unknown title';
2700 $opts->{'rrd_opts'} ||= [];
2701 $opts->{'colors'} ||= {};
2703 my @cmd = ('-', '-a', 'PNG', '-s', $timespan_int,
2704 '-t', $opts->{'title'} || 'Unknown title',
2705 @RRDDefaultArgs, @{$opts->{'rrd_opts'}});
2707 my $max_inst_name = 0;
2708 my @vnames = ();
2710 for ($i = 0; $i < @$sources; $i++)
2711 {
2712 my $tmp = $sources->[$i]->{'name'};
2713 $tmp =~ tr/A-Za-z0-9\-_/_/c;
2714 $vnames[$i] = $i . $tmp;
2715 }
2717 for ($i = 0; $i < @$sources; $i++)
2718 {
2719 my $inst_data = $sources->[$i];
2720 my $inst_name = $inst_data->{'name'} || confess;
2721 my $file = $inst_data->{'file'} || confess;
2722 my $vname = $vnames[$i];
2724 if (length ($inst_name) > $max_inst_name)
2725 {
2726 $max_inst_name = length ($inst_name);
2727 }
2729 confess ("No such file: $file") if (!-e $file);
2731 push (@cmd,
2732 qq#DEF:${vname}_min=$file:value:MIN#,
2733 qq#DEF:${vname}_avg=$file:value:AVERAGE#,
2734 qq#DEF:${vname}_max=$file:value:MAX#,
2735 qq#CDEF:${vname}_nnl=${vname}_avg,UN,0,${vname}_avg,IF#);
2736 }
2738 {
2739 my $vname = $vnames[@vnames - 1];
2741 push (@cmd, qq#CDEF:${vname}_stk=${vname}_nnl#);
2742 }
2743 for (my $i = 1; $i < @$sources; $i++)
2744 {
2745 my $vname0 = $vnames[@vnames - ($i + 1)];
2746 my $vname1 = $vnames[@vnames - $i];
2748 push (@cmd, qq#CDEF:${vname0}_stk=${vname0}_nnl,${vname1}_stk,+#);
2749 }
2751 for (my $i = 0; $i < @$sources; $i++)
2752 {
2753 my $inst_data = $sources->[$i];
2754 my $inst_name = $inst_data->{'name'};
2756 my $vname = $vnames[$i];
2758 my $legend = sprintf ('%-*s', $max_inst_name, $inst_name);
2760 my $line_color;
2761 my $area_color;
2763 my $number_format = $opts->{'number_format'} || '%6.1lf';
2765 if (exists ($opts->{'colors'}{$inst_name}))
2766 {
2767 $line_color = $opts->{'colors'}{$inst_name};
2768 $area_color = _string_to_color ($line_color);
2769 }
2770 else
2771 {
2772 $area_color = _get_random_color ();
2773 $line_color = _color_to_string ($area_color);
2774 }
2775 $area_color = _color_to_string (_get_faded_color ($area_color));
2777 push (@cmd, qq(AREA:${vname}_stk#$area_color),
2778 qq(LINE1:${vname}_stk#$line_color:$legend),
2779 qq(GPRINT:${vname}_min:MIN:$number_format Min,),
2780 qq(GPRINT:${vname}_avg:AVERAGE:$number_format Avg,),
2781 qq(GPRINT:${vname}_max:MAX:$number_format Max,),
2782 qq(GPRINT:${vname}_avg:LAST:$number_format Last\\l),
2783 );
2784 }
2786 RRDs::graph (@cmd);
2787 if (my $errmsg = RRDs::error ())
2788 {
2789 confess ("RRDs::graph: $errmsg");
2790 }
2791 } # meta_graph_generic_stack
2793 sub meta_graph_cpu
2794 {
2795 confess ("Wrong number of arguments") if (@_ != 5);
2797 my $host = shift;
2798 my $plugin = shift;
2799 my $plugin_instance = shift;
2800 my $type = shift;
2801 my $type_instances = shift;
2803 my $opts = {};
2804 my $sources = [];
2806 $opts->{'title'} = "$host/$plugin"
2807 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
2809 $opts->{'rrd_opts'} = ['-v', 'Percent'];
2811 my @files = ();
2813 $opts->{'colors'} =
2814 {
2815 'idle' => 'ffffff',
2816 'nice' => '00e000',
2817 'user' => '0000ff',
2818 'wait' => 'ffb000',
2819 'system' => 'ff0000',
2820 'softirq' => 'ff00ff',
2821 'interrupt' => 'a000a0',
2822 'steal' => '000000'
2823 };
2825 _custom_sort_arrayref ($type_instances,
2826 [qw(idle nice user wait system softirq interrupt steal)]);
2828 for (@$type_instances)
2829 {
2830 my $inst = $_;
2831 my $file = '';
2832 my $title = $opts->{'title'};
2834 for (@DataDirs)
2835 {
2836 if (-e "$_/$title-$inst.rrd")
2837 {
2838 $file = "$_/$title-$inst.rrd";
2839 last;
2840 }
2841 }
2842 confess ("No file found for $title") if ($file eq '');
2844 push (@$sources,
2845 {
2846 name => $inst,
2847 file => $file
2848 }
2849 );
2850 } # for (@$type_instances)
2852 return (meta_graph_generic_stack ($opts, $sources));
2853 } # meta_graph_cpu
2855 sub meta_graph_dns
2856 {
2857 confess ("Wrong number of arguments") if (@_ != 5);
2859 my $host = shift;
2860 my $plugin = shift;
2861 my $plugin_instance = shift;
2862 my $type = shift;
2863 my $type_instances = shift;
2865 my $opts = {};
2866 my $sources = [];
2868 $opts->{'title'} = "$host/$plugin"
2869 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
2871 $opts->{'rrd_opts'} = ['-v', 'Queries/s'];
2873 my @files = ();
2875 @$type_instances = sort @$type_instances;
2877 $opts->{'colors'} = _get_n_colors ($type_instances);
2879 for (@$type_instances)
2880 {
2881 my $inst = $_;
2882 my $file = '';
2883 my $title = $opts->{'title'};
2885 for (@DataDirs)
2886 {
2887 if (-e "$_/$title-$inst.rrd")
2888 {
2889 $file = "$_/$title-$inst.rrd";
2890 last;
2891 }
2892 }
2893 confess ("No file found for $title") if ($file eq '');
2895 push (@$sources,
2896 {
2897 name => $inst,
2898 file => $file
2899 }
2900 );
2901 } # for (@$type_instances)
2903 return (meta_graph_generic_stack ($opts, $sources));
2904 } # meta_graph_dns
2906 sub meta_graph_memory
2907 {
2908 confess ("Wrong number of arguments") if (@_ != 5);
2910 my $host = shift;
2911 my $plugin = shift;
2912 my $plugin_instance = shift;
2913 my $type = shift;
2914 my $type_instances = shift;
2916 my $opts = {};
2917 my $sources = [];
2919 $opts->{'title'} = "$host/$plugin"
2920 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
2921 $opts->{'number_format'} = '%5.1lf%s';
2923 $opts->{'rrd_opts'} = ['-b', '1024', '-v', 'Bytes'];
2925 my @files = ();
2927 $opts->{'colors'} =
2928 {
2929 'free' => '00e000',
2930 'cached' => '0000ff',
2931 'buffered' => 'ffb000',
2932 'used' => 'ff0000'
2933 };
2935 _custom_sort_arrayref ($type_instances,
2936 [qw(free cached buffered used)]);
2938 for (@$type_instances)
2939 {
2940 my $inst = $_;
2941 my $file = '';
2942 my $title = $opts->{'title'};
2944 for (@DataDirs)
2945 {
2946 if (-e "$_/$title-$inst.rrd")
2947 {
2948 $file = "$_/$title-$inst.rrd";
2949 last;
2950 }
2951 }
2952 confess ("No file found for $title") if ($file eq '');
2954 push (@$sources,
2955 {
2956 name => $inst,
2957 file => $file
2958 }
2959 );
2960 } # for (@$type_instances)
2962 return (meta_graph_generic_stack ($opts, $sources));
2963 } # meta_graph_memory
2965 sub meta_graph_if_rx_errors
2966 {
2967 confess ("Wrong number of arguments") if (@_ != 5);
2969 my $host = shift;
2970 my $plugin = shift;
2971 my $plugin_instance = shift;
2972 my $type = shift;
2973 my $type_instances = shift;
2975 my $opts = {};
2976 my $sources = [];
2978 $opts->{'title'} = "$host/$plugin"
2979 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
2980 $opts->{'number_format'} = '%5.2lf';
2981 $opts->{'rrd_opts'} = ['-v', 'Errors/s'];
2983 my @files = ();
2985 for (sort @$type_instances)
2986 {
2987 my $inst = $_;
2988 my $file = '';
2989 my $title = $opts->{'title'};
2991 for (@DataDirs)
2992 {
2993 if (-e "$_/$title-$inst.rrd")
2994 {
2995 $file = "$_/$title-$inst.rrd";
2996 last;
2997 }
2998 }
2999 confess ("No file found for $title") if ($file eq '');
3001 push (@$sources,
3002 {
3003 name => $inst,
3004 file => $file
3005 }
3006 );
3007 } # for (@$type_instances)
3009 return (meta_graph_generic_stack ($opts, $sources));
3010 } # meta_graph_if_rx_errors
3012 sub meta_graph_mysql_commands
3013 {
3014 confess ("Wrong number of arguments") if (@_ != 5);
3016 my $host = shift;
3017 my $plugin = shift;
3018 my $plugin_instance = shift;
3019 my $type = shift;
3020 my $type_instances = shift;
3022 my $opts = {};
3023 my $sources = [];
3025 $opts->{'title'} = "$host/$plugin"
3026 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3027 $opts->{'number_format'} = '%5.2lf';
3029 my @files = ();
3031 for (sort @$type_instances)
3032 {
3033 my $inst = $_;
3034 my $file = '';
3035 my $title = $opts->{'title'};
3037 for (@DataDirs)
3038 {
3039 if (-e "$_/$title-$inst.rrd")
3040 {
3041 $file = "$_/$title-$inst.rrd";
3042 last;
3043 }
3044 }
3045 confess ("No file found for $title") if ($file eq '');
3047 push (@$sources,
3048 {
3049 name => $inst,
3050 file => $file
3051 }
3052 );
3053 } # for (@$type_instances)
3055 return (meta_graph_generic_stack ($opts, $sources));
3056 } # meta_graph_mysql_commands
3058 sub meta_graph_nfs_procedure
3059 {
3060 confess ("Wrong number of arguments") if (@_ != 5);
3062 my $host = shift;
3063 my $plugin = shift;
3064 my $plugin_instance = shift;
3065 my $type = shift;
3066 my $type_instances = shift;
3068 my $opts = {};
3069 my $sources = [];
3071 $opts->{'title'} = "$host/$plugin"
3072 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3073 $opts->{'number_format'} = '%5.1lf%s';
3075 my @files = ();
3077 for (sort @$type_instances)
3078 {
3079 my $inst = $_;
3080 my $file = '';
3081 my $title = $opts->{'title'};
3083 for (@DataDirs)
3084 {
3085 if (-e "$_/$title-$inst.rrd")
3086 {
3087 $file = "$_/$title-$inst.rrd";
3088 last;
3089 }
3090 }
3091 confess ("No file found for $title") if ($file eq '');
3093 push (@$sources,
3094 {
3095 name => $inst,
3096 file => $file
3097 }
3098 );
3099 } # for (@$type_instances)
3101 return (meta_graph_generic_stack ($opts, $sources));
3102 } # meta_graph_nfs_procedure
3104 sub meta_graph_ps_state
3105 {
3106 confess ("Wrong number of arguments") if (@_ != 5);
3108 my $host = shift;
3109 my $plugin = shift;
3110 my $plugin_instance = shift;
3111 my $type = shift;
3112 my $type_instances = shift;
3114 my $opts = {};
3115 my $sources = [];
3117 $opts->{'title'} = "$host/$plugin"
3118 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3119 $opts->{'rrd_opts'} = ['-v', 'Processes'];
3121 my @files = ();
3123 $opts->{'colors'} =
3124 {
3125 'Running' => '00e000',
3126 'Sleeping' => '0000ff',
3127 'Paging' => 'ffb000',
3128 'Zombies' => 'ff0000',
3129 'Blocked' => 'ff00ff',
3130 'Stopped' => 'a000a0'
3131 };
3133 _custom_sort_arrayref ($type_instances,
3134 [qw(paging blocked zombies stopped running sleeping)]);
3136 for (@$type_instances)
3137 {
3138 my $inst = $_;
3139 my $file = '';
3140 my $title = $opts->{'title'};
3142 for (@DataDirs)
3143 {
3144 if (-e "$_/$title-$inst.rrd")
3145 {
3146 $file = "$_/$title-$inst.rrd";
3147 last;
3148 }
3149 }
3150 confess ("No file found for $title") if ($file eq '');
3152 push (@$sources,
3153 {
3154 name => ucfirst ($inst),
3155 file => $file
3156 }
3157 );
3158 } # for (@$type_instances)
3160 return (meta_graph_generic_stack ($opts, $sources));
3161 } # meta_graph_ps_state
3163 sub meta_graph_swap
3164 {
3165 confess ("Wrong number of arguments") if (@_ != 5);
3167 my $host = shift;
3168 my $plugin = shift;
3169 my $plugin_instance = shift;
3170 my $type = shift;
3171 my $type_instances = shift;
3173 my $opts = {};
3174 my $sources = [];
3176 $opts->{'title'} = "$host/$plugin"
3177 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3178 $opts->{'number_format'} = '%5.1lf%s';
3179 $opts->{'rrd_opts'} = ['-v', 'Bytes'];
3181 my @files = ();
3183 $opts->{'colors'} =
3184 {
3185 'Free' => '00e000',
3186 'Cached' => '0000ff',
3187 'Reserved' => 'ffb000',
3188 'Used' => 'ff0000'
3189 };
3191 _custom_sort_arrayref ($type_instances,
3192 [qw(free cached reserved used)]);
3194 for (@$type_instances)
3195 {
3196 my $inst = $_;
3197 my $file = '';
3198 my $title = $opts->{'title'};
3200 for (@DataDirs)
3201 {
3202 if (-e "$_/$title-$inst.rrd")
3203 {
3204 $file = "$_/$title-$inst.rrd";
3205 last;
3206 }
3207 }
3208 confess ("No file found for $title") if ($file eq '');
3210 push (@$sources,
3211 {
3212 name => ucfirst ($inst),
3213 file => $file
3214 }
3215 );
3216 } # for (@$type_instances)
3218 return (meta_graph_generic_stack ($opts, $sources));
3219 } # meta_graph_swap
3221 sub meta_graph_tcp_connections
3222 {
3223 confess ("Wrong number of arguments") if (@_ != 5);
3225 my $host = shift;
3226 my $plugin = shift;
3227 my $plugin_instance = shift;
3228 my $type = shift;
3229 my $type_instances = shift;
3231 my $opts = {};
3232 my $sources = [];
3234 $opts->{'title'} = "$host/$plugin"
3235 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3236 $opts->{'number_format'} = '%6.2lf';
3238 $opts->{'rrd_opts'} = ['-v', 'Connections'];
3240 my @files = ();
3242 $opts->{'colors'} =
3243 {
3244 ESTABLISHED => '00e000',
3245 SYN_SENT => '00e0ff',
3246 SYN_RECV => '00e0a0',
3247 FIN_WAIT1 => 'f000f0',
3248 FIN_WAIT2 => 'f000a0',
3249 TIME_WAIT => 'ffb000',
3250 CLOSE => '0000f0',
3251 CLOSE_WAIT => '0000a0',
3252 LAST_ACK => '000080',
3253 LISTEN => 'ff0000',
3254 CLOSING => '000000'
3255 };
3257 _custom_sort_arrayref ($type_instances,
3258 [reverse qw(ESTABLISHED SYN_SENT SYN_RECV FIN_WAIT1 FIN_WAIT2 TIME_WAIT CLOSE
3259 CLOSE_WAIT LAST_ACK CLOSING LISTEN)]);
3261 for (@$type_instances)
3262 {
3263 my $inst = $_;
3264 my $file = '';
3265 my $title = $opts->{'title'};
3267 for (@DataDirs)
3268 {
3269 if (-e "$_/$title-$inst.rrd")
3270 {
3271 $file = "$_/$title-$inst.rrd";
3272 last;
3273 }
3274 }
3275 confess ("No file found for $title") if ($file eq '');
3277 push (@$sources,
3278 {
3279 name => $inst,
3280 file => $file
3281 }
3282 );
3283 } # for (@$type_instances)
3285 return (meta_graph_generic_stack ($opts, $sources));
3286 } # meta_graph_tcp_connections
3288 sub meta_graph_vmpage_number
3289 {
3290 confess ("Wrong number of arguments") if (@_ != 5);
3292 my $host = shift;
3293 my $plugin = shift;
3294 my $plugin_instance = shift;
3295 my $type = shift;
3296 my $type_instances = shift;
3298 my $opts = {};
3299 my $sources = [];
3301 $opts->{'title'} = "$host/$plugin"
3302 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3303 $opts->{'number_format'} = '%6.2lf';
3305 $opts->{'rrd_opts'} = ['-v', 'Pages'];
3307 my @files = ();
3309 $opts->{'colors'} =
3310 {
3311 anon_pages => '00e000',
3312 bounce => '00e0ff',
3313 dirty => '00e0a0',
3314 file_pages => 'f000f0',
3315 mapped => 'f000a0',
3316 page_table_pages => 'ffb000',
3317 slab => '0000f0',
3318 unstable => '0000a0',
3319 writeback => 'ff0000',
3320 };
3322 _custom_sort_arrayref ($type_instances,
3323 [reverse qw(anon_pages bounce dirty file_pages mapped page_table_pages slab unstable writeback)]);
3325 for (@$type_instances)
3326 {
3327 my $inst = $_;
3328 my $file = '';
3329 my $title = $opts->{'title'};
3331 for (@DataDirs)
3332 {
3333 if (-e "$_/$title-$inst.rrd")
3334 {
3335 $file = "$_/$title-$inst.rrd";
3336 last;
3337 }
3338 }
3339 confess ("No file found for $title") if ($file eq '');
3341 push (@$sources,
3342 {
3343 name => $inst,
3344 file => $file
3345 }
3346 );
3347 } # for (@$type_instances)
3349 return (meta_graph_generic_stack ($opts, $sources));
3350 } # meta_graph_vmpage_number
3352 sub meta_graph_vmpage_action
3353 {
3354 confess ("Wrong number of arguments") if (@_ != 5);
3356 my $host = shift;
3357 my $plugin = shift;
3358 my $plugin_instance = shift;
3359 my $type = shift;
3360 my $type_instances = shift;
3362 my $opts = {};
3363 my $sources = [];
3365 $opts->{'title'} = "$host/$plugin"
3366 . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
3367 $opts->{'number_format'} = '%6.2lf';
3369 $opts->{'rrd_opts'} = ['-v', 'Pages'];
3371 my @files = ();
3373 $opts->{'colors'} =
3374 {
3375 activate => '00e000',
3376 deactivate => '00e0ff',
3377 free => '00e0a0',
3378 alloc => 'f000f0',
3379 refill => 'f000a0',
3380 scan_direct => 'ffb000',
3381 scan_kswapd => '0000f0',
3382 steal => '0000a0',
3383 };
3385 _custom_sort_arrayref ($type_instances,
3386 [reverse qw(activate deactivate alloc free refill scan_direct scan_kswapd steal)]);
3388 for (@$type_instances)
3389 {
3390 my $inst = $_;
3391 my $file = '';
3392 my $title = $opts->{'title'};
3394 for (@DataDirs)
3395 {
3396 if (-e "$_/$title-$inst.rrd")
3397 {
3398 $file = "$_/$title-$inst.rrd";
3399 last;
3400 }
3401 }
3402 confess ("No file found for $title") if ($file eq '');
3404 push (@$sources,
3405 {
3406 name => $inst,
3407 file => $file
3408 }
3409 );
3410 } # for (@$type_instances)
3412 return (meta_graph_generic_stack ($opts, $sources));
3413 } # meta_graph_vmpage_action
3414 # vim: shiftwidth=2:softtabstop=2:tabstop=8