The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

OnTAP event query from SDK - want only events after a specified time

SCOTT_LINDLEY

I am attempting to write an EMS event query using the NMSDK against cDOT clusters that will only return events from a given timestamp forward. This would be similar to the OnTAP command:

event log show -event *fpolicy*  -time >="9/28/2018 10:29:55"

 

The query parameter seems to allow for queries AT a specified time, but not for AT OR AFTER (">="). Am I missing something? Is there some way to specify the "time" field to accomplish this? It appears that it will only accept an integer value - number of seconds since the epoch - but there doesn't appear to be any provision for a relational operator.

 

If it matters I am using Perl.

 

Please advise. This would be a great boon to our troubleshooting and monitoring efforts.

 

Thank you for your attention to this matter,

    Scott Lindley

3 REPLIES 3

gaurav_verma

If my python code help you. 

 

api = NaElement("event-iter")
xi = NaElement("time-range")
api.child_add(xi)
xi1 = NaElement("event-timestamp-range")
xi.child_add(xi1)
xi1.child_add_string("end-time", int(unix_timestamp))
xi1.child_add_string("start-time", int(unix_timestamp_minus_30_min))
xo = serv.invoke_elem(api)
xo1 = xo.child_get("records")

 

Where time is could be any range though in my case I am using like this

 

current_time = datetime.datetime.now(datetime.timezone.utc)
unix_timestamp = current_time.timestamp()
unix_timestamp_minus_30_min = unix_timestamp - (5 * 60)


now to past 30 min

 

Thanks for the reply, it's really appreciated. Unfortunately this is a query against Unified Manager, which only captures certain events from clusters. I'm looking for a query straight to the cluster so I can enumerate any event that occurs during the time frame. It appears that, while the CLI supports this to some extent, the API does not. Unfortunate.

donny_lang

How about PowerShell? Looks like you could get the information you need with the "Get-NcEmsMessage" cmdlet. Something like this:

 

Connect-NcController <controller> 
Get-NcEmsMessage -MessageName *fpolicy* -StartTime "9/28/2018 10:29:55"

EDIT: The corresponding ZAPI call for that cmdlet is "ems-message-get-iter" if you'd prefer to query the API directly.  

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public