I am looking to input the alert delay time, the "Condition must exist for more than x", into the email trigger action as a variable. Does anyone know if this is possible?
doable, but SQL and ugly...This is because you have to take into consideration the core template, whether overridden or not and if both are blank.
below SQL gives you x of y polls
html part adds prior, the frequency of polling
-- replace '' with your defaults like 300 sec
something like:
select Criticalpolls=
CASE WHEN t.Criticalpolls is not null THEN t.CriticalPolls
WHEN t.Criticalpolls is null THEN t2.CriticalPolls
ELSE ''
END
from APM_Component c WITH (NOLOCK)
left join APM_Threshold t WITH (NOLOCK) on c.id=t.id and t.ThresholdName like 'Stat%'
left join APM_Threshold t2 WITH (NOLOCK) on c.TemplateID=t2.id and t2.ThresholdName like 'Stat%'
where (c.ID=${N=SwisEntity;M=ComponentAlert.ComponentID} OR c.ID is null)}
-- out of
select CriticalpollsInterval=
CASE WHEN t.CriticalpollsInterval is not null THEN t.CriticalPollsInterval
WHEN t.CriticalpollsInterval is null THEN t2.CriticalPollsInterval
where (c.ID=${N=SwisEntity;M=ComponentAlert.ComponentID} OR c.ID is null)
or in HTML:
<td valign='top'>Threshold Statistics (if set):
PollFrequency: ${SQL:select val = CASE WHEN apps.[Key] like '%[_][_]Frequency%' THEN apps.value ELSE (isnull(ats.Value,'')) END from APM_Component c WITH (NOLOCK) left join APM_ComponentTemplate ct WITH (NOLOCK) on c.templateid=ct.id left join APM_ApplicationTemplateSetting ats WITH (NOLOCK) on ct.ApplicationTemplateID=ats.ApplicationTemplateID left join APM_ApplicationSetting apps WITH (NOLOCK) on (c.ApplicationID=apps.ApplicationID and apps.[Key] like '%[_][_]Frequency%') where c.ID=${N=SwisEntity;M=ComponentAlert.ComponentID} and (ats.[Key] like '%[_][_]Frequency%' or ats.[key] is null)}
${SQL:select Criticalpolls=CASE WHEN t.Criticalpolls is not null THEN t.CriticalPolls WHEN t.Criticalpolls is null THEN t2.CriticalPolls ELSE '' END from APM_Component c WITH (NOLOCK) left join APM_Threshold t WITH (NOLOCK) on c.id=t.id and t.ThresholdName like 'Stat%' left join APM_Threshold t2 WITH (NOLOCK) on c.TemplateID=t2.id and t2.ThresholdName like 'Stat%' where (c.ID=${N=SwisEntity;M=ComponentAlert.ComponentID} OR c.ID is null)} out of ${SQL:select CriticalpollsInterval=CASE WHEN t.CriticalpollsInterval is not null THEN t.CriticalPollsInterval WHEN t.CriticalpollsInterval is null THEN t2.CriticalPollsInterval ELSE '' END from APM_Component c WITH (NOLOCK) left join APM_Threshold t WITH (NOLOCK) on c.id=t.id and t.ThresholdName like 'Stat%' left join APM_Threshold t2 WITH (NOLOCK) on c.TemplateID=t2.id and t2.ThresholdName like 'Stat%' where (c.ID=${N=SwisEntity;M=ComponentAlert.ComponentID} OR c.ID is null)}