This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Advanced Alert Reporting part 4: Creating an Acknowledge Link Where Once There Was None

camera-1867184_1280.jpg

We've arrived at the final installment of my technical deep-dive into advanced OrionRegistered 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:

  1. It's modal—meaning it pops up on top of everything else
  2. 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

  1. It's actually JavaScript.

Now I'm certain that some enterprising person could embed JavaScript into an Orion custom report. In fact, I challenge you readers to do so, and post your results to the THWACKRegistered product forums and the Content Exchange to share with everyone. But I'm a man who knows his limitations—both in terms of programming skill and the time I have to devote to this side project—so I'm going to go with an easier option: I'm going to use the "Acknowledge" link you can find in an email alert.

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.

pastedImage_0.png

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.

pastedImage_1.png

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=".

pastedImage_2.png

By concatenating the AlertDefID onto the end of that URL, I'm in busine...

Hang on, it threw an error.

pastedImage_3.png

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:

tostring(AlertObjects.AlertObjectID)

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:

pastedImage_6.png

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.

Parents Reply Children
No Data