in reply to Could you suggest improvements to my Cisco network device audit script?

That's a lot of code.

Well, as for suggestions, use perltidy. Hopefully you see why.

if (!defined $match) { print "$ip: ERROR_1\n"; print LOG "$ip: ERROR_1\n"; return; } ... if (!defined $match) { print "$ip: ERROR_13\n"; print LOG "$ip: ERROR_13\n"; return; } ... sub get_inventory { my ($ip, $t) = (@_); if (!$t->cmd('terminal length 0')) { print "$ip: Error changing terminal length\n"; print LOG "$ip: Error changing terminal length\n"; } my @show_run = $t->cmd('show run | inc hostname'); ...
Did you assemble this stuff from different sources?
  • Comment on Re: Could you suggest improvements to my Cisco network device audit script?
  • Download Code

Replies are listed 'Best First'.
Re^2: Could you suggest improvements to my Cisco network device audit script?
by monkerz57 (Initiate) on Dec 23, 2014 at 00:57 UTC
    Thanks for the reply. I updated the initial question code with perlTidy's output. I did google quite a bit for the ssh portion of code. I couldn't get the channel to function as I wanted using cpan's example code. The telnet portion was created from a simple telnet script a co-worker created a few years ago, however I added quite a few conditionals and login subs due to a lack of standardization within the environment. I couldn't source the tidbits if I tried, if that is what you are getting at. Thanks, Monk