Salut!
am un fisier "connections.pl" care contine:
#uptimestuff
$uptime = `uptime`;
$uptime =~ /up (.*?) day/;
$up = int($1);
$sshcount = 0;
$telcount = 0;
foreach $_ (`netstat -n| grep -v "Proto"`) { # grab df table
($proto, $rque, $sque, $local, $remote, $state) = split(/\s+/);
#edit this number!-------------------->
if ($proto eq 'tcp') {
#print "TCP $_";
$sshcount++;
next;
} elsif ( $proto eq 'unix') {
#edit this number!------------------------>
#print "UDP $_";
$telcount++;
next;
}
}
print "$sshcount\n";
print "$telcount\n";
l-am integrat in mrtg.cfg
Target[active-net-conn]: `/etc/mrtg/connections.pl`
MaxBytes[active-net-conn]: 32768
Title[active-net-conn]: localhost Active Connections
PageTop[active-net-conn]: localhost Active Connections
Options[active-net-conn]: gauge, growright
Legend1[active-net-conn]: TCP Connections
Legend2[active-net-conn]: UDP Connections
LegendI[active-net-conn]: TCP Connections
LegendO[active-net-conn]: UDP Connections
YLegend[active-net-conn]: Active Connections
ls -al /etc/mrtg/connections.pl
-rwx------ 1 root root 1370 Jul 20 2001 /etc/mrtg/connections.pl
la comanda:
/usr/bin/mrtg /etc/mrtg/mrtg.cfg
primesc:
": No such file or directory
WARNING: Could not get any data from external command '/etc/mrtg/connections.pl'
Maybe the external command did not even start. (Illegal seek)
WARNING: Problem with External get '/etc/mrtg/connections.pl':
Expected a Number for 'in' but nothing'
WARNING: Problem with External get '/etc/mrtg/connections.pl':
Expected a Number for 'out' but nothing'
ERROR: Target[active-net-conn][_IN_] ' $target->[11]{$mode} ' did not
eval into defined data
ERROR: Target[active-net-conn][_OUT_] ' $target->[11]{$mode} ' did not
eval into defined data
Ce este in neregula?
Multumesc!
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug