Command line interface to SQL Monitor
bolingerm
Posts: 10 Bronze 2
Is there a command line interface (or some other mechanism) to SQL Monitor such that I could create a script to suspend and another script to activate maintenance windows? We have scripts that restart our servers and we would like to include suspending and reactivating monitoring so that alert messages will not be created (as we create text messages to phones from SQL Monitor alert messages). Thanks.
Comments
It would be possible to stop / start our base monitoring service using commands like: "net stop MonitorBaseDeploymentService" and "net start MonitorBaseDeploymentService" but as well as preventing alerts this would stop collection leading to gaps in the data.
Regards
Chris
Test Engineer
Red Gate
Thanks for your response... I don't see a big down side (yet) to the gaps in the data if I disable the base monitoring service as suggested... that data has little value to me and I am assuming the graphical display of previous events (last month, etc.) will just show a drop off when monitoring is turned off and would resume the charting of events indicative of when monitoring was turned back on...I presume I can leave the web service alone and just turn off / turn on the base monitoring service via my OS scripts... or if I turn off just the web service (and leave base monitoring on to avoid the data collection gaps) will this stop email alerts from being sent outbound via the email functionality... my primary goal is to not get my Outlook rule based created text messages from the Redgate email alerts that are created when we are doing our monthly maintenance or server restarts and / or server patching...
Thanks again,
Michael
If your need is just to disable the emails for a specific period of time then it's possible to do this by updating SQL Monitor's data repository directly from your scripts.
Turn emails off (globally):
UPDATE [RedGateMonitor].[settings].[EmailSettings]
SET GlobalAlertEmailEnable=0
Turn emails back on:
UPDATE [RedGateMonitor].[settings].[EmailSettings]
SET GlobalAlertEmailEnable=1
I've tested this and it seems to work. Data collection is not stopped so there won't be any gaps in your data. Alerts are generated and will appear in the Alert Inbox (on the website). They just don't get emailed.
SQLCMD can be used to run the SQL from your OS scripts I believe.
http://msdn.microsoft.com/en-us/library/ms162773.aspx
Hope this helps
Chris
Test Engineer
Red Gate
Thanks again for your timely and detailed response. I have tested this today and intend to use it in production later this month.
Michael