Answered by:
Create Alert based on output from SQL Script

Question
-
I know this has been asked before on this forum but a lot of the links point to non-existent page.
I'm hoping to accomplish this using PowerShell, as this should be easier to support in the long term than VBScript
Could someone outline the steps to create an alert which would run a script and return Red/Green state based on results. One important criteria is that the script needs to know when it was last run so that it won't return duplicate alerts.
Thanks
Thursday, September 15, 2016 2:25 PM
Answers
-
Similar to other post - this runs through creating this:
Regards
Regards Graham Senior Premier Field Engineer (UK) - System Center Operations Manager
Thursday, September 22, 2016 5:41 PM
All replies
-
Hi Sir,
>>One important criteria is that the script needs to know when it was last run so that it won't return duplicate alerts.
I assume monitor covers your needs .
If it is possible , I'd suggest you to use VB script to do that , because the default script language is VB .
Please check the following article regarding Two state monitor VB SQL query script :
And, this article explained VB SQL query script :
http://www.4guysfromrolla.com/webtech/faq/databases/faq4.shtml
ALso, this similar thread:
In addition, two state powershell monitoring :
http://scug.be/dieter/2014/04/24/scom-creating-a-powershell-script-monitor-with-silect-mpauthor/
And, using PS to connect to SQL and query :
https://technet.microsoft.com/en-us/magazine/hh855069.aspx
Hope it is useful to you .
Best Regards,
Elton
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.Monday, September 19, 2016 1:42 PM -
Thanks for the reply, it answers my question perfectly.
Unfortunately, I realised soon after that an alert wouldn't work as I hoped.
I am collecting failed jobs from a SQL table, so I think this is a rule. I'm looking into rules now.
Monday, September 19, 2016 3:03 PM -
Similar to other post - this runs through creating this:
Regards
Regards Graham Senior Premier Field Engineer (UK) - System Center Operations Manager
Thursday, September 22, 2016 5:41 PM