Is it possible to query the SWQL via a REST call (i have a working script to do this so far) - but to query just for events that have occurred in the last X minutes or seconds? I have looked at https://support.solarwinds.com/Success_Center/Network_Performance_Monitor_(NPM)/How_to_use_SolarWinds_Query_Language_(SWQL) which is useful to help generate basic queries, but it doesn't seem to list an option to check certain time frames easily. In regular MySQL i would do something like TimeStamp >= UNIX_TIMESTAMP() - 300 (where TimeStamp is the EventTime in our case i believe). Is something like this possible? Thanks for your assistance in advance.
Sure. The functions available in SWQL are here: SWQL Functions · solarwinds/OrionSDK Wiki · GitHub. To get the events in the last 5 minutes, I would start with a query like this:
SELECT EventTime, MessageFROM Orion.EventsWHERE EventTime > ADDSECOND(-300,GETUTCDATE())
tdanner - thank you for the response. When i try this either via my script or SWQL Studio i get error messages for the function calls.
In Studio, it errors on GETUTCDATE() with "Function GETUTCDATE not found" and from my script (perl) i get an error with the ADDSECONDS() like "Message":"Function AddSecond not found".
Does this mean i don't have the right or latest version of the SDK available to me? What information could i possibly give you that would help?
Thanks once again for your support and time.
In SWQL Studio, are you using the "Orion (v3)" server type?
Wow, that was fast..ninja.
It lists v2 in the tabs when i open multiple queries. (i assume this is grabbed from the server and isn't a setting i can change from the client).
Thanks!