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.

SQL Query used in alerts

Hi all,

There may be an easier way to do this (and if so, please tell me), but I'm trying to create a Custom SQL Alert for when a server has less than a stated amount of memory free.

I create my trigger condition and I'm starting with the query:

select Nodes.SysName from Nodes where  (TotalMemory - MemoryUsed) < 4096000000

When I try to validate I get not "Query condition is not valid". 

1.  Is there a pointer to a SQL Alerts 101 page on THWACK?  When I search I get a lot of forum posts for very specific asks, but I haven't seen anything on the fundamentals.

2.  Does anyone know what the query parser is looking for in the query and what the query needs to be an effective filter?  If I run this query against the orion sql database, it runs fine.

Thank you,

Gary

  • Try building out a similar alert with the alert builder UI.  Once you have something close you can click on the arrow and expand to show the alert in SWQL.

    This section of the WebUI

         pastedImage_0.png

         With some more context

              pastedImage_1.png

    I would wrote up something close:

         pastedImage_3.png

         Comes out in SQWL like this:

              SELECT E0.[Uri], E0.[DisplayName]

              FROM Orion.Nodes AS E0

              WHERE ( ( E0.[MemoryAvailable] < '4096000000' ) )

    Switching the alert over to 'Custom SWQL Alert (Advanced)'

         pastedImage_0.png

    I just paste in the WHERE clause and replace E0. with Nodes.  Custom alerts specify the 'AS' and I usually write these up in SQWL studio and use Notepad++ to replace all.

  • To more directly answer your question.  You will want to look into SWQL.  Here is a link to get you started.  SWQL studio can be downloaded here.

  • Thanks for both responses.  I was making a rookie mistake and not realizing that the Select part was already provided.  I did find a more straightforward way of doing this, but your example is very helpful, as are the links.  I really appreciate it.

  • No problem, glad it helped.  Don't be to hard on yourself I did the same thing with leaving the SELECT and FROM in there, and often do when I copy it over from SQWL Studio emoticons_plain.png