1 Reply Latest reply on Sep 24, 2018 12:55 PM by mesverrum

    Can you use SWQL functions within SWQL queries in Alerts?

    ouberlord

      Background: We want to set up Orion so that certain teams get alerts on their own nodes.  We want to leverage custom properties to do this, so that one alert for "Node Down" can cover all teams (such as how people have done here: https://thwack.solarwinds.com/docs/DOC-177456).

       

      I was wondering if it is possible to utilize SWQL functions within the query.  For example, I have a customer property called "TonyTest".  It contains the following info: "FirstName LastName (email@domain.com)".  In SWQL Studio I've written and successfully executed this query:

       

      SELECT SubString(TonyTest,(CharIndex('(',TonyTest))+1,((CharIndex(')',TonyTest))-((CharIndex('(',TonyTest))+1))) AS TonyTest

      FROM Orion.NodesCustomProperties

      WHERE NodeID = '1491'

       

      This succeeds in just pulling the email address, by only grabbing the string of text in between the opening and closing parenthesis.  The idea being we can have the custom property contain both a descriptor for the group as well as their email address, but just pull the email address out.

       

      However, when trying to create the query for the alert's email To: field I am not having any luck.  I am trying the following in the To: field:

       

      ${N=SWQL;M=SELECT SubString(TonyTest,(CharIndex('(',TonyTest))+1,((CharIndex(')',TonyTest))-((CharIndex('(',TonyTest))+1))) AS TonyTest FROM Orion.NodesCustomProperties WHERE NodeID = '${N=SwisEntity;M=NodeID}'}

       

      When I click "NEXT" I get an error of "Please specify a valid email address." and it won't let me proceed.

       

      Can you use SWQL functions within the query type like the ones that start with "${N=SWQL"?