Closed pieterverberne closed 8 months ago
I'm wondering how suitable textfsm is for handling Linux command output. For example ping:
PING www.google.com (172.217.19.196) 56(84) bytes of data. 64 bytes from ams16s31-in-f4.1e100.net (172.217.19.196): icmp_seq=1 ttl=63 time=5.97 ms 64 bytes from ams16s31-in-f4.1e100.net (172.217.19.196): icmp_seq=2 ttl=63 time=6.15 ms 64 bytes from ams16s31-in-f4.1e100.net (172.217.19.196): icmp_seq=3 ttl=63 time=5.95 ms 64 bytes from ams16s31-in-f4.1e100.net (172.217.19.196): icmp_seq=4 ttl=63 time=6.00 ms --- www.google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3006ms rtt min/avg/max/mdev = 5.951/6.016/6.149/0.078 ms
This output contains:
Playing around with textfsm I start to realize that textfsm can only process 'one category' of (repetitive) data at the time. Is this correct?
Value DESTINATION_NAME (\S+) Value DESTINATION_IP (\S+) Value SIZE (\d+) Value SIZEA (\d+) # Stats Value TRANSMITTED (\d+) Value RECEIVED (\d+) Value LOSS (\d+) Value STAT_TIME (\d+) Value RTT_MIN (\d+.\d+) Value RTT_AVG (\d+.\d+) Value RTT_MAX (\d+.\d+) Value RTT_MDEV (\d+.\d+) # reply entries Value BYTES (\d+) Value RESOLVED (\S+) Value REPLY_DESTINATION_IP (\S+) Value SEQ (\d+) Value TTL (\d+) Value TIME (\d+.\d\d) Start ^PING ${DESTINATION_NAME} \(${DESTINATION_IP}\) ${SIZE}\(${SIZEA}\) bytes of data.$$ -> Record Reply ^---\S. ping statistics ---$$ ^${TRANSMITTED} packets transmitted, ${RECEIVED}, ${LOSS}%, time ${STAT_TIME}ms$$ ^rtt min/avg/max/mdev = ${RTT_MIN}/${RTT_AVG}/${RTT_MAX}/${RTT_MDEV} ms$$ Reply ^${BYTES} bytes from ${RESOLVED} \(${REPLY_DESTINATION_IP}\): icmp_seq=${SEQ} ttl=${TTL} time=${TIME} -> Record ^\s*$$ -> Start FSM Table: ['DESTINATION_NAME', 'DESTINATION_IP', 'SIZE', 'SIZEA', 'TRANSMITTED', 'RECEIVED', 'LOSS', 'STAT_TIME', 'RTT_MIN', 'RTT_AVG', 'RTT_MAX', ' RTT_MDEV', 'BYTES', 'RESOLVED', 'REPLY_DESTINATION_IP', 'SEQ', 'TTL', 'TIME'] ['www.google.com', '172.217.19.196', '56', '84', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] ['', '', '', '', '', '', '', '', '', '', '', '', '64', 'ams16s31-in-f4.1e100.net', '172.217.19.196', '1', '63', '5.97'] ['', '', '', '', '', '', '', '', '', '', '', '', '64', 'ams16s31-in-f4.1e100.net', '172.217.19.196', '2', '63', '6.15'] ['', '', '', '', '', '', '', '', '', '', '', '', '64', 'ams16s31-in-f4.1e100.net', '172.217.19.196', '3', '63', '5.95'] ['', '', '', '', '', '', '', '', '', '', '', '', '64', 'ams16s31-in-f4.1e100.net', '172.217.19.196', '4', '63', '6.00'] ['', '', '', '', '', '', '', '', '5.951', '6.016', '6.149', '0.078', '', '', '', '', '', '']
'Filldown' flag is probably what you are looking for here.
Closing on the assumption this has resolved the issue - reopen if that is not the case?
I'm wondering how suitable textfsm is for handling Linux command output. For example ping:
This output contains:
Playing around with textfsm I start to realize that textfsm can only process 'one category' of (repetitive) data at the time. Is this correct?