Active IQ Unified Manager Discussions
if I use the RestAPI for Ontap 9.7 to get Snapmirror details, the lag time has a strange format to me:
i.e. PT8H35M42S or P28DT3H59M55S
Which format is it? How can I parse it into days, hours and minutes using Powershell?
See The Solution
Looking at your two examples, this is how I interpret them:
P28DT3H59M55S → 28 Days, 3 Hours, 59 Minutes, 55 Seconds....I think.
PT8H35M42S → 8 Hours, 35 Minutes, 42 Seconds.
Perhaps you could issue the API call at roughly the same time as the CLI command:
snapmirror show -fields lag-time
Comparing the two may provide you with the necessary insight to decode, feel free to post the output of the two here and I'll have a look.
I've just had a look at this using a lab environment and confirm what I had stated, have a look:
I was unable to grab a screenshot with the two times perfectly synced as the GUI refreshes on it's own constantly in an attempt to provide near-realtime status.
I don't need near real-time values. I need a format to parse it into days hour:minute.
The format of the string depends on the time. Thats a regex-if expression hell to extract the info.
The lag time in seconds delivered by the API is more helpful.
This is actually ISO 8601 time span format:
Here's a link to a PowerShell function that might help you get the end result you want (at least the regex stuff):
View solution in original post