Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Monitor memory on a cisco router

by salva (Abbot)
on Mar 19, 2014 at 09:51 UTC ( #1078919=note: print w/replies, xml ) Need Help??

in reply to Monitor memory on a cisco router

The easiest way to retrieve statistics or configuration information from network devices is to use SNMP.

In any case, using Net::SSH2 correctly is quite hard and often involves looking at the module source code or even at libssh2 one. If you are on a Unix/Linux box, Net::OpenSSH is far easier to use.

You can even perform the querying in parallel using Net::OpenSSH::Parallel:

use Net::OpenSSH::Parallel; my $pssh = Net::OpenSSH::Parallel; $pssh->add_host($_, user => $user, password => $password) for @hosts; $pssh->all(parsub => \&query_device); $pssh->run; sub query_device { my ($host, $ssh) = @_; my $output = $ssh->capture({ stdin_data => <<EOD, stderr_to_stdout + => 1 }); enable $secret term len 0; sh mls cef sum EOD $output =~ s/\s+/ /g; print "data from $host: $output\n"; }

Replies are listed 'Best First'.
Re^2: Monitor memory on a cisco router
by vlad3848 (Acolyte) on Mar 19, 2014 at 14:51 UTC
    Thank you salva! I'll give it a try. As I've mentioned in my comment below, these metrics are not available in the SNMP MIBs (or/and I can't access some of the devices via SNMP). I can collect just about anything i want via SNMP but not TCAM statistics.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078919]
[Discipulus]: ovedpo15 when you can use a regex anchor, use it. good morning btw
[ovedpo15]: good morning and thx. I forget to mention another thing: what if I need to check that my string is "hey" and ",0" for example "hey_how,0" is good. can I check it with one regex?
[ovedpo15]: I don't know what is between "hey" and ",0"

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-03-20 07:49 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (248 votes). Check out past polls.