Re: (RADIATOR) TotalControlSNMP
Hi Aaron, On Mar 28, 6:20am, Aaron Nabil wrote: > Subject: RE: (RADIATOR) TotalControlSNMP > > > Here a slightly improved version in that it should work independant of > the card density (quad/hiperdsp) and type (e1/t1). It uses the > session-id instead of the nas-port. Thanks again for the improved code. We have rolled the new version into the code for the next release. BTW, the return value from isOnline* is just tested for truth, so undef/1 would be as good as 0/1 Cheers. > > > # Check Total Control by using SNMP > # > sub isOnlineTotalControlSNMP > { > my ($name, $nas_id, $nas_port, $session_id, $client) = @_; > > return 1 unless &Radius::SNMP::snmpgetprogExists(); > > my $oid = length $session_id; > my $x; > foreach $x (unpack('C*', $session_id)) { > $oid .= ".$x"; > } > > my $result = &Radius::SNMP::snmpget($nas_id, $client->{SNMPCommunity}, > "$Radius::Nas::TCMIB.4.2.1.140.1.2.$oid"); > > # There must be some Important Reason all of these routines return > # 0 or 1 instead of nil or 1, so I'll play along. > return 0+($result =~ /^.*\"([^"]+)".*$/ && $1 eq $name); > } > > > > > > On Tue, 28 Mar 2000, Aaron Nabil wrote: > > > > > On Tue, 28 Mar 2000, Ingvar Berg (ERA) wrote: > > > > > I assume that 24 is for a T1 line, so with E1 lines it would be 30? > > > /Ingvar > > > > > -- > Aaron Nabil > > > === > Archive at http://www.starport.net/~radiator/ > Announcements on [EMAIL PROTECTED] > To unsubscribe, email '[EMAIL PROTECTED]' with > 'unsubscribe radiator' in the body of the message. >-- End of excerpt from Aaron Nabil -- Mike McCauley [EMAIL PROTECTED] Open System Consultants Pty. LtdUnix, Perl, Motif, C++, WWW 24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au Phone +61 3 9598-0985 Fax +61 3 9598-0955 Radiator: the most portable, flexible and configurable RADIUS server anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8, 2000, NT, MacOS X === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
RE: (RADIATOR) TotalControlSNMP
Here a slightly improved version in that it should work independant of the card density (quad/hiperdsp) and type (e1/t1). It uses the session-id instead of the nas-port. # Check Total Control by using SNMP # sub isOnlineTotalControlSNMP { my ($name, $nas_id, $nas_port, $session_id, $client) = @_; return 1 unless &Radius::SNMP::snmpgetprogExists(); my $oid = length $session_id; my $x; foreach $x (unpack('C*', $session_id)) { $oid .= ".$x"; } my $result = &Radius::SNMP::snmpget($nas_id, $client->{SNMPCommunity}, "$Radius::Nas::TCMIB.4.2.1.140.1.2.$oid"); # There must be some Important Reason all of these routines return # 0 or 1 instead of nil or 1, so I'll play along. return 0+($result =~ /^.*\"([^"]+)".*$/ && $1 eq $name); } On Tue, 28 Mar 2000, Aaron Nabil wrote: > > On Tue, 28 Mar 2000, Ingvar Berg (ERA) wrote: > > > I assume that 24 is for a T1 line, so with E1 lines it would be 30? > > /Ingvar > -- Aaron Nabil === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
RE: (RADIATOR) TotalControlSNMP
On Tue, 28 Mar 2000, Ingvar Berg (ERA) wrote: > I assume that 24 is for a T1 line, so with E1 lines it would be 30? > /Ingvar Good question! Turn on debugging and looking for something like "USR-Interface-Index" in the accounting trace. That's what the $portidx should end up being. So just take the nas-port from the same trace, run it through the math (below), and see if the computed index matches that Interface-Index number in the trace. #!/usr/local/bin/perl $nasport = xxx ; $chan = $nasport % 24; $slot = (($nasport - $chan) / 24)+1; $interf = (256*$slot) + $chan + 1000; print "interf-idx: $interf\n"; Then let Mike know, and he'll replace that 24 with a $density variable. -a > > > -Original Message- > > From: Mike McCauley [mailto:[EMAIL PROTECTED]] > > Sent: den 29 mars 2000 03:27 > > To: Aaron Nabil; Stephen Roderick > > Cc: [EMAIL PROTECTED] > > Subject: Re: (RADIATOR) TotalControlSNMP > > > > > > Hi Aaron, > > > > Thanks for that. I have rolled your fix into the next release. > > > > Cheers. > > > > On Mar 28, 2:07am, Aaron Nabil wrote: > > > Subject: Re: (RADIATOR) TotalControlSNMP > > > > > > > > > Your math for computing portidx isn't correct for more than > > the first 24 > > > ports. If use the following instead, you'll get the > > correct results. > > > > > >my $chan = $nas_port % 24; > > >my $slot = (($nas_port - $chan) / 24)+1; > > >my $portidx = (256*$slot) + $chan + 1000; > > > > > > > > > Note that these equations are for the factory default > > density settings. > > > > > > > > > Aaron Nabil === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
RE: (RADIATOR) TotalControlSNMP
I assume that 24 is for a T1 line, so with E1 lines it would be 30? /Ingvar > -Original Message- > From: Mike McCauley [mailto:[EMAIL PROTECTED]] > Sent: den 29 mars 2000 03:27 > To: Aaron Nabil; Stephen Roderick > Cc: [EMAIL PROTECTED] > Subject: Re: (RADIATOR) TotalControlSNMP > > > Hi Aaron, > > Thanks for that. I have rolled your fix into the next release. > > Cheers. > > On Mar 28, 2:07am, Aaron Nabil wrote: > > Subject: Re: (RADIATOR) TotalControlSNMP > > > > > > Your math for computing portidx isn't correct for more than > the first 24 > > ports. If use the following instead, you'll get the > correct results. > > > >my $chan = $nas_port % 24; > >my $slot = (($nas_port - $chan) / 24)+1; > >my $portidx = (256*$slot) + $chan + 1000; > > > > > > Note that these equations are for the factory default > density settings. > > > > > > > > On Sun, 28 Mar 1999, Stephen Roderick wrote: > > > > > > > > I have figured out the Total Control SNMP stuff as well > (see note at > > > bottom). I'm sure that Mike will whip up a patch for > everyone in the near > > > future. > > > > > > > > > # The 3com TotalControl SNMP MIB > > > $Radius::Nas::TCMIB = > > > '.iso.org.dod.internet.private.enterprises.429' > > > > > > > > > sub isOnlineTotalControlSNMP > > > { > > > my ($name, $nas_id, $nas_port, $session_id, $client) = @_; > > > > > > if (!-x $Radius::Nas::snmpgetprog) > > > { > > > &main::log($main::LOG_ERR, "$Radius::Nas::snmpgetprog is not > > > executable. Check and configure Nas.pm"); > > > return 1; # Assume the worst > > > } > > > my $portidx = 1256 + $nas_port; > > > my $result = `$Radius::Nas::snmpgetprog $nas_id > > > $client->{SNMPCommunity} > $Radius::Nas::TCMIB.4.10.1.1.18.$portidx`; > > > > > > &main::log($main::LOG_ERR, "The command > '$Radius::Nas::snmpgetprog > > > $nas_id $client->{SNMPCommunity} > $Radius::Nas::TCMIB.4.10.1.1.18.$portidx' > failed > > > with an error: $result") > > > if $result =~ /error/i; > > > > > > if ($result =~ /^.*\"([^"]+)".*$/) > > > { > > > return $1 eq $name; > > > } > > > return 0; > > > } > > > > > > Note: I got most of this from another Radius product (not > to be mentioned > > > here ;-) > > > > > > > -- > > Aaron Nabil > > > > > > === > > Archive at http://www.starport.net/~radiator/ > > Announcements on [EMAIL PROTECTED] > > To unsubscribe, email '[EMAIL PROTECTED]' with > > 'unsubscribe radiator' in the body of the message. > >-- End of excerpt from Aaron Nabil > > > > -- > Mike McCauley [EMAIL PROTECTED] > Open System Consultants Pty. LtdUnix, Perl, > Motif, C++, WWW > 24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au > Phone +61 3 9598-0985 Fax +61 3 9598-0955 > > Radiator: the most portable, flexible and configurable RADIUS server > anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, > Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8, > 2000, NT, MacOS X > === > Archive at http://www.starport.net/~radiator/ > Announcements on [EMAIL PROTECTED] > To unsubscribe, email '[EMAIL PROTECTED]' with > 'unsubscribe radiator' in the body of the message. > === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
Re: (RADIATOR) TotalControlSNMP
Hi Aaron, Thanks for that. I have rolled your fix into the next release. Cheers. On Mar 28, 2:07am, Aaron Nabil wrote: > Subject: Re: (RADIATOR) TotalControlSNMP > > > Your math for computing portidx isn't correct for more than the first 24 > ports. If use the following instead, you'll get the correct results. > >my $chan = $nas_port % 24; >my $slot = (($nas_port - $chan) / 24)+1; >my $portidx = (256*$slot) + $chan + 1000; > > > Note that these equations are for the factory default density settings. > > > > On Sun, 28 Mar 1999, Stephen Roderick wrote: > > > > > I have figured out the Total Control SNMP stuff as well (see note at > > bottom). I'm sure that Mike will whip up a patch for everyone in the near > > future. > > > > > > # The 3com TotalControl SNMP MIB > > $Radius::Nas::TCMIB = > > '.iso.org.dod.internet.private.enterprises.429' > > > > > > sub isOnlineTotalControlSNMP > > { > > my ($name, $nas_id, $nas_port, $session_id, $client) = @_; > > > > if (!-x $Radius::Nas::snmpgetprog) > > { > > &main::log($main::LOG_ERR, "$Radius::Nas::snmpgetprog is not > > executable. Check and configure Nas.pm"); > > return 1; # Assume the worst > > } > > my $portidx = 1256 + $nas_port; > > my $result = `$Radius::Nas::snmpgetprog $nas_id > > $client->{SNMPCommunity} $Radius::Nas::TCMIB.4.10.1.1.18.$portidx`; > > > > &main::log($main::LOG_ERR, "The command '$Radius::Nas::snmpgetprog > > $nas_id $client->{SNMPCommunity} $Radius::Nas::TCMIB.4.10.1.1.18.$portidx' failed > > with an error: $result") > > if $result =~ /error/i; > > > > if ($result =~ /^.*\"([^"]+)".*$/) > > { > > return $1 eq $name; > > } > > return 0; > > } > > > > Note: I got most of this from another Radius product (not to be mentioned > > here ;-) > > > > -- > Aaron Nabil > > > === > Archive at http://www.starport.net/~radiator/ > Announcements on [EMAIL PROTECTED] > To unsubscribe, email '[EMAIL PROTECTED]' with > 'unsubscribe radiator' in the body of the message. >-- End of excerpt from Aaron Nabil -- Mike McCauley [EMAIL PROTECTED] Open System Consultants Pty. LtdUnix, Perl, Motif, C++, WWW 24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au Phone +61 3 9598-0985 Fax +61 3 9598-0955 Radiator: the most portable, flexible and configurable RADIUS server anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8, 2000, NT, MacOS X === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
Re: (RADIATOR) TotalControlSNMP
Your math for computing portidx isn't correct for more than the first 24 ports. If use the following instead, you'll get the correct results. my $chan = $nas_port % 24; my $slot = (($nas_port - $chan) / 24)+1; my $portidx = (256*$slot) + $chan + 1000; Note that these equations are for the factory default density settings. On Sun, 28 Mar 1999, Stephen Roderick wrote: > > I have figured out the Total Control SNMP stuff as well (see note at > bottom). I'm sure that Mike will whip up a patch for everyone in the near > future. > > > # The 3com TotalControl SNMP MIB > $Radius::Nas::TCMIB = > '.iso.org.dod.internet.private.enterprises.429' > > > sub isOnlineTotalControlSNMP > { > my ($name, $nas_id, $nas_port, $session_id, $client) = @_; > > if (!-x $Radius::Nas::snmpgetprog) > { > &main::log($main::LOG_ERR, "$Radius::Nas::snmpgetprog is not > executable. Check and configure Nas.pm"); > return 1; # Assume the worst > } > my $portidx = 1256 + $nas_port; > my $result = `$Radius::Nas::snmpgetprog $nas_id > $client->{SNMPCommunity} $Radius::Nas::TCMIB.4.10.1.1.18.$portidx`; > > &main::log($main::LOG_ERR, "The command '$Radius::Nas::snmpgetprog > $nas_id $client->{SNMPCommunity} $Radius::Nas::TCMIB.4.10.1.1.18.$portidx' failed > with an error: $result") > if $result =~ /error/i; > > if ($result =~ /^.*\"([^"]+)".*$/) > { > return $1 eq $name; > } > return 0; > } > > Note: I got most of this from another Radius product (not to be mentioned > here ;-) > -- Aaron Nabil === Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.