Guest User

Untitled

a guest
Apr 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.83 KB | None | 0 0
  1. --- collection.modified.cgi.orig 2011-12-06 11:45:36.894194616 +0100
  2. +++ collection.modified.cgi     2011-12-06 12:07:59.524530571 +0100
  3. @@ -3045,6 +3045,7 @@
  4.      $GraphDefs->{'vmpage_io-memory'}    = $GraphDefs->{'vmpage_io'};
  5.      $GraphDefs->{'vmpage_io-swap'}      = $GraphDefs->{'vmpage_io'};
  6.      $MetaGraphDefs->{'cpu'}             = \&meta_graph_cpu;
  7. +    $MetaGraphDefs->{'df_complex'}              = \&meta_graph_df_complex;
  8.      $MetaGraphDefs->{'dns_qtype'}       = \&meta_graph_dns_qtype;
  9.      $MetaGraphDefs->{'dns_rcode'}       = \&meta_graph_dns;
  10.      $MetaGraphDefs->{'if_rx_errors'}    = \&meta_graph_if_rx_errors;
  11. @@ -3304,6 +3305,54 @@
  12.    return (meta_graph_generic_stack ($opts, $sources));
  13.  } # meta_graph_dns
  14.  
  15. +sub meta_graph_df_complex {
  16. +    confess("Wrong number of arguments") if ( @_ != 5 );
  17. +    my $host            = shift;
  18. +    my $plugin          = shift;
  19. +    my $plugin_instance = shift;
  20. +    my $type            = shift;
  21. +    my $type_instances  = shift;
  22. +    my $opts            = {};
  23. +    my $sources         = [];
  24. +    $opts->{'title'} =
  25. +        "$host/$plugin"
  26. +      . ( defined($plugin_instance) ? "-$plugin_instance" : '' )
  27. +      . "/$type";
  28. +    $opts->{'number_format'} = '%5.1lf%s';
  29. +    $opts->{'rrd_opts'} = [ '-b', '1024', '-v', 'Bytes' ];
  30. +
  31. +    my @files = ();
  32. +    $opts->{'colors'} = {
  33. +        'free'      => '00e000',
  34. +        'used'      => 'ff0000',
  35. +        'reserved'  => '0000ff'
  36. +    };
  37. +    _custom_sort_arrayref( $type_instances,
  38. +        [qw(free used reserved)] );
  39. +
  40. +    for (@$type_instances) {
  41. +        my $inst  = $_;
  42. +        my $file  = '';
  43. +        my $title = $opts->{'title'};
  44. +        for (@DataDirs) {
  45. +            if ( -e "$_/$title-$inst.rrd" ) {
  46. +                $file = "$_/$title-$inst.rrd";
  47. +                last;
  48. +            }
  49. +        }
Add Comment
Please, Sign In to add comment