#!/usr/bin/perl use strict; use Net::Telnet; use Net::Telnet::Cisco; # Command line argument while executing the script if ($#ARGV < 0) { print "Please run the script with correct arguments\n\n"; print "Usage Details:perl core_switch.pl \n"; print "Ex: perl core_switch.pl 192.168.3.10\n"; exit; } my $ip = $ARGV[0]; print "===========================================================================\n"; print "Device IP:$ip\n"; #Connecting to Cisco Device my $session = Net::Telnet::Cisco->new(Host => $ip, Dump_Log => "dump.log"); $session->login('xxxxx','xxxxxxxxxx'); #Executing the commands print "===========================================================================\n"; print "CPU process history\n"; my @process_history= $session->cmd('Show process cpu history'); print "@process_history\n"; print "===========================================================================\n"; $session->close;