All, I am looking for some SWQL/SQL code that can pull out the following information from the database.
Columns Include:
- Device Name
- IP Address
- Time Down
- Time Up
- Minutes Node was down
All, I am looking for some SWQL/SQL code that can pull out the following information from the database.
Columns Include:
You can use this query as an SWQL report or as a Query Widget. It is excellent as a widget as it includes hyperlinks. Credit to the original creator for adding all the comments!
select n.caption as [Device…
OK... the start of this query was online somewhere...i have made it my own... OF COURSE>>>>> IF YOU USE THIS IN A LIVE ENVIRONMENT, it is not supported by SolarWinds! USE AT YOUR OWN RISK…
Just be forewarned that the "Events" table (one of the sources of this query) typically does not have the same historical settings as the Response Time details tables.
If you are trying to use SQL... try this...
SELECT * from ( SELECT StartTime.EventTime AS DownEventTime, (SELECT TOP 1 EventTime FROM Events AS Endtime WHERE EndTime.EventTime >= StartTime.EventTime AND EndTime.EventType = 5 AND EndTime.NetObjectType = 'N' AND EndTime.NetworkNode = StartTime.NetworkNode AND EventTime IS NOT NULL ORDER BY EndTime.EventTime) AS UpEventTime, Nodes.Caption, StartTime.Message, DATEDIFF(Mi, StartTime.EventTime,(SELECT TOP 1 EventTime FROM Events AS Endtime WHERE EndTime.EventTime > StartTime.EventTime AND EndTime.EventType = 5 AND EndTime.NetObjectType = 'N' AND EndTime.NetworkNode = StartTime.NetworkNode ORDER BY EndTime.EventTime)) AS OutageDurationInMinutes FROM Events StartTime INNER JOIN Nodes ON StartTime.NetworkNode = Nodes.NodeID WHERE (StartTime.EventType = 1) ) as uptimetable WHERE outageDurationInMinutes IS NOT NULL ORDER By DownEventTime DESC
Thanks John its working,
But somehow its not taking all the down event against a device. Eg. there is a device for which I can see 3 down/up event in web console events tab for last month but SQL output shows only first two down/up even pair.
I am not sure why this behavior, please suggest.
Trying to modify it to group by Device and Order by Down Event in descending order but getting an error.
Trying to modify it to group by Device and Order by Down Event in descending order but getting an error. What is the syntax for that?
Show me what you have tried, and the error you receive, please
Also, are you using SQL? or SWQL Query?
I'm using SWQL for Stevenstadel's query and getting the "there was an error processing the request" message.
I tried placing "group by n.Caption" immediately before the "order by" statement at the end.
Sorry, i will have to see your version of the code... for example.. your query will not work unless you comment out line 7... show your version of the code for assistance
Sorry to take so long to respond. Got off on other things. So I have almost everything I need here wit this query, but I still need:
1. To filter the report based on a specific customer using the node custom property "CustomerName".
2. Need different time frames, specifically, Yesterday, Last Week and Last Month.
How can I do all of these?
Appreciate it.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK© online community. More than 180,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.