Hi!

Az mrtg a cpuinfo-t nem generalja le (a tobbi /eth0/ jo):
WARNING: Problem with External get
'/usr/share/doc/mrtg-2.10.5/contrib/cpuinfo/cpuinfo.pl host245
linux':
   Expected a Number for 'in' but got ''

WARNING: Problem with Externale get
'/usr/share/doc/mrtg-2.10.5/contrib/cpuinfo/cpuinfo.pl host245
linux':
   Expected a Number for 'out' but got ''

ERROR: Target[localhost.cpu][_IN_] ' $target->[1]{$mode} ' did
not eval into defined data
ERROR: Target[localhost.cpu][_OUT_] ' $target->[1]{$mode} ' did
not eval into defined data
WARNING: Skipping Update of localhost.cpu, inlast is not defined
WARNING: Skipping Update of localhost.cpu, outlast is not defined



# /etc/mrtg/mrtg.cfg
WorkDir: /var/www/mrtg
WriteExpires: Yes
RunAsDaemon: Yes

Target[192.168.21.245_2]: 2:[EMAIL PROTECTED]:
SetEnv[192.168.21.245_2]: MRTG_INT_IP="192.168.21.245"
MRTG_INT_DESCR="eth0"
MaxBytes[192.168.21.245_2]: 1250000
Title[192.168.21.245_2]: Traffic Analysis for Server
PageTop[192.168.21.245_2]: <H1>Traffic Analysis for Server</H1>
 <TABLE>
 <TR><TD>System:</TD> <TD>RedHat/Fedora Linux server </TD></TR>
 <TR><TD>Maintainer:</TD> <TD>Root <[EMAIL PROTECTED]> </TD></TR>
 <TR><TD>Description:</TD><TD>eth0 </TD></TR>
 <TR><TD>ifType:</TD> <TD>ethernet</TD></TR>
 <TR><TD>ifName:</TD> <TD> </TD></TR>
 <TR><TD>Max Speed:</TD> <TD>1250.0 kBytes/s</TD></TR>
 <TR><TD>Ip:</TD> <TD>192.168.21.245
(host245.akarmi-domain.hu)</TD></TR>
 </TABLE>

Target[localhost.cpu]:
`/usr/share/doc/mrtg-2.10.5/contrib/cpuinfo/cpuinfo.pl host245 linux`
MaxBytes[localhost.cpu]: 100
Options[localhost.cpu]: gauge, nopercent
Unscaled[localhost.cpu]: dwym
YLegend[localhost.cpu]: % of CPU used
ShortLegend[localhost.cpu]: %
LegendO[localhost.cpu]: &nbsp;CPU System:
LegendI[localhost.cpu]: &nbsp;CPU User:
Title[localhost.cpu]: localhost.cpu name
PageTop[localhost.cpu]: <H1>CPU usage for localhost.cpu name</H1>
 <TABLE>
 <TR><TD>System:</TD> <TD>GNU/LiNUX</TD></TR>
 <TR><TD>Maintainer:</TD> <TD>System administrator</TD></TR>
 <TR><TD>Description:</TD><TD>Intel P4 2.6GHz</TD></TR>
 <TR><TD>Ip:</TD> <TD>host245 (redhat/fedora)</TD></TR>
 </TABLE>



#!/usr/bin/perl
# cpuinfo.pl
#
# setup local vars
my($machine, $os);

#
============================================================================
# == Enter your rsh program here here ==

$rsh = "/usr/local/bin/ssh -x";         # Enter your rsh command here

# == You shouldn't need to edit anything below this line ==
#========================================================

# This checks for options passed cpuinfo.pl from the cmd line
if (scalar(@ARGV) < 2)
   {
   print("USAGE: cpuinfo.pl {machine} {os}\n");
   exit(-1);
   }

if ($ARGV[0] ne '' && $ARGV[0] ne '#')
   {
   $machine = $ARGV[0];
   }

if ($ARGV[1] ne '' && $ARGV[1] ne '#')
   {
   $os = $ARGV[1];
   }

# Validate the os
SWITCH:
{
  if ($os =~ /^sun$/){last SWITCH;}
  if ($os =~ /^linux$/){last SWITCH;}

  # DEFAULT: Die if we can't figure out what the os is
  die "Can't figure out which OS the machine is.\n";
}

# Execute the appropriate subroutine based on the os
&$os;

exit(0);

#=======================================================
# Subroutines: names of subroutines are supported OSs.
#========================================================
sub sun
  {

   # Run commands
   if ($machine =~ 'localhost')
   {
   $getcpu = `sar -u 1 10 | grep Average`;
   $getuptime = `uptime`;
   }
   else
   {
   $getcpu = `$rsh $machine "sar -u 1 10" | grep Average`;
   $getuptime = `$rsh $machine "uptime"`;
   }

   # Parse though getcpu and get data
   $getcpu =~ /^Average\s+(\d+)\s+(\d+)\s+/;
   $outputusr = $1;
   $outputsys = $2;

   # Print getcpu data for mrtg
   print $outputusr."\n";
   print $outputsys."\n";

   # Parse though getuptime and get data
   $getuptime =~ /^\s+\d{1,2}:\d{2}..\s+up\s+(\d+)\s+(......),/;

   # Print getuptime data for mrtg
   print $1." ".$2."\n";

   # Print machine name for mrtg
   print $machine."\n";

  }

sub linux
  {
   # Run commands
   if ($machine =~ 'localhost')
   {
   $getcpu = `/usr/local/bin/sar -u 1 10 | grep Average`;
   $getuptime = `/usr/bin/uptime`;
   }
   else
   {
   $getcpu = `$rsh $machine "/usr/local/bin/sar -u 1 10 | grep
Average"`;
   $getuptime = `$rsh $machine "/usr/bin/uptime"`;
   }

   # Parse though getcpu and get data
   $getcpu =~
/^Average:\s+all\s+(\d+)\.\d+\s+\d+\.\d+\s+(\d+)\.\d+\s+\d+\.\d+/;
   $getcpuusr = $1;
   $getcpusys = $2;

   # Print getcpu data for mrtg
   print $getcpuusr."\n";
   print $getcpusys."\n";

   # Parse though getuptime and get data
   $getuptime =~ /^\s+\d{1,2}:\d{2}..\s+up\s+(\d+)\s+(\w+),/;

   # Print getuptime data for mrtg
   print $1." ".$2."\n";

   # Print machine name for mrtg
   print $machine."\n";

  }
exit(0);



Bocs a hosszu levelert! De talan igy egyertelmu!!
Szoval melyik adat nem jo a scriptnek? Valamit nem allitottam be, de mit? :)

Gabor



_________________________________________________
linux lista      -      [email protected]
http://mlf2.linux.rulez.org/mailman/listinfo/linux

válasz