Jump to content
Jonathan E. Brickman

Template for converting SQL from a Search as RAWSQL?

Recommended Posts

Posted (edited)

I need to build monitors based on Searches, which have a few RAWSQL additions.  For instance, out of all servers needing reboot, I need to reboot just four per day right now, and that means adding a LIMIT 4 to the end of RAWSQL text.  I've been able to paste the SQL from a search directly into RAWSQL, and the query preview works fine, but it never shows anything in Status and never actually triggers the reboot when I set it up.  Anyone have a simple template to make it work, a line or two or three or four to add to SQL copied from a Search, for a RAWSQL internal monitor?

 

J.E.B.

Edited by Jonathan E. Brickman

Share this post


Link to post
Share on other sites
9 hours ago, Jonathan E. Brickman said:

I need to build monitors based on Searches, which have a few RAWSQL additions.  For instance, out of all servers needing reboot, I need to reboot just four per day right now, and that means adding a LIMIT 4 to the end of RAWSQL text.  I've been able to paste the SQL from a search directly into RAWSQL, and the query preview works fine, but it never shows anything in Status and never actually triggers the reboot when I set it up.  Anyone have a simple template to make it work, a line or two or three or four to add to SQL copied from a Search, for a RAWSQL internal monitor?

I will tell you exactly what I tell everyone with a question like this in Slack.

RAWSQL
Official Docs: https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Documentation/070/160/010/020?psa=1#Writing_a_Custom_Query
Helpful Blog - https://gavsto.com/rawsql-help-and-tutorial-a-how-to-plus-an-internal-monitor-example-to-detect-hung-servers-and-run-custom-sql-in-labtech/
The definitive MSPGeek Thread - https://www.mspgeek.com/topic/251--/?tab=comments#comment-20683

Read over those, and you will know everything you need to know. For RAWSQL to work, you just need to return specific columns first, and then specific column names in any order, plus whatever other columns you want. (They will display in the Build and View results, but won't otherwise be part of the alerts, etc.) Once you know what to return for the first two columns, and what other columns you need, the rest is easy.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...