perfSONAR_PS::Services::MP::Agent::SNMP - A module that will query a SNMP device and return it's output.
Inherited perfSONAR_PS::MP::Agent::Base class that allows a command to be executed. Specific tools should inherit from this class and override parse() in order to be able to format the command line output in a well understood data structure.
# command line to run, variables are indicated with the '%...%' notation my $command = '/bin/ping -c %count% %destination%'; # options to use, the above keys defined in $command will be # substituted with the following values my %options = ( 'count' => 10, 'destination' => 'localhost', ); # create and setup a new Agent my $agent = perfSONAR_PS::Services::MP::Agent::CommandLine( $command, $options ); $agent->init(); # collect the results (i.e. run the command) if( $mp->collectMeasurements() == 0 ) { # get the raw datastructure for the measurement print "Results:\n" . $self->results() . "\n"; } # opps! something went wrong! :( else { print STDERR "Command: '" . $self->commandString() . "' failed with result '" . $self->results() . "': " . $agent->error() . "\n"; }
Creates a new agent class
$host = device to query $port = udp port number to query on $host $ver = snmp version number (1,2c,3) $comm = community string to use to query device $vars = hash of OIDs to query
Setup the snmp agent
collect the snmp oids defined. Optional list of variables to collect @var (otherwise will use whatever was defined in the constructor or overloaded with $self->variables())
accessor/mutator function for the host to query
accessor/mutator function for the udp port to query
accessor/mutator function for the snmp version to use
accessor/mutator function for the snmp community string
accessor/mutator function for the hash of snmp oids to collect
Add the snmp oid to the list of variable to collect
Clears the list of snmp oids to collect
removes a single snmp oid variable from teh list to query
determines the number of snmp oid variables to poll
Actually polls the host on port with community string and version the list of variables.
Input: @vars = list of oids to collect, if not supplied, will use $self->variables().
Returns:
-1 = something went wrong (use $self->error() ) 0 = everything went okay
creates and sets a Net::SNMP session for use in collection of oids
closes the Net::SNMP session
Returns
-1 = could not close the session; 0 = closed session okay
To install IEPM::PingER::Statistics::RTT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IEPM::PingER::Statistics::RTT
CPAN shell
perl -MCPAN -e shell install IEPM::PingER::Statistics::RTT
For more information on module installation, please visit the detailed CPAN module installation guide.