Hello
I’m trying to create a parser for repeated use in my company. My goal is to identify intrefaces that haven’t been used in over 6 months by using the “sh int” command and parsing the “Last input” portion of the output.
GigabitEthernet1/0/19 is down, line protocol is down (notconnect)
Hardware is Gigabit Ethernet, address is 1111.1111.111 (bia 1111.1111.111)
Description: Example
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Auto-duplex, Auto-speed, media type is 10/100/1000BaseTX
input flow-control is on, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 6w4d, output 6w4d, output hang never
In theory this should be easy but because of how Cisco shows the dates it is fairly hard to put into a string and parse it.
I have this so far as to identify interfaces:
$int is $int_status, line protocol is
And this for the last input portion:
Last input $string:last_time_in_traffic, output $string:last_time_out_traffic, output hang never
My whole goal is to identify just GigabitEthernet X/0/X (I dont need modules) that havent been use in over 6 months but if someone could perhaps give me an idea or just point me in the right direction I’d greatly appreciate it