mrtg (mereni prenesenych dat)
Jakub Dadak
dadman na brainsys.cz
Pondělí Květen 31 15:16:45 CEST 1999
>> byty nejakym prumernym poctem bytu na paket, ktere se v snmpd
>> scitaji. Existoval patch, ktery do snmpd pridal korektni
>> scitani prenesenych bytu primo pres ipfwadm pravidla. Ja jsem si pozdeji
>jednotlive interface mi uplne staci
>mohl by jste zhruba nasmerovat kde roste patch
To je trosku problem, mam to na asi dost starou verzi cmu-snmpd 3.5.
Jde o to upravit rutinu l_get_acctstat, ktera nacita patricne hodnoty
bytu. Posilam alespon tuto rutinu, kterou zmenite a melo by to jet.
Zkousel jsem to zhruba pred rokem snad se kod uvnitr cmu-snmpd prilis
nezmenil. Zkuste kdyztak napsat primo autoroci cmu-snmpd, svuj patch
jsem mu posilal, treba jej nekde ma :-)
JD
--
,{(~)~(}, Dadak Jakub Brain Systems s.r.o.
,( ((~) ){){} dadman na brainsys.cz Rybkova 1, Brno 602 00
())~{)}{{}~()} http://www.dadak.cz http://www.brainsys.cz
`~^ ^~{()} Tel. +420 5 41148704 Fax. +420 5 41148852
~~ Motto: Things are different !
upravit soubor apps/snmp_vars.c nekde kolem radku 4000 ve verzi 3.5
/*
* lookup accounting rules for traffic through a specific interface,
* without other restriction.
* any interface statistics found in th accounting table are used.
*/
static void
l_get_acctstat ()
{
int f = 0, g = 0;
char fullname [80], target[10];
FILE *acct;
if ((acct = fopen("/proc/net/ip_fwchains", "r"))) {
unsigned long pkt_in, oct_in, pkt_out, oct_out, proto;
int result, flags;
while (f == 0 || g == 0) {
unsigned int saddr, smask, daddr, dmask, proto;
fullname [0] = 0;
result = fscanf(acct,
*/
static void
l_get_acctstat ()
{
int f = 0, g = 0;
char fullname [80], target[10];
FILE *acct;
if ((acct = fopen("/proc/net/ip_fwchains", "r"))) {
unsigned long pkt_in, oct_in, pkt_out, oct_out, proto;
int result, flags;
while (f == 0 || g == 0) {
unsigned int saddr, smask, daddr, dmask, proto;
fullname [0] = 0;
result = fscanf(acct,
"%9s " // Chain name
"%08lX/%08lX->%08lX/%08lX " // Source & Destination IPs
"%*16s " // Interface
"%*lu %*lu " // fw_flg and fw_invflg fields
"%u " // Protocol
"%u %u %u %u " // Packet & byte counters
"%*u-%*u %*u-%*u " // Source & Dest port ranges
"A%*02X X%*02X " // TOS and and xor masks
"%*08X " // Redirection port
"%*u " // fw_mark field
"%*u " // output size
"%9s\n", // Target
fullname,
&saddr, &smask,
&daddr, &dmask,
&proto,
&pkt_in, &pkt_out, &oct_in, &oct_out, target);
if ( result != 11 ) {
break;
}
if (! saddr && ! smask && ! daddr && ! dmask) {
struct ifnet *ifn;
char tmpstr[100];
for (ifn = ifnetaddr_list; ifn; ifn = ifn->if_next) {
sprintf(tmpstr, "%s-in", ifn->if_name);
if (!strcmp (tmpstr, target)) {
ifn->if_ipackets = pkt_out;
ifn->if_ibytes = oct_out;
break;
}
sprintf(tmpstr, "%s-out", ifn->if_name);
if (!strcmp (tmpstr, target)) {
ifn->if_opackets = pkt_out;
ifn->if_obytes = oct_out;
break;
}
}
}
}
fclose(acct);
}
}
#endif /* linux */
Další informace o konferenci Linux