ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/statgrab/statgrab-make-mrtg-config.in
(Generate patch)

Comparing projects/libstatgrab/src/statgrab/statgrab-make-mrtg-config.in (file contents):
Revision 1.1 by ats, Thu Aug 28 11:26:42 2003 UTC vs.
Revision 1.2 by ats, Thu Aug 28 21:21:32 2003 UTC

# Line 27 | Line 27 | my $workdir = undef;
27   my $kib = 1024;
28   my $mib = $kib * $kib;
29  
30 + # Type 0 is plain integers.
31 + my $KIBIBYTES = 1;
32 + my $PERCENT = 2;
33 +
34   # Print an entry in the MRTG config file.
35   sub entry ($$$$$$$$$$) {
36 <        my ($title, $vali, $valo, $max, $ylegend, $yunit, $legendi, $legendo, $gauge, $in_kib) = @_;
36 >        my ($title, $vali, $valo, $max, $ylegend, $yunit, $legendi, $legendo, $gauge, $type) = @_;
37          my $name = $vali;
38          my $options = "";
39          $options .= " noo" unless defined $valo;
40          $options .= " gauge" if $gauge;
41 +        my $sgoptions = "";
42 +        $sgoptions .= " -o -p" if $type == $PERCENT;
43  
44          print "\n";
45          print "Title[$name]: $title\n";
# Line 43 | Line 49 | sub entry ($$$$$$$$$$) {
49          print "ShortLegend[$name]: $yunit\n";
50          print "LegendI[$name]: $legendi\n";
51          print "LegendO[$name]: $legendo\n" if defined $valo;
52 <        if ($in_kib) {
52 >        if ($type == $KIBIBYTES) {
53                  print "kMG[$name]: Ki,Mi,Gi,Ti\n";
54          }
55          $valo = "const.0" unless defined $valo;
56          print "Options[$name]:$options\n" if $options ne "";
57 <        print "Target[$name]: `$statgrab -p -m $vali $valo`\n";
57 >        print "Target[$name]: `$statgrab$sgoptions -m $vali $valo`\n";
58   }
59  
60   my $package_version = '@PACKAGE_VERSION@';
# Line 113 | Line 119 | sub main () {
119          }
120  
121          if (exists $toplevel{"cpu"}) {
122 <                entry("CPU idle", "cpu.idle", undef, "100", "Idle", "%", "idle", undef, 1, 0);
123 <                entry("CPU iowait", "cpu.iowait", undef, "100", "iowait", "%", "iowait", undef, 1, 0);
124 <                entry("CPU kernel", "cpu.kernel", undef, "100", "Kernel", "%", "kernel", undef, 1, 0);
125 <                entry("CPU nice", "cpu.nice", undef, "100", "Nice", "%", "nice", undef, 1, 0);
126 <                entry("CPU swap", "cpu.swap", undef, "100", "Swap", "%", "swap", undef, 1, 0);
127 <                entry("CPU user", "cpu.user", undef, "100", "User", "%", "user", undef, 1, 0);
122 >                entry("CPU idle", "cpu.idle", undef, "100", "Idle", "%", "idle", undef, 1, $PERCENT);
123 >                entry("CPU iowait", "cpu.iowait", undef, "100", "iowait", "%", "iowait", undef, 1, $PERCENT);
124 >                entry("CPU kernel", "cpu.kernel", undef, "100", "Kernel", "%", "kernel", undef, 1, $PERCENT);
125 >                entry("CPU nice", "cpu.nice", undef, "100", "Nice", "%", "nice", undef, 1, $PERCENT);
126 >                entry("CPU swap", "cpu.swap", undef, "100", "Swap", "%", "swap", undef, 1, $PERCENT);
127 >                entry("CPU user", "cpu.user", undef, "100", "User", "%", "user", undef, 1, $PERCENT);
128          }
129  
130          foreach my $disk (sort keys %disks) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines