Hi,
Here is what i have:
It basically display the node, when it was down, and how many hours it is down based on the current system time.
It checks for node status, so if a node is up, it will disappear from the list.
Here is my code:
Please take note that i have some custom properties i have created (City, Device_category)
Also, i don't like icons, so i did not include it on my code, there is a link though.
SELECT
Nodes.Caption AS NodeName,
'/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N%3a' + ToString(Nodes.NodeID) AS [_LinkFor_NodeName],
Nodes.Customproperties.City AS Location,
HOURDIFF(T1.DownTime, GetDate()) AS HoursDown,
Nodes.IP_Address,
T1.DownTime,
Nodes.NodeID FROM (SELECT MAX(EventTime) AS DownTime,
NetObjectID,
NetworkNode
FROM Orion.Events
WHERE (EventType = 1)
AND (NetObjectType = 'N')
GROUP BY NetObjectID, NetworkNode)
AS T1 INNER JOIN Orion.Nodes
ON T1.NetworkNode = Nodes.NodeID
WHERE(Nodes.Status = '2')
AND (Nodes.Customproperties.Device_category = 'Router')
ORDER BY HoursDown ASC,
Nodes.Caption,
T1.DownTime ASC,
Nodes.NodeID
Hope this helps.
Augie