Here is my hacked protoUsage.pl, please note that I have also changed
some of the protocols from the original so it might not meet your needs,
but at least you can see how I made the changes (also, since I fixed my
protocols.list, I no need to use this hack).
Good Luck,
Wally
[EMAIL PROTECTED] wrote:
>
>>
>> Another solution is to edit all of the protocal in protoUsage.pl. For
>> example, instead of {'NBios-IP'} use {"\nNBios-IP"}. It's a little
>> tedious to edit protoUsage.pl, but it does work.
>>
>
>
> Hi,
>
> In which line i can do it?
> If you can, please send the protoUsage.pl file
>
> Thanks
>
#!/usr/bin/perl
#makes things work when run without install
# use lib qw( ../perl-shared/blib/lib ../perl-shared/blib/arch );
#makes programm work AFTER install
use lib qw( /usr/local/rrdtool-1.0.28/lib/perl ../lib/perl );
use RRDs;
use LWP::Simple; # Part of libwww (see http://www.cpan.org)
#############
$ntopHost = "localhost.localdomain"; # Host where ntop is running
$ntopPort = 3000; # Port where ntop is listening for HTTP connections
$if = "eth0"; # Interface to monitor
$url =
"http://".$ntopHost.":".$ntopPort."/dumpTrafficData.html?language=perl&key=$if";
$sleepTime = 10;
#############
$start = time;
$name = "protoUsage";
$rrd = $name.".rrd";
#############
if(!(-e $rrd)) {
RRDs::create ($rrd, "--start",$start-1, "--step",300,
"DS:cisco:COUNTER:600:0:U",
"DS:dns:COUNTER:600:0:U",
"DS:VNC:COUNTER:600:0:U",
"DS:Email:COUNTER:600:0:U",
"DS:NetBIOS:COUNTER:600:0:U",
"DS:SNMP:COUNTER:600:0:U",
"DS:Proxy:COUNTER:600:0:U",
"RRA:AVERAGE:0.5:1:600",
"RRA:AVERAGE:0.5:6:700",
"RRA:AVERAGE:0.5:24:775",
"RRA:MAX:0.5:1:600",
"RRA:MAX:0.5:6:700",
"RRA:MAX:0.5:24:775"
);
$ERROR = RRDs::error;
die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
}
while(1) {
$content = get($url);
if($content ne "") {
eval($content);
$a =
$ntopHash{$if}{IP}{"\nCISCO"}{local}+$ntopHash{$if}{IP}{"\nCISCO"}{local2remote}+$ntopHash{$if}{IP}{"\nCISCO"}{remote2local}+$ntopHash{$if}{IP}{"\nCISCO"}{remote};
$b =
$ntopHash{$if}{IP}{"\nDNS"}{local}+$ntopHash{$if}{IP}{"\nDNS"}{local2remote}+$ntopHash{$if}{IP}{"\nDNS"}{remote2local}+$ntopHash{$if}{IP}{"\nDNS"}{remote};
$c =
$ntopHash{$if}{IP}{"\nVNC"}{local}+$ntopHash{$if}{IP}{"\nVNC"}{local2remote}+$ntopHash{$if}{IP}{"\nVNC"}{remote2local}+$ntopHash{$if}{IP}{"\nVNC"}{remote};
$d =
$ntopHash{$if}{IP}{"\nMail"}{local}+$ntopHash{$if}{IP}{"\nMail"}{local2remote}+$ntopHash{$if}{IP}{"\nMail"}{remote2local}+$ntopHash{$if}{IP}{"\nMail"}{remote};
$e =
$ntopHash{$if}{IP}{"\nNBios-IP"}{local}+$ntopHash{$if}{IP}{"\nNBios-IP"}{local2remote}+$ntopHash{$if}{IP}{"\nNBios-IP"}{remote2local}+$ntopHash{$if}{IP}{"\nNBios-IP"}{remote};
$f =
$ntopHash{$if}{IP}{"\nSNMP"}{local}+$ntopHash{$if}{IP}{"\nSNMP"}{local2remote}+$ntopHash{$if}{IP}{"\nSNMP"}{remote2local}+$ntopHash{$if}{IP}{"\nSNMP"}{remote};
$g =
$ntopHash{$if}{IP}{"\nPROXY"}{local}+$ntopHash{$if}{IP}{"\nPROXY"}{local2remote}+$ntopHash{$if}{IP}{"\nPROXY"}{remote2local}+$ntopHash{$if}{IP}{"\nPROXY"}{remote};
$value = $start.":".$a.":".$b.":".$c.":".$d.":".$e.":".$f.":".$g;
print $value."\n";
RRDs::update $rrd, $value;
if ($ERROR = RRDs::error) {
die "$0: unable to update `$rrd': $ERROR\n";
}
}
RRDs::graph "$name.png",
"--title", "IP Traffic Statistics for ".$if,
"--start", "now-1h",
"--end", "now",
"--lower-limit=.1",
# "--interlace",
"--imgformat","PNG",
"--logarithmic",
"--height=250",
"--width=600",
"--vertical-label","Throughtput (Bytes/sec)",
"DEF:a=$rrd:cisco:AVERAGE",
"DEF:b=$rrd:dns:AVERAGE",
"DEF:c=$rrd:VNC:AVERAGE",
"DEF:d=$rrd:Email:AVERAGE",
"DEF:e=$rrd:NetBIOS:AVERAGE",
"DEF:f=$rrd:SNMP:AVERAGE",
"DEF:g=$rrd:Proxy:AVERAGE",
"AREA:a#FF0000: CISCO ",
"GPRINT:a:LAST:Current \\: %8.2lf %s",
"GPRINT:a:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:a:MIN:Min \\: %8.2lf %s",
"GPRINT:a:MAX:Max \\: %8.2lf %s\\n",
"STACK:b#00FF00: DNS ",
"GPRINT:b:LAST:Current \\: %8.2lf %s",
"GPRINT:b:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:b:MIN:Min \\: %8.2lf %s",
"GPRINT:b:MAX:Max \\: %8.2lf %s\\n",
"STACK:c#0000FF: VNC ",
"GPRINT:c:LAST:Current \\: %8.2lf %s",
"GPRINT:c:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:c:MIN:Min \\: %8.2lf %s",
"GPRINT:c:MAX:Max \\: %8.2lf %s\\n",
"STACK:d#FF00FF: Email ",
"GPRINT:d:LAST:Current \\: %8.2lf %s",
"GPRINT:d:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:d:MIN:Min \\: %8.2lf %s",
"GPRINT:d:MAX:Max \\: %8.2lf %s\\n",
"STACK:e#FFFF00: NetBIOS ",
"GPRINT:e:LAST:Current \\: %8.2lf %s",
"GPRINT:e:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:e:MIN:Min \\: %8.2lf %s",
"GPRINT:e:MAX:Max \\: %8.2lf %s\\n",
"STACK:f#00FFFF: SNMP ",
"GPRINT:f:LAST:Current \\: %8.2lf %s",
"GPRINT:f:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:f:MIN:Min \\: %8.2lf %s",
"GPRINT:f:MAX:Max \\: %8.2lf %s\\n",
"STACK:g#909090: PROXY ",
"GPRINT:g:LAST:Current \\: %8.2lf %s",
"GPRINT:g:AVERAGE:Avg \\: %8.2lf %s",
"GPRINT:g:MIN:Min \\: %8.2lf %s",
"GPRINT:g:MAX:Max \\: %8.2lf %s\\n"
;
if ($ERROR = RRDs::error) {
print "ERROR: $ERROR\n";
};
sleep $sleepTime;
$start = time;
}