I want to build an alert variable that will state the threshold name when an APM component has triggered a warning or critical status such as CPU, Memory, Statistic etc. Shockingly there is no built in alert variable from SAM 6.2.4 for this purpose either. However the problem I'm running into is the limitation of the SQL macro. Apparently you can't use IF/ELSE logic or even multiple Selects. I wish StatusOrError condition would list threshold condition but it doesn't so I must build my own variable.
This is a snip of my Component Alert Email to give you context
Component: ${N=SwisEntity;M=ComponentAlert.ComponentName}
Status: ${N=SwisEntity;M=ComponentAlert.ComponentAvailability}
Details: ${N=SwisEntity;M=ComponentAlert.StatusOrErrorDescription}
Cause: {SQL: Select statement where the threshold name will be selected. If none is present this variable will be blank which is fine.} "CPU Threshold"
1.) Where are the rules documented for the SQL macro?
2.) Is there a table in the SolarWindsOrion database that states which APM component threshold has been breached?
2a.) If not I can calculate this from the APM_AlertsAndReportsData view but I'm limited by the single select where if the component has multiple threshold breaches only the first will be listed.
Sample SQL Variable
|
---|
${SQL: SELECT Top 10 (SELECT 'Physical Memory Threshold' From APM_AlertsAndReportsData Where APM_AlertsAndReportsData.PercentMemory > APM_AlertsAndReportsData.[Threshold-PhysicalMemory-Warning] AND ComponentID=${N=SwisEntity;M=ComponentAlert.ComponentID}); (SELECT 'Virtual Memory Threshold' From APM_AlertsAndReportsData Where APM_AlertsAndReportsData.PercentVirtualMemory > APM_AlertsAndReportsData.[Threshold-VirtualMemory-Warning] AND ComponentID=${N=SwisEntity;M=ComponentAlert.ComponentID})} Repeat nested select statements for each type of threshold. When I build this in SSMS the query works but due to the limitations of the SQL macro in the Alert Action it only returns the first nested select. The expected output would be the name of the threshold(s) if breached. "Physical Memory, Virtual Memory, CPU" etc |
Any SQL help would be appreciated.