<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
I realize you’re aiming for the NETCONF paradigm, but for anyone interested, a more consistent, device- and release-independent method is to just query the SNMP uptime variable:
<div><br>
</div>
<div>
<pre><ul><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);">$ <b>snmpget -v 1 -c demopublic 10.1.2.1 system.sysUpTime.0</b> </span></font></ul><ul><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);">system.sysUpTime.0 = Timeticks: (586731977) 67 days, 21:48:39.77</span></font><font color="#333333"><span style="caret-color: rgb(51, 51, 51); font-size: 1.1em; -webkit-text-size-adjust: auto;">
</span></font></ul><div style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-size: 1.1em; -webkit-text-size-adjust: auto;"><br></div></pre>
<div><br>
<div id="AppleMailSignature" dir="ltr"> -mel beckman</div>
<div dir="ltr"><br>
On Feb 20, 2019, at 11:00 AM, Benoit Claise via NANOG <<a href="mailto:nanog@nanog.org">nanog@nanog.org</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="moz-cite-prefix">Erik,<br>
<br>
Just in case you want to go into/learn the data model-driven management, here is a NETCONF/YANG script.<br>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">CiscoRouterUptimeNETCONF) dvulovic@DVULOVIC-D2DW2:~/python-venv/CiscoRouterUptimeNETCONF$ ./CiscoRouterUptimeNETCONF.py testinput</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">CiscoRouterUptimeNETCONF by Djordje Vulovic (<a class="moz-txt-link-abbreviated" href="mailto:dvulovic@cisco.com">dvulovic@cisco.com</a>)</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">----------------------------------------------------------------</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Router 10.1.2.1 has uptime of 5724548.0 seconds (66 days, 6:09:08)</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Router 10.1.2.2 has uptime of 5724551.0 seconds (66 days, 6:09:11)</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Router 10.1.2.3 has uptime of 5724555.0 seconds (66 days, 6:09:15)</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Router 10.1.2.4 has uptime of 5724557.0 seconds (66 days, 6:09:17)</span></pre>
<pre><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Router 10.1.2.5 has uptime of 5724497.0 seconds (66 days, 6:08:17)</span></pre>
<pre><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></pre>
<pre><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></pre>
<pre><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></pre>
<pre><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">
(CiscoRouterUptimeNETCONF) dvulovic@DVULOVIC-D2DW2:~/python-venv/CiscoRouterUptimeNETCONF$ </span><span style="font-family:"Courier New";color:red;mso-fareast-language:EN-US" lang="EN-US">./CiscoRouterUptimeNETCONF.py</span><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">CiscoRouterUptimeNETCONF by Djordje Vulovic (<a class="moz-txt-link-abbreviated" href="mailto:dvulovic@cisco.com">dvulovic@cisco.com</a>)</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">----------------------------------------------------------------</span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">Usage: CiscoRouterUptimeNETCONF <file></span></pre>
<pre class="MsoNormal"><span style="font-family:"Courier New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US">File consists of lines <mgmt ip>,<NETCONF port>,<username>,<password></span></pre>
<br>
<br>
The script was tested on a real ASR920, running IOS 16.8.1<br>
See the source code at <a moz-do-not-send="true" href="https://github.com/djordjevulovic/CiscoRouterUptimeNETCONF">
https://github.com/djordjevulovic/CiscoRouterUptimeNETCONF</a><br>
<br>
Thanks to Djordje for developing this script.<br>
<br>
Regards, Benoit<br>
<span style="font-family:"Courier
        New";color:windowtext;mso-fareast-language:EN-US" lang="EN-US"></span></div>
<blockquote type="cite" cite="mid:CY4PR17MB1207492A79FFB2EC9C48914CD3940@CY4PR17MB1207.namprd17.prod.outlook.com">
<pre class="moz-quote-pre" wrap="">All,

I just created a quick script to check the uptime of a ASR920 via SNMP if you have a fairly long list of devices. It's a simple bash script and snmpwalk version 2c. Figured I would share it with you. Happy Friday

Grab the code from GitHub: <a class="moz-txt-link-freetext" href="https://github.com/esundberg/CiscoRouterUptime">https://github.com/esundberg/CiscoRouterUptime</a>
It's a quick and dirty script and my first repo on github. Let me know if there any issues with it.


Output Format in CSV
DeviceName, IP, Uptime in Days, OK/Warning

I set my warning to 800 Days, you can change this in the code


ASR920list.txt
-------------
ASR920-1.SEA1, 192.168.28.1, SuperSecretSNMPKey
ASR920-2.SEA1, 192.168.28.2, SuperSecretSNMPKey
~~~~snip you get the idea~~~~


Output

[user@Linux]$ ./CiscoRouterUptime.sh ASR920list.txt
ASR920-1.SEA1, 192.168.28.1, 827, WARNING
ASR920-2.SEA1, 192.168.28.2, 827, WARNING
ASR920-2.ATL1, 192.168.23.2, 828, WARNING
ASR920-1.ATL1, 192.168.23.1, 813, WARNING
ASR920-1.CHI1, 192.168.21.3, 828, WARNING
ASR920-1.NYC1, 192.168.25.1, 787, OK
ASR920-2.CHI1, 192.168.21.4, 720, OK
ASR920-3.CHI1, 192.168.21.5, 720, OK
ASR920-1.DAL1, 192.168.26.3, 488, OK
ASR920-4.CHI1, 192.168.21.6, 142, OK



________________________________

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it may contain confidential information that is legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error please notify the sender immediately by replying to this e-mail. You must destroy the original transmission and its attachments without reading or saving in any manner. Thank you.
.

</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
</div>
</body>
</html>