Quantcast
Channel: THWACK: All Content - All Communities
Viewing all articles
Browse latest Browse all 20205

The Magic of SWQL: Create "All Components With Problems" Resource With Clickable Links, Status Icons and Even Hovers As A Bonus

$
0
0

Here is how your end result will look like - BEAUTIFUL

 

abc.JPG

 

========================================================

Here is what you do to create it:

 

1. Add "Custom Query" component on your page

2. Use the following SWQL query to return all components with problems, including their Statistic and Message values for different types of components, which is very handy if you have different monitoring scripts:

 

SELECT  
 '' AS SEV,
 n.Caption AS NODE,
 a.Name AS APP,
 c.ComponentName AS CMPNT,  
 ce.AvgStatisticData AS STAT,  
 ce.ErrorMessage AS MSG,
 '/Orion/images/StatusIcons/Small-' + c.StatusDescription + '.gif' AS [_IconFor_SEV], 
 '/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N%3a' + ToString(n.NodeID) AS [_LinkFor_NODE],
 '/Orion/APM/ApplicationDetails.aspx?NetObject=AA%3a' + ToString(a.ApplicationID) AS [_LinkFor_APP],
 '/Orion/APM/MonitorDetails.aspx?NetObject=AM%3a' + ToString(c.ComponentID) AS [_LinkFor_CMPNT],
 '/Orion/APM/MonitorDetails.aspx?NetObject=AM%3a' + ToString(c.ComponentID) AS [_LinkFor_STAT],
 '/Orion/APM/MonitorDetails.aspx?NetObject=AM%3a' + ToString(c.ComponentID) AS [_LinkFor_MSG]
FROM
 Orion.APM.Component(nolock=true) c  
 JOIN Orion.APM.CurrentComponentStatus(nolock=true) ccs ON c.ComponentID = ccs.ComponentID  
 JOIN Orion.APM.ChartEvidence(nolock=true) ce ON ce.ComponentStatusID = ccs.ComponentStatusID
 JOIN Orion.APM.Application(nolock=true) a ON c.ApplicationID = a.ApplicationID
 JOIN Orion.Nodes(nolock=true) n ON a.NodeID = n.NodeID
WHERE 
 ce.AvgStatisticData IS NOT NULL AND 
 a.StatusDescription NOT IN ('Unmanaged') AND 
 c.StatusDescription NOT IN ('Up')

 

That's It! Enjoy!

 

You can then add more filters in "WHERE" section to further restrict and show only components that you are interested in. I have created a whole bunch of them . I advise you to use SWQL Studio from Orion SDK, which makes query building process much more fun and you can see the whole structure of tables in-font of you

 

If you will experience any problems - please post them below so that we can solve them here and come up with common universal resource for displaying any issues on a component level if there are any issues with the above query

 

CREDITS: Petr Vilem, lukas.belza for helping me at [SOLVED] SWQL Query: How Do I Output "Statistic" and "Message" Values For The Component?

 

--

Alex


Viewing all articles
Browse latest Browse all 20205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>