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.2 by ats, Thu Aug 28 21:21:32 2003 UTC vs.
Revision 1.7 by ats, Tue Aug 10 19:13:07 2004 UTC

# Line 1 | Line 1
1   #!/usr/bin/perl -w
2 < # i-scream central monitoring system
2 > # i-scream libstatgrab
3   # http://www.i-scream.org
4 < # Copyright (C) 2000-2003 i-scream
4 > # Copyright (C) 2000-2004 i-scream
5   #
6   # This program is free software; you can redistribute it and/or
7   # modify it under the terms of the GNU General Public License
# Line 16 | Line 16
16   # You should have received a copy of the GNU General Public License
17   # along with this program; if not, write to the Free Software
18   # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + #
20 + # $Id$
21  
22   use strict;
23   use Getopt::Long;
# Line 30 | Line 32 | my $mib = $kib * $kib;
32   # Type 0 is plain integers.
33   my $KIBIBYTES = 1;
34   my $PERCENT = 2;
35 + my $FLOAT = 3;
36  
37   # Print an entry in the MRTG config file.
38   sub entry ($$$$$$$$$$) {
# Line 40 | Line 43 | sub entry ($$$$$$$$$$) {
43          $options .= " gauge" if $gauge;
44          my $sgoptions = "";
45          $sgoptions .= " -o -p" if $type == $PERCENT;
46 +        $sgoptions .= " -f 1000" if $type == $FLOAT;
47  
48          print "\n";
49          print "Title[$name]: $title\n";
# Line 51 | Line 55 | sub entry ($$$$$$$$$$) {
55          print "LegendO[$name]: $legendo\n" if defined $valo;
56          if ($type == $KIBIBYTES) {
57                  print "kMG[$name]: Ki,Mi,Gi,Ti\n";
58 +                $sgoptions .= " -K";
59          }
60          $valo = "const.0" unless defined $valo;
61          print "Options[$name]:$options\n" if $options ne "";
# Line 129 | Line 134 | sub main () {
134  
135          foreach my $disk (sort keys %disks) {
136                  my $name = $stats{"disk.$disk.disk_name"};
137 <                entry("Disk $name IO", "disk.$disk.read_bytes", "disk.$disk.write_bytes", 100*$mib, "IO rate", "B/s", "read", "write", 0, 0);
137 >                entry("Disk $name IO", "disk.$disk.read_bytes", "disk.$disk.write_bytes", 100*$mib, "IO rate", "KiB/s", "read", "write", 0, $KIBIBYTES);
138          }
139  
140          foreach my $fs (sort keys %fss) {
141                  my $name = $stats{"fs.$fs.mnt_point"};
142                  my $size = $stats{"fs.$fs.size"};
143                  my $inodes = $stats{"fs.$fs.total_inodes"};
144 <                entry("Filesystem $name space usage", "fs.$fs.used", undef, $size, "Space used", "B", "used", undef, 1, 0);
144 >                entry("Filesystem $name space usage", "fs.$fs.used", undef, $size, "Space used", "KiB", "used", undef, 1, $KIBIBYTES);
145                  entry("Filesystem $name inode usage", "fs.$fs.used_inodes", undef, $inodes, "Inodes used", "inodes", "used", undef, 1, 0);
146          }
147  
148          if (exists $toplevel{"load"}) {
149 <                entry("Load average over 1 minute", "load.min1", undef, 100, "Load average", "running", "load", undef, 1, 0);
150 <                entry("Load average over 5 minutes", "load.min5", undef, 100, "Load average", "running", "load", undef, 1, 0);
151 <                entry("Load average over 15 minutes", "load.min15", undef, 100, "Load average", "running", "load", undef, 1, 0);
149 >                entry("Load average over 1 minute", "load.min1", undef, 100, "Load average", "running * 1000", "load", undef, 1, $FLOAT);
150 >                entry("Load average over 5 minutes", "load.min5", undef, 100, "Load average", "running * 1000", "load", undef, 1, $FLOAT);
151 >                entry("Load average over 15 minutes", "load.min15", undef, 100, "Load average", "running * 1000", "load", undef, 1, $FLOAT);
152          }
153  
154          if (exists $toplevel{"mem"}) {
155                  my $total = $stats{"mem.total"};
156 <                entry("Memory usage", "mem.used", "mem.cache", $total, "Memory usage", "B", "total", "cache", 1, 0);
156 >                entry("Memory usage", "mem.used", "mem.cache", $total, "Memory usage", "KiB", "total", "cache", 1, $KIBIBYTES);
157          }
158  
159          foreach my $net (sort keys %nets) {
160                  my $name = $stats{"net.$net.interface_name"};
161 <                # FIXME should be able to discover interface speed
162 <                entry("Network interface $name IO", "net.$net.rx", "net.$net.tx", 100*$mib, "Network IO", "B", "rx", "tx", 0, 0);
161 >                my $speed = int($stats{"net.$net.speed"});
162 >                $speed = 100 if $speed == 0;
163 >                entry("Network interface $name IO", "net.$net.rx", "net.$net.tx", $speed*$mib, "Network IO", "KiB/s", "rx", "tx", 0, $KIBIBYTES);
164          }
165  
166          if (exists $toplevel{"page"}) {
# Line 174 | Line 180 | sub main () {
180  
181          if (exists $toplevel{"swap"}) {
182                  my $swapsize = $stats{"swap.total"};
183 <                entry("Swap usage", "swap.used", undef, $swapsize, "Swap usage", "B", "used", undef, 1, 0);
183 >                entry("Swap usage", "swap.used", undef, $swapsize, "Swap usage", "KiB", "used", undef, 1, $KIBIBYTES);
184          }
185  
186          if (exists $toplevel{"user"}) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines