Hi,
Is there any way to get local time of alerts where triggereddatetime stored in UTC time zone . Am using swis query to get data, how to get it in local time zone.
Am using python . Pls suggest
If you'd like to convert the timestamp in the results in SWQL, you can use the ToLocal function:
results1=swis.query("select ac.Name,ac.AlertMessage,ao.RelatedNodeCaption,case when ac.Severity=2 then 'Critical' else 'major' end as Severity,ToLocal(aa.TriggeredDateTime) as Alertime from Orion.AlertActive aa left outer join Orion.alertObjects as ao on aa.AlertObjectID=ao.AlertObjectID left outer join Orion.AlertConfigurations as ac on ac.AlertID=ao.AlertID where ac.Severity=2 and aa.TriggeredDateTime>='2019-02-01 00:00:00' order by aa.TriggeredDateTime desc")
Python has libraries that convert UTC to local time.
Thanks for response. below is the query
results1=swis.query("select ac.Name,ac.AlertMessage,ao.RelatedNodeCaption,case when ac.Severity=2 then 'Critical' else 'major' end as Severity,aa.TriggeredDateTime as Alertime from Orion.AlertActive aa left outer join Orion.alertObjects as ao on aa.AlertObjectID=ao.AlertObjectID left outer join Orion.AlertConfigurations as ac on ac.AlertID=ao.AlertID where ac.Severity=2 and aa.TriggeredDateTime>='2019-02-01 00:00:00' order by aa.TriggeredDateTime desc")
TriggeredDateTime is in UTC time zone. How can i use python method to get ti converted, or is there any way to covert using SWQL functions itself.
SWQL Functions · solarwinds/OrionSDK Wiki · GitHub Please suggest.
Thank you
Hi Dan,
Can you advise how to do the same if we need to convert the timestamp in SQL
I tried using this on a report I send out daily for muted alerts on servers but I'm getting an issue now with the report.
SELECT
n.caption as [Device],
n.IP_Address as [IP],
ToLocal(Alerts.SuppressFrom) as [Mute from],
ToLocal(Alerts.SuppressUntil) as [Mute Until]
FROM Orion.AlertSuppression AlertS
JOIN Orion.nodes n ON n.uri = AlertS.EntityURI