I'm writing a report that will show active alerts which have triggered emails to the NOC's ticketing system. The alert is of course an advanced SQL query in report writer. I've made some good progress but have hit a sticking point. Here's what I have so far:
SELECT Distinct AlertStatus.TriggerTimeStamp, AlertStatus.ObjectName, AlertDefinitions.AlertName
FROM AlertStatus, AlertDefinitions, AlertLog, ActionDefinitions
WHERE AlertStatus.AlertDefID = AlertDefinitions.AlertDefID
AND AlertStatus.AlertDefID = AlertLog.AlertDefID
AND AlertStatus.AlertDefID = ActionDefinitions.AlertDefID
AND AlertLog.ActionType = 'EMail'
AND AlertStatus.ActiveObject = AlertLog.ObjectID
AND ActionDefinitions.Target like '%freuheat%'
Order By TriggerTimeStamp Desc
It works pretty well and gets details about all of my currently active email alerts. The problem comes from APM alerts. The "Object Name" is simply the Application Name, so if a website is down it shows simply "HTTP Monitor". I need a way to at least link it back to the node so it's possible to tell what is actually being affected. The same thing exists in the standard built in Orion "Alerts" screen, but at least there you can mouse over and get the device name. I was thinking there might be a way to link the AlertLog.ObjectID or AlertStatus.ActiveObject back to somewhere else, but not sure where. Also would need to use some kind of if statement in there to only do that on APM Objects. The only other possibility I could think of was to use a regex to pull the node name out of the email alert itself in AlertLog.Message, but just like if statements in SQL I don't know how to do this.
So anyone have any ideas?