[mrtg] Re: CPU monitoring

Neil Calvert ncalvert at cabletron.com
Fri Nov 19 15:29:57 MET 1999


What error message do you get from MRTG? Perhaps it doesn't like the
format of the uptime output..

Neil
-----Original Message-----
From: Daniel Curry <dcurry at dollar.com>
To: 'mrtg' <mrtg at list.ee.ethz.ch>
Date: Friday, November 19, 1999 9:18 AM
Subject: [mrtg] CPU monitoring


>Thanks to everyone that helped me get the Disk monitoring working.  My
>management is VERY pleased with the kind of quality support available
>for Open Source software.
>
>But, I am still having problems with the cpuinfo.pl script.
>
>Here is a manual run:
>
>[dcurry at neon run]$ ./cpuinfo.pl
>49
>47
>up 43 days, 12:26, 49 users,
>viper
>[dcurry at neon run]$
>
>Here is the excerpt from mrtg.cfg file:
>
>Target[viper.cpu]: `/home/dcurry/mrtg-2.8.9/run/cpuinfo.pl`
>MaxBytes[viper.cpu]: 100
>Options[viper.cpu]: nopercent
>Unscaled[viper.cpu]: dwym
>YLegend[viper.cpu]: % of CPU used
>ShortLegend[viper.cpu]: %
>LegendO[viper.cpu]: &nbsp;CPU System:
>LegendI[viper.cpu]: &nbsp;CPU User:
>Title[viper.cpu]: Machine name
>PageTop[viper.cpu]: <H1>CPU usage for Machine name
> </H1>
> <TABLE>
>   <TR><TD>System:</TD><TD>Machine name</TD></TR>
> </TABLE>
>
>Here is the actual script ( just the portion I modified to support
>digital unix 4.0d):
>
>sub digital
>  {
>   # Run commands
>   $getcpu = `rsh $machine "sar -u 1 10 | grep Average"`;
>   $getuptime = `rsh $machine "uptime"`;
>
>   # Parse though getcpu and get data
>   $getcpu =~ s/^[ \t]+\n$//;
>#   print $getcpu;
>   @gotcpu = split(/      /, $getcpu);
>   @gotcpu[1] =~ s/^[ \t]+//;
>   $getcpuusr = @gotcpu[1];
>   $getcpusys = @gotcpu[4];
>
>   # Print getcpu data for mrtg
>   print $getcpuusr."\n";
>   print $getcpusys;
>
>   # Parse though getuptime and get data
>   $getuptime =~ /^\s+(\d{1,2}:\d{2}..)\s+up\s+(\d+)\s+(\w+),/;
>   $getuptime =~ s/^[ \t]+//;
>   @gotuptime = split(/  /, $getuptime);
>
>   # Print getuptime data for mrtg
>   print @gotuptime[1]." ". at gotuptime[2]."\n";
>
>   # Print machine name for mrtg
>   print $machine."\n";
>
>  }
>
>--
>* To unsubscribe from the mrtg mailing list, send a message with the
>  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
>* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
>

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list