setting capture snmp ato mrtg dari HTB:
1.pertama setting htbnya file dengan nama eth0-2:7400.plasma
root@bw-manager-backup:/etc/htb# cat eth0-2:7400.plasma
RATE=32kbit
RULE=202.146.34.240/28
2.edit snmpd.conf
exec .1.3.6.1.4.1.2021.332 trafik /sbin/tc_snmp.pl 1:7400
isi dari tc_snmp.pl
#!/usr/bin/perl
use Time::HiRes qw(gettimeofday usleep);
$arg{sleep} = "0" ;
foreach my $arg (@ARGV) {
@split = split ( "=", $arg) ;
if ( $split[1] eq "" ) {
}
$arg{$split[0]} = $split[1] ;
$param = $arg ;
}
main () ;
sub main {
$arg{dev} = "eth0" ;
my %acc = get_counters () ;
foreach $key (keys(%acc)) {
if ( $key eq $param )
{
print "$acc{$key}{Sent}\n" ;
}
}
$arg{dev} = "eth1" ;
my %acc = get_counters () ;
foreach $key (keys(%acc)) {
if ( $key eq $param )
{
print "$acc{$key}{Sent}\n" ;
print "$key\n" ;
}
}
}
sub get_counters {
my %ACC ;
my @class = `tc -s -d class show dev $arg{dev}` ; # Get all class info
foreach my $ele (@class) {
chomp ($ele) ;
my @temp = split(" ",$ele) ;
my $i = 0 ;
foreach my $temp (@temp) {
$i ++ ;
if ( $temp eq "htb" ) {
$classid = $temp[$i] ;
} elsif ( $temp =~ /\d/ ) {
#print "classid $classid $name $temp\n" ;
$ACC{$classid}{$name} = $temp ;
} else {
$temp =~ s/://g ;
$temp =~ s/\(//g ;
$name = $temp ;
}
}
}
usleep ($arg{sleep}) ;
return %ACC ;
}
3.restart service snmpd nya
/etc/init.d/snmpd restart
4.setting mrtg.cfgnya
Target[tanjungduren]: .1.3.6.1.4.1.2021.488.101.1&.1
.3.6.1.4.1.2021.488.101.2:
bridg3@202.78.192.164
Options[tanjungduren]: nopercent,growright, bits
Title[tanjungduren]: Billy-Tanjungduren
MaxBytes[tanjungduren]: 1250000
LegendI[tanjungduren]: Traffic in
LegendO[tanjungduren]: Traffic out
PageTop[tanjungduren]:
Tanjungduren
#
#
#
#
#
#
#
#
System: | Router in DTP - 5th Floor |
Maintainer: | support@dtp.net.id |
Description: | FastEthernet0/4 |
ifType: | ethernetCsmacd (6) |
ifName: | Fa0/4 |
Bandwidth: | 16 Kbps Up + 48 Kbps downlink (trial) |
Connection: | Router backbone - Switch IDC |
IP ptp: | 202.43.166.208/30 |
Downlink : Rate=16kbit Ceil=24kbit | Uplink : Rate=4kbit,Ceil=8kbit |
beres dech
Tidak ada komentar:
Posting Komentar
Komentarnya mana