We've arrived at the final installment of my technical deep-dive into advanced Orion web-based report techniques, which all started when a customer asked if I knew anyone who could help build an "impossible" feature for them.
Spoiler: it was neither impossible nor was it even a feature.
In my first post I introduced the whole concept (Advanced Reporting Part 1: Re-Creating the "All Alerts" Resource With Extras ). In the second (Advanced Reporting part 2: Making Web-Based Reports Do Your Bidding ), I showed how to add custom fields, such as "importance," to an existing report using the SolarWinds Query Language (SWQL). And in the third post (Advanced Alert Reporting part 3: Hyperlinks in Data Output ) I dug into ways to make data elements clickable by combining HTML with the SWQL output.
And here, in this last post, I'm going to show how to use those two techniques to add an Acknowledge option, so that a report showing the current active alerts can be used by NOC staff to also manage those alerts, in addition to simply listing them out.
As a reminder, I've already built this report and posted it to the Content Exchange (Report: All Active Alerts with Acknowledge action ), in case you'd like to use it as a starting point for your own custom reporting adventure.
Be Alert. The World Needs More Lerts.
When you look at the original "All Active Alerts" page in a standard Orion installation (here's an example from our live demo: https://oriondemo.solarwinds.com/Orion/NetPerfMon/Alerts.aspx ), there's a few things that you may notice about the "Acknowledge" item:
- It's modal—meaning it pops up on top of everything else
- It's interactive—you can add notes, set a permanent option not to be prompted, cancel out, etc.
...and, if you look at the underlying code on the Alerts.aspx page, you'll note that
What? You've never set up an email alert with an embedded "acknowledge" link? Well let's rectify that situation right now.
First, create a new alert.
It doesn't really matter what we call it, and it doesn't even really matter what the alert triggers on, as long as it triggers at least once. The most important step is to set up an email alert and embed the acknowledge alert link variable.
<IMG email trigger action with acknowledge link>
Once it's done, I'll kick off that alert, receive the email, and see what that link looks like.
Let's SWQL One More Time
Now that I know what the link looks like, I have to go back to SWQL studio and see if I can find that link or at least a portion of it embedded SOMEWHERE. After just a bit of searching, I found it in the AlertObjects table, where there's an AlertDefID field that matches up with the tail-end of the standard alert URL "/Orion/Netperfmon/AckAlert.aspx?AlertDefID=".
By concatenating the AlertDefID onto the end of that URL, I'm in busine...
Hang on, it threw an error.
The issue here is that the URL is a word-based object (a "string" or "varchar" in in more technical parlance) but the AlertDefID is a numeric value. So, we need to convert them to match. Since you can't make words into numbers, we'll have to convert the AlertDefID number so that it's treated as a string:
The final field description would look like this:
'<A HREF="/Orion/Netperfmon/AckAlert.aspx?AlertDefID='+tostring(AlertObjects.AlertObjectID)+'" target="_blank">ClickToAck</a>' AS AcknowledgeIt
I'll add that to my SWQL statement, update it in the report definition, add the "AcknowledgeIt field to the report, and I have something that looks like this:
The Mostly Un-Necessary Summary
Throughout this series, I hope I've shown that seemingly challenging, "advanced" tasks are nothing more than the combining of relatively simple, common skills or bits of knowledge in new and creative ways. While every IT practitioner cannot be expected to have every combination of these techniques and concepts, what IS true is that you can take what you have now and think about how it can be re-used; and as you grow in your skills, knowledge, and experience, that base of creativity only grows.
But that's not all!
In my next post (which will appear over on GeekSpeak), I'll take an introspective turn, and talk about what I learned in all of this from a philosophical, rather than technical, point of view.