Here's what we use. ------- MRTG CONFIG FILE ----- # # FloodCity Modem Racks # # Default Settings WorkDir: /net/www/admin/stats/modems/ Interval: 5 Refresh: 300 AddHead[_]: <link href="modems.css" rel="stylesheet" text="text/css"> Background[_]: #dfdfdf Options[_]: growright, noinfo, gauge Unscaled[_]: dwmy WithPeak[_]: dwmy YLegend[_]:Modem Capacity ShortLegend[_]:Modems Legend1[_]:  Utilization   Legend2[_]:  Capacity   Legend3[_]:  Connections   Legend4[_]:  Capacity   LegendI[_]:  Utilization   LegendO[_]:  Capacity   # JT01 Target[jt01]: `./get_hiper <snmp_read_comm>@<nmc_ip>` MaxBytes[jt01]: 240 Title[jt01]: JT01 PageTop[jt01]: <div align="center"> <table border="1" cellpadding="2" cellspacing="0" width="500"> <tr><td bgcolor="#000080" align="center"><font color="#ffffff" face="'MS Sans Serif',sans-serif"><b>JT01</b>< /font></td></tr> <tr><td bgcolor="#ffffff" align="center"><table border="0"> <tr><td><small>Capacity:</small></td><td><small>240 lines</small></td></tr> </table> </td></tr></table> ----- END MRTG CONFIG FILE ---- ----- get_hiper.pl script ----- #!/usr/bin/perl # dualt1.pl # # # Created by Eric Billeter # returns: # Modems in use (value1) # Chassis capacity (value2) use SNMP_Session; use BER; use Socket; use strict; %snmpget::OIDS = ( 'value1' => '1.3.6.1.4.1.429.1.27.2.1.26', ); my($community,$router) = split /\@/, $ARGV[0]; die <<USAGE unless $community && $router; USAGE: dualt1.pl 'SNMP_community'\@'aaa.bbb.ccc.ddd' Where 'aaa.bbb.ccc.ddd' is the ip address for the Network Management Card. USAGE my($sysName,$sysUptime,$interfaces,$value1,$value2) = snmpgettable($router,$community,'value1'); exit(0); sub snmpgettable{ my($host,$community,$var) = @_; my($next_oid,$enoid,$orig_oid, $response, $bindings, $binding, $value, $inoid,$outoid, $upoid,$oid,@table,$tempo); die "Unknown SNMP var $var\n" unless $snmpget::OIDS{$var}; $orig_oid = encode_oid(split /\./, $snmpget::OIDS{$var}); $enoid=$orig_oid; srand(); my $session = SNMP_Session->open ($host , $community, 161); for(;;) { if ($session->getnext_request_response(($enoid))) { $response = $session->pdu_buffer; ($bindings) = $session->decode_get_response ($response); ($binding,$bindings) = decode_sequence ($bindings); ($next_oid,$value) = decode_by_template ($binding, "%O%@"); # quit once we are outside the table last unless BER::encoded_oid_prefix_p($orig_oid,$next_oid); my $bulkindex = 2; while( $bulkindex < "50" ){ $tempo = substr ($value,$bulkindex,1); $bulkindex=$bulkindex+2; if( ord($tempo) eq '5' or ord($tempo) eq '3' or ord($tempo) eq '22' ){$value1=$value1 + 1 ; } if( ord($tempo) eq '2' or ord($tempo) eq '5' or ord($tempo) eq '3' or ord($tempo) eq '22' ){$value2=$va lue2 + 1 ; } } push @table, $tempo; } else { die "No answer from $ARGV[0]\n"; } $enoid=$next_oid; } $session->close (); if( $value1 eq ''){$value1 = 0 }; if( $value2 eq ''){$value2 = 0 }; print "$value1\n"; print "$value2\n"; return (@table); } ----- end get_hiper.pl script ----- Note: Beware of line wrapping. Hope this helps, Allen
Ok, does anyone have a brief explanation, or example of a config, for using MRTG with a Netserver / Total Control? I would like to monitor the number of modems in use out of the total active ports (which could change from time to time - re-making the config is ok there if I need to), and possibly the total bandwidth usage - either per port, total, or both.
I tried following the example found at the link below, but just got a lot of MRTG errors after playing with various options, and figured someone might just be able to post a snippet of their config file. http://www.dcr.net/~mandrews/usrtoys/mrtg.shtml
I know a tremendous amount of information can be gathered frrom SNMP on these things, I just don't know much about how to do it...
Thanks, -rf
_______________________________________________ USR-TC mailing list USR-TC@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/usr-tc