Example usage is the following shell script called maxcheck: --------begin maxcheck------------ #!/bin/sh if [ "$1" != "" ]; then home_binary=/location/of/maxcall $home_binary -h $1 -c <read community string> else echo "usage: maxcheck max-ip-address" ; fi --------end maxcheck-------------- or you can just do "maxcall -h <ip address> -c <read community>" from the command line. My personal favorite is to run a script I call mc that runs maxcall: ------begin mc------------------- #!/usr/bin/perl system("maxcheck xxx.xxx.xxx.xxx"); #where xxx.xxx.xxx.xxx is a max IP. system("maxcheck xxx.xxx.xxx.xxx"); # the next max system("maxcheck xxx.xxx.xxx.xxx"); # and so on system("maxcheck xxx.xxx.xxx.xxx"); # and so on. -----End MC---------------------- the syntax is mc | grep <username> and you can find out what max the user is on, or just mc and get all the users online (I suggest piping it to more). Enjoy, Joe Shaw - jshaw@insync.net NetAdmin - Insync Internet Services On Sun, 30 Nov 1997, Michael Dickens wrote: > Joe; > > Any ideas on where to find 'maxcall' > > TIA > > Michael </PRE> <PRE> #!/usr/local/bin/perl # This program is free software; you can redistribute it and/or modify # it under the terms of either: # # a) the GNU General Public License as published by the Free # Software Foundation; either version 1, or (at your option) any # later version, or # # b) the "Artistic License" which comes with this Kit. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either # the GNU General Public License or the Artistic License for more details. # # Bugs & suggestions to <nectar@communique.net> # use SNMP; use Getopt::Std; getopts( "h:c:m:" ); $callref = $ARGV[ 0 ]; $host = $opt_h ? $opt_h : "max"; $community = $opt_c ? $opt_c : "public"; $ascend_mib = $opt_m ? $opt_m : "/usr/local/lib/mib/ascend.mib"; @service = ( "None", "Other", "PPP", "SLIP", "Multilink PPP+", "X.25", "Combinet", "Frame Relay", "EU RAW", "EU UI", "TELNET", "TELNET Binary", "TCP Clear", "Terminal Serv", "Multilink PPP" ); $session = init_snmp( $host, $community ); ( $sys_startup, $secs_since_startup, $count_calls ) = snmpget( new SNMP::VarList( ['sysAbsoluteStartupTime', '0'], ['sysSecsSinceStartup', '0'], ['callStatusMaximumEntries', '0'] )); if ( $callref ) { display_call( $callref ); } else { list_calls(); } sub list_calls { my ( $i, $c, $num_calls ); print_header(); for ( $i = 1; $i <= $count_calls; $i++ ) { if ( $c = get_call( $i ) ) { print_call( $c ); if ( $c->{'modemslot'} ) { $analog_calls++; } else { $digital_calls++; } } } printf( "\n%d analog calls, %d digital calls, %d calls total\n", $analog_calls, $digital_calls, $analog_calls + $digital_calls ); } sub display_call { my $key = shift; my $call_index; # If the key is all digits, if ( $key =~ /^\d+$/ ) { # Then look up the call by call reference number $call_index = get_call_by_callref( $key ); } else { # else look up the call by user name $call_index = get_call_by_username( $key ); } if ( $call_index ) { my $c; ($c = get_call_full( $call_index )) and print_call_full( $c ); } else { print "Call not found.\n"; } } sub get_call_by_callref { my $callref_wanted = shift; my $i; for ( $i = 1; $i <= $count_calls; $i++ ) { if ( snmpget( "callStatusCallReferenceNum.$i" ) == $callref_wanted ) { return $i; } } 0; } sub get_call_by_username { my $username_wanted = shift; my ( $i, $valid, $session ); for ( $i = 1; $i <= $count_calls; $i++ ) { ($valid, $session) = snmpget( new SNMP::VarList( ['callStatusValidFlag',$i], ['callSessionIndex',$i])); if ( $valid == 2 and snmpget( "ssnStatusUserName.$session" ) eq $username_wanted ) { return $i; } } 0; } sub print_header { # 12345678901234567890123456789012345678901234567890123456789012345678901234567890 print "CallRef Elapsd Time Speed Channel Modem User IP Address Service\n"; print "------- ----------- ----- ------- ----- ---------- --------------- -------------\n"; } sub print_call { my $c = shift; printf( "%7d %11s %5d %7s %-5s %-10s %-15s %-13s\n", $c->{'callref'}, asctimediff( $secs_since_startup, $c->{'timestamp'} ), $c->{'datarate'}, sprintf( "%d/%02d", 2 * ($c->{'slot'} - 1) + $c->{'line'}, $c->{'chan'} ), $c->{'modemslot'} ? sprintf( " %d:%d", $c->{'modemslot'}, $c->{'modemnum'} ) : " ---", $c->{'user'}, $c->{'ipaddr'}, $service[$c->{'service'}-1], ); } sub print_call_full { my $c = shift; print_call_full_line( "CallRef", $c->{'callref'}, "Time Elapsed", asctimediff( $secs_since_startup, $c->{'timestamp'} ), ); print_call_full_line( "User", $c->{'user'}, "Service", $service[$c->{'service'}-1], ); print_call_full_line( "Data Rate", $c->{'datarate'}, "IP Address", $c->{'ipaddr'}, ); print_call_full_line( "Channel", sprintf("%d/%02d", 2 * ($c->{'slot'} - 1) + $c->{'line'}, $c->{'chan'}), "Modem", $c->{'modemslot'} ? sprintf("%d:%d", $c->{'modemslot'}, $c->{'modemnum'} ) : "---", ); print_call_full_line( "MTU Size", $c->{'mtu'}, "Subnet Mask", $c->{'mask'}, ); print "\n In Out\n"; printf( " Bytes %16u %16u\n", $c->{'inoctets'}, $c->{'outoctets'} ); printf( " Unicast Packets %16u %16u\n", $c->{'inunipkts'}, $c->{'outunipkts'} ); printf( " Broadcast/Multicast Pkts %16u %16u\n", $c->{'inmultipkts'}, $c->{'outmultipkts'} ); printf( " Discarded Packets %16u %16u\n", $c->{'indiscards'}, $c->{'outdiscards'} ); printf( " Pkts w/unknown Protocol %16u %16u\n", $c->{'inbadprotos'}, $c->{'outbadprotos'} ); } sub print_call_full_line { printf( "%14s: %-18s %14s: %-18s\n", @_ ); } sub get_call { my $i = shift; my $c = {}; if ( snmpget( "callStatusValidFlag.$i" ) == 2 ) { my $var = new SNMP::VarList ( ['callStatusStartingTimeStamp', $i], ['callStatusCallReferenceNum', $i], ['callStatusDataRate', $i], ['callStatusSlotNumber', $i], ['callStatusSlotLineNumber', $i], ['callStatusSlotChannelNumber', $i], ['callStatusModemSlotNumber', $i], ['callStatusModemOnSlot', $i], ['callSessionIndex', $i] ); ( $c->{'timestamp'}, $c->{'callref'}, $c->{'datarate'}, $c->{'slot'}, $c->{'line'}, $c->{'chan'}, $c->{'modemslot'}, $c->{'modemnum'}, $c->{'session'} ) = snmpget( $var ); $var = new SNMP::VarList ( ['ssnStatusUserName', $c->{'session'}], ['ssnStatusUserIPAddress', $c->{'session'}], ['ssnStatusCurrentService', $c->{'session'}] ); ( $c->{'user'}, $c->{'ipaddr'}, $c->{'service'} ) = snmpget( $var ); $c->{'ipaddr'} = join( ".", unpack( "C4", $c->{'ipaddr'} )); ( $c->{'ipaddr'} =~ /0\.0\.0\.0/ ) && ( $c->{'ipaddr'} = "n/a" ); $c; } else { 0; } } sub get_call_full { my $i = shift; my $c = {}; if ( snmpget( "callStatusValidFlag.$i" ) == 2 ) { my $var = new SNMP::VarList ( ['callStatusStartingTimeStamp', $i], ['callStatusCallReferenceNum', $i], ['callStatusDataRate', $i], ['callStatusSlotNumber', $i], ['callStatusSlotLineNumber', $i], ['callStatusSlotChannelNumber', $i], ['callStatusModemSlotNumber', $i], ['callStatusModemOnSlot', $i], ['callStatusIfIndex', $i], ['callSessionIndex', $i] ); ( $c->{'timestamp'}, $c->{'callref'}, $c->{'datarate'}, $c->{'slot'}, $c->{'line'}, $c->{'chan'}, $c->{'modemslot'}, $c->{'modemnum'}, $c->{'if'}, $c->{'session'} ) = snmpget( $var ); $var = new SNMP::VarList ( ['ssnStatusUserName', $c->{'session'}], ['ssnStatusUserIPAddress', $c->{'session'}], ['ssnStatusUserSubnetMask', $c->{'session'}], ['ssnStatusCurrentService', $c->{'session'}], ); ( $c->{'user'}, $c->{'ipaddr'}, $c->{'mask'}, $c->{'service'} ) = snmpget( $var ); $c->{'ipaddr'} = join( ".", unpack( "C4", $c->{'ipaddr'} ) ); ( $c->{'ipaddr'} =~ /0\.0\.0\.0/ ) && ( $c->{'ipaddr'} = "n/a" ); $c->{'mask'} = join( ".", unpack( "C4", $c->{'mask'} ) ); ( $c->{'mask'} =~ /0\.0\.0\.0/ ) && ( $c->{'mask'} = "n/a" ); if ( $c->{'if'} ) { $var = new SNMP::VarList ( ['ifMtu', $c->{'if'}], ['ifInOctets', $c->{'if'}], ['ifOutOctets', $c->{'if'}], ['ifInUcastPkts', $c->{'if'}], ['ifOutUcastPkts', $c->{'if'}], ['ifInNUcastPkts', $c->{'if'}], ['ifOutNUcastPkts', $c->{'if'}], ['ifInDiscards', $c->{'if'}], ['ifOutDiscards', $c->{'if'}], ['ifInErrors', $c->{'if'}], ['ifOutErrors', $c->{'if'}], ['ifInUnknownProtos', $c->{'if'}], ['ifOutUnknownProtos', $c->{'if'}], ['ifOutQLen', $c->{'if'}], ); ( $c->{'mtu'}, $c->{'inoctets'}, $c->{'outoctets'}, $c->{'inunipkts'}, $c->{'outunipkts'}, $c->{'inmultipkts'}, $c->{'outmultipkts'}, $c->{'indiscards'}, $c->{'outdiscards'}, $c->{'inerrors'}, $c->{'outerrors'}, $c->{'inbadprotos'}, $c->{'outbadprotos'}, $c->{'outqlen'} ) = snmpget( $var ); } $c; } else { 0; } } sub init_snmp { $SNMP::auto_init_mib = 0; SNMP::setMib( $ascend_mib ); new SNMP::Session( 'DestHost' => $_[0], 'Community' => $_[1] ); } sub snmpget { my @rc = $session->get( @_ ); if ( $session->{'ErrorStr'} ) { warn "get $var: $session->{'ErrorStr'}\n"; } if ( wantarray() ) { @rc; } else { $rc[0]; } } package asctime; $init_time = 0; sub main::asctime { my $time = shift; my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime( $time ); unless ( $init_time ) { @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); @MoY = ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'); $init_time = 1; } sprintf("%s %2d %2d:%02d:%02d", $MoY[$mon], $mday, $hour, $min, $sec); } sub main::asctimediff { my $time_a = shift; my $time_b = shift; my $time_diff = abs( $time_a - $time_b ); $time_diff -= ( my $hours = int( $time_diff / 3600 ) ) * 3600; $time_diff -= ( my $minutes = int( $time_diff / 60 ) ) * 60; $time_diff -= ( my $seconds = $time_diff ); sprintf( "%d:%02d:%02d", $hours, $minutes, $seconds ); } </PRE> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <STRONG>Follow-Ups</STRONG>: <UL> <LI><STRONG><A HREF="msg11363.html">Re: (ASCEND) Users online time...</A></STRONG></LI> <UL> <LI><EM>From</EM>: ascend@digistar.com</LI> </UL> </UL> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <HR> <UL> <LI>Prev by Date: <STRONG><A HREF="msg11229.html">(ASCEND) Problems Connecting to Ascend P50</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg11228.html">Re: (ASCEND) Gateway</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg11211.html">Re: (ASCEND) Users online time...</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg11363.html">Re: (ASCEND) Users online time...</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="mail6.html#11233"><STRONG>Main</STRONG></A></LI> <LI><A HREF="thrd260.html#11233"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> </BODY> </HTML>