Cisco::SNMP::Line - Line Interface for Cisco Management
use Cisco::SNMP::Line;
The following methods are for line management. Lines on Cisco devices refer to console, auxillary and terminal lines for user interaction. These methods implement the OLD-CISCO-TS-MIB which is not available on some newer forms of IOS.
OLD-CISCO-TS-MIB
my $cm = Cisco::SNMP::Line->new([OPTIONS]);
Create a new Cisco::SNMP::Line object with OPTIONS as optional parameters. See Cisco::SNMP for options.
my @lineOIDs = $cm->lineOIDs();
Return list of Line MIB object ID names.
my @sessOIDs = $cm->sessOIDs();
Return list of Session MIB object ID names.
my $line = $cm->line_clear([OPTIONS]);
Clear the line (disconnect interactive session). Called with no arguments, clear all lines. Called with one argument, interpreted as the lines to clear.
Option Description Default ------ ----------- ------- -lines Line or range of lines (, and -) (all)
To specify individual lines, provide their number:
my $line = $cm->line_clear(2);
Clear line 2. To specify a range of lines, provide a range:
my $line = $cm->line_clear('2-4,6,9-11');
Clear lines 2 3 4 6 9 10 11.
If successful, returns a pointer to an array containing the lines cleared.
my $lineinfo = $cm->line_info();
Populate a data structure with line information. If successful, returns a pointer to a hash containing line information.
$lineinfo->{0}->{'Number', 'TimeActive', ...} $lineinfo->{1}->{'Number', 'TimeActive', ...} ... $lineinfo->{n}->{'Number', 'TimeActive', ...}
Allows the following accessors to be called.
$lineinfo->lineActive([#]);
Return the active of the line at index '#'. Defaults to 0.
$lineinfo->lineType([#]);
Return the type of the line at index '#'. Defaults to 0.
$lineinfo->lineAutobaud([#]);
Return the autobaud of the line at index '#'. Defaults to 0.
$lineinfo->lineSpeedIn([#]);
Return the speedin of the line at index '#'. Defaults to 0.
$lineinfo->lineSpeedOut([#]);
Return the speedout of the line at index '#'. Defaults to 0.
$lineinfo->lineFlow([#]);
Return the flow of the line at index '#'. Defaults to 0.
$lineinfo->lineModem([#]);
Return the modem of the line at index '#'. Defaults to 0.
$lineinfo->lineLocation([#]);
Return the location of the line at index '#'. Defaults to 0.
$lineinfo->lineTerm([#]);
Return the term of the line at index '#'. Defaults to 0.
$lineinfo->lineScrLen([#]);
Return the scrlen of the line at index '#'. Defaults to 0.
$lineinfo->lineScrWid([#]);
Return the scrwid of the line at index '#'. Defaults to 0.
$lineinfo->lineEsc([#]);
Return the esc of the line at index '#'. Defaults to 0.
$lineinfo->lineTmo([#]);
Return the tmo of the line at index '#'. Defaults to 0.
$lineinfo->lineSestmo([#]);
Return the sestmo of the line at index '#'. Defaults to 0.
$lineinfo->lineRotary([#]);
Return the rotary of the line at index '#'. Defaults to 0.
$lineinfo->lineUses([#]);
Return the uses of the line at index '#'. Defaults to 0.
$lineinfo->lineNses([#]);
Return the number of sessions of the line at index '#'. Defaults to 0.
$lineinfo->lineUser([#]);
Return the user of the line at index '#'. Defaults to 0.
$lineinfo->lineNoise([#]);
Return the noise of the line at index '#'. Defaults to 0.
$lineinfo->lineNumber([#]);
Return the number of the line at index '#'. Defaults to 0.
$lineinfo->lineTimeActive([#]);
Return the timeactive of the line at index '#'. Defaults to 0.
my $session = $cm->line_sessions();
Populate a data structure with the session information per line. If successful, returns a pointer to a hash containing session information.
$sessions->{1}->[0]->{'Session', 'Type', 'Dir' ...} [1]->{'Session', 'Type', 'Dir' ...} ... ... $sessions->{n}->[0]->{'Session', 'Type', 'Dir' ...}
First hash value is the line number, next array is the list of current sessions per the line number.
$sessions->sessType([$line[,$sess]]);
Return the type of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessDirection([$line[,$sess]]);
Return the direction of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessAddress([$line[,$sess]]);
Return the address of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessName([$line[,$sess]]);
Return the name of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessCurrent([$line[,$sess]]);
Return the current of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessIdle([$line[,$sess]]);
Return the idle of the session on line $line, session index $sess. Defaults to 0.
$sessions->sessLine([$line[,$sess]]);
Return the line of the session on line $line, session index $sess. Defaults to 0.
my $line = $cm->line_message([OPTIONS]);
Send a message to the line. With no arguments, a "Test Message" is sent to all lines. If 1 argument is provided, interpreted as the message to send to all lines. Valid options are:
Option Description Default ------ ----------- ------- -lines Line or range of lines (, and -) (all) -message Double-quote delimited string "Test Message"
If successful, returns a pointer to an array containing the lines messaged.
my $line = $cm->line_numberof();
If successful, returns the number of lines on the device.
The following methods can be called on the Cisco::SNMP::Line object directly to access the values directly.
Get Line OIDs where (#) is the OID instance, not the index from line_info. If (#) not provided, uses 0.
line_info
Get Session OIDs where (l) is the OID instance of the line and (s) is the OID instance of the session on that line. If (l,s) not provided, uses 0.
The following are inherited methods. See Cisco::SNMP for more information.
None by default.
This distribution comes with several scripts (installed to the default bin install directory) that not only demonstrate example uses but also provide functional execution.
bin
This software is released under the same terms as Perl itself. If you don't know what that means visit http://perl.com/.
Copyright (C) Michael Vincent 2015
http://www.VinsWorld.com
All rights reserved
To install Cisco::SNMP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cisco::SNMP
CPAN shell
perl -MCPAN -e shell install Cisco::SNMP
For more information on module installation, please visit the detailed CPAN module installation guide.