How to set up a monitor in SystemCenter to query a table and then depending on the results perform a task...?
Basically i need to set up a monitor in SystemCenter to query a table and then depending on the results (if over a certain #), have SystemCenter restart a service on another server.There is a firewall between the servers. How can i do this?
July 14th, 2011 12:49am

The ideal way would be to have the monitor run on the server that would need to be restarted - and have that monitor execute a recovery that then asynchronously restarts your service (or tries to) on the same computer running the monitor. The firewall adds a small twist, since the query to the tables needs to be able to either bypass the firewall, or drill through it. A more conventional way would be to fire an alert, and have a task associated with the alert that then lets the server name to be managed by punched in by the operator or via target parameter substitution, and then have that person kick off a local console task that remotely connects to the far away (firewalled) server somehow, and then tells it to restart some service.Microsoft Corporation
Free Windows Admin Tool Kit Click here and download it now
July 14th, 2011 1:27am

I need the steps, are there any blog plosts that outline how to set this up? would this work?...http://blogs.technet.com/b/stefan_stranger/archive/2010/01/21/opsmgr-sql-full-or-differential-backup-check.aspx
July 14th, 2011 1:43am

Hi If it is just one server that has the service that needs to be restarted then Dan provides a good solution in the first part of his response if you do want a fully automated monitor. Step 1 is the blog link you list - you just need to change the SQL query and the return values that are specific to your situation. Stefan has detailed everything but if you are unsure then let us know your query and expected output and we can tweak Stefans code for you. As Dan says, have this run on the server where you want the service restarted and have your firewall team open up ports to allow access to the queried Database. Step 2 is the recovery script to restart the service locally which could be done with wmi \ net start \ sc.exe \ PSExec Cheers Graham View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
July 14th, 2011 9:13am

If you have the license for in your Microsoft Contract, System Center Opalis 6.3 / Orchestrator 2012 Beta could do this action in a very easy way.Christopher Keyaert - My OpsMgr / SCOM & Opalis blog : http://www.vnext.be
July 14th, 2011 9:36am

Lets make sure Im explaining it properly. I want system Center to do the entire thing from checking the sql server and if this count is over a number, then restart a svc on another server. All 3 servers have a firewall inbetween. Server1 = SQL Server a)SystemCenter will point to this server somehow and run a query. b)If the result of the query is over a number, then...... Server2 = IIS Server c) (...cont'd from above)..restart a service on Server2. Server3 = System Center Server Is there any other way to do the above other than this?...http://blogs.technet.com/b/stefan_stranger/archive/2010/01/21/opsmgr-sql-full-or-differential-backup-check.aspx. Would the OLEB data source (under management pack templates) be of any aid? Thanks!
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 11:15am

This is not something you will do running the templates. This is programming and you may want to enlist a friendly programmer to set this up for you.Microsoft Corporation
July 15th, 2011 11:27am

You need to have a script to query the table and get the values and rest all can be done from the SCOM automatically like restarting service on server 2, running the script repeatedly with intervals.... Thanks, SaravanaThanks, Sarav
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 7:14pm

I have a query. I just need the proper steps/procedure to set this up pls. I tested connection to the DB using ole db data source under mp templates in authoring and, it passed the test. How do I get this (depending on the results of this query i have) to restart a certain service on another server?
July 17th, 2011 8:56pm

Hi First, make sure the query works from SCOM, so: 1) Download the script that Stefan used as an example and read his blog: http://blogs.technet.com/b/stefan_stranger/archive/2010/01/21/opsmgr-sql-full-or-differential-backup-check.aspx. What is the operating system of the computer that will run the script to connect to the SQL Server? Target the monitor at this operating system class and mark it as disabled. 2) Once you have done this, enable the script via an override against just that object (the operating system class of the server). Once we can correctly set state then we can work on part 2 which is to restart the service. Cheers Graham View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2011 3:02am

Sorry - didn't read this post closely enough - if you have the SQL part working fine then David Allen walks through starting the service as a recovery task here: http://www.aquilaweb.com/blog/index.php?itemid=77 This also discusses recovery tasks (although in the context of a service monitor): http://tarek-online.blogspot.com/2007/07/monitoring-windows-service-using.html Cheers GrahamView OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
July 18th, 2011 10:39am

Ok, ill check them out..your help is greatly appreciated. I hope Im being clear. Just so i kno we're on the same page.. I have all 3 in separate subnets... 1. Server1 = RMS System Center Server R2 cu3 2. Server2 = SQL server (2008 R2) 3. Server3 = IIS Server (2008 R2) Server1 runs a sql query on Server2, depending on the results of the query Server1 then either does or does not restart the service on Server3.
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2011 11:33am

For this to work, you'll need to make Server 3 the watcher node that runs the SQL query. Then, depending on the result, the recovery task will execute locally on server as per David Allens blog article. Cheers GrahamView OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
July 18th, 2011 11:36am

I also need to create a sql run as account since i dont have one yet, to run the query on the sql db, correct? and the below links?.. http://www.aquilaweb.com/blog/index.php?itemid=77 http://tarek-online.blogspot.com/2007/07/monitoring-windows-service-using.html
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2011 11:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics