def _compute_timestamp(stupid_cisco_output):The code that follows after that tries to convert Cisco's way of reporting uptime into epoch. I totally understand the frustration. Let's say you want to find out when interface flapped last time. Here are the few examples:
Last link flapped 5d02hI understand, that "show" command output is intended for human consumption and it's easy to read. Unfortunately, Cisco provides same kind of time format in XML output, which is supposed to be consumed by some kind of automation. Good luck parsing it. While Arista and Juniper also display interface uptime in similar fashion in plain text output, they do much better job in structured output. Here is JUNOS output in JSON:
Last link flapped 16week(s) 5day(s)
Last link flapped never
Last link flapped 23:39:41
"interface-flapped" : [or XML:
{
"data" : "2017-09-13 14:39:29 EDT (24w0d 20:45 ago)",
"attributes" : {"junos:seconds" : "14589956"}
}
],
<interface-flapped junos:seconds="14590210" > 2017-09-13 14:39:29 EDT (24w0d 20:50 ago)</interface-flapped>
Arista's JSON:
"Ethernet5/1": {
"lastStatusChangeTimestamp": 1519771449.121221,
No comments:
Post a Comment