cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
162
Views
0
Helpful
3
Replies

Cannot obtain interface lastoutput data from interface API

Good morning folks,

So i am currently utilizing CIsco DNA Center 2.3.5.6 and i am trying to use a API call to pull interface data related to the last time an interface saw data come across.  Typically in the CLI that is a time format of weeks, days, hours, ect.

but when i used APIs from DNAC to pull this data, it typically see a "None" value (python)  or a long integer value.

here is a sample output from the API call i performed:

{
"pid": "C9300-24UX",
"vlanId": "1037",
"managedNetworkElementUrl": "../../DeviceIf/-807/related/managedNetworkElement",
"managedNetworkElement": {
"type": "ManagedNetworkElement",
"id": 166258,
"longType": "com.cisco.xmp.model.foundation.encapsulatedFunctionality.ManagedNetworkElement",
"url": "../../ManagedNetworkElement/166258"
},
"lastUpdated": null,
"series": "Cisco Catalyst 9300 Series Switches",
"managedComputeElement": null,
"managedComputeElementUrl": null,
"duplex": "AutoNegotiate",
"interfaceType": "Physical",
"ipv4Address": null,
"ipv4Mask": null,
"isisSupport": "false",
"lastInput": 1733324551000,
"lastOutput": 1733324650000,
"mappedPhysicalInterfaceId": null,
"mappedPhysicalInterfaceName": null,
"nativeVlanId": "1",
"networkdevice_id": 162182,
"ospfSupport": "false",
"portMode": "access",
"portType": "Ethernet Port",
"poweroverethernet": 0,
"serialNo": "FOC2225U09J",
"voiceVlan": "",
"className": "SwitchPort",
"ifIndex": "21",
"speed": "1000000",
"macAddress": "b0:90:7e:1a:9d:8e",
"mtu": "9100",
"adminStatus": "UP",
"status": "down",
"mediaType": null,
"addresses": null,
"deviceId": "4c79c1bd-9366-457b-87cd-3024257e1054",
"portName": "TenGigabitEthernet1/0/14",
"description": "",
"name": null,
"instanceUuid": "ace10b90-71d6-4a0d-973b-949c6b037ace",
"instanceTenantId": "5be99e28bbf24f004ce40088",
"id": "ace10b90-71d6-4a0d-973b-949c6b037ace"
}

is there a way to convert this integer to a date/time value or is this a problem with bad data being returned?

 

Thanks!

1 Accepted Solution

Accepted Solutions

@OaklandCounty_Mike numbers you see (1733324551000 and 1733324650000) are Unix/Epoch timestamps in milliseconds and  they can be converted to readable datetime values in Python using, you can do this with the pytz package. Can you share your code?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

3 Replies 3

@OaklandCounty_Mike numbers you see (1733324551000 and 1733324650000) are Unix/Epoch timestamps in milliseconds and  they can be converted to readable datetime values in Python using, you can do this with the pytz package. Can you share your code?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Thank you @bigevilbeard. this was what i was looking for.  do you know how last output is returned if an interface has never seen data move across it?  i was not sure if the python type of None was the correct value for that....

I’m not 100% on this, but from I recall if yourinter face has not seen any traffic, the lastOutput (and lastInput) fields typically return null in the JSON response, which translates to “None” in Python. So yes, i think for these fields this would be the expected behavior for an interface that has never had any traffic.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Review Cisco Networking for a $25 gift card