Поделиться через


Using a recovery in OpsMgr - Basic

<!--[if lt IE 9]>

<![endif]-->

Comments

  • Anonymous
    January 01, 2003
    Do you have a procedure for scenario that you talked about in your last paragraph?  I have a need to attempt recovery about three times then raise an alert that can be forwarded to the responsible tech.  Any help will be appreciated. send response to: npagonor@up.com Thanks.

  • Anonymous
    January 01, 2003
    Here is what we did to address the scenario Kevin talks about in the last paragraph. Hope this helps:

    'Start the service (in this case I am playing with the Windows Update Service)
    strServiceName = "wuauserv"
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!.rootcimv2")
    Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
    For Each objService in colListOfServices
    objService.StartService()
    Next

    ' Sleep 10 Seconds
    WScript.Sleep(10000)

    ' Check to see if service is running
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!&quot; & strComputer & "rootcimv2")
    Set colRunningServices = objWMIService.ExecQuery _
    ("select State from Win32_Service where Name = 'wuauserv'")

    ' Write the status of running / not running to the event log
    For Each objService in colRunningServices
    If objService.State <> "Running" Then
    Set WshShell = WScript.CreateObject("WScript.Shell")
    strCommand = "eventcreate /T Error /ID 111 /SO _DW_SCOM_SrvcMntr /L Application /D " & _
    Chr(34) & "Net start of the Windows Update Service has failed." & Chr(34)
    WshShell.Run strcommand
    ElseIf objService.State = "Running" Then
    Set WshShell = CreateObject("WScript.Shell")
    strCommand = "eventcreate /t Information /ID 100 /SO _DW_SCOM_SrvcMntr /L Application /D " & _
    Chr(34) & "Net start of the Windows Update Service has succeeded." & Chr(34)
    WshShell.Run strcommand
    End If
    Next

  • Anonymous
    January 01, 2003
    Correction to my last comment: ... The comment made by Dipsg can be found here:
    http://blogs.technet.com/b/fesiro/archive/2012/11/26/how-to-configure-command-notification-in-scom-2012-with-powershell-script.aspx

    Essentially both posts are worth looking at when addressing the last paragraph of this article.

  • Anonymous
    January 01, 2003
    That is not possible, unfortunately. This is because the alert is generated by the statechange.  The recovery is also kicked off in response to a state change.  These are simultaneous processes which run in parallel and are not connected, therefore there is no way to make the recovery output dump into the alert - because the alert has already fired. What you can do is have the recovery output also log another event, input the data into the event - then not alert on the monitor, but on the event itself in another workflow.

    • Anonymous
      December 05, 2017
      Hi Kevin, It would be very beneficial to know where the diagnostic output is saved in the SCOM database? for example the output the diagnostic task 'List Top CPU Consuming processes' produces?Also is there a way I can retrieve the diagnostic output through Powershell?
  • Anonymous
    January 01, 2003
    The comment has been removed

    • Anonymous
      September 10, 2016
      Hi Kevin,In Exchange MP, all exchange services get monitor by one unit monitor. Do I need to create recovery task for each exchange service?How can we automate unit monitor which monitors many services?
  • Anonymous
    January 01, 2003
    Looks like the "best practice" means of addressing the last paragraph is to use Orchestrator. Here a good write-up of the process. ... Also, see the comment made by Dipsg on 17 Sep 2013 4:19 AM

    http://blog.coretech.dk/jgs/sco-2012-scom-2012-best-practice-monitor-alert-and-restart-a-service/

  • Anonymous
    July 21, 2010
    Kevin, Great writeup...Is it possible to include the results from the Diagnostic and Recovery task in the alert description?  This would be very useful when our support team gets a ticket for an alert such as Total CPU Utilization Percentage that includes the List of Top CPU Consuming processes as well without opening the Health Explorer. Thanks, Huy

  • Anonymous
    March 28, 2011
    Hello, thanks for this great article! It is possible to send an email notification when recovery task was excecuted? SCOM is going to start the service that´s ok, but I want to know when a service was stopped and SCOM restarted it.

  • Anonymous
    March 31, 2011
    The comment has been removed

  • Anonymous
    April 19, 2013
    How do I tell if a recovery task actually executed?  I have one configured and it appears to work most of the time, but occasionally it appears to fail and I'm trying to research why.

  • Anonymous
    April 19, 2013
    So, it appears that there is a view in the Operaitons Manager Database (SCOM 2007 R2) called RecoveryJobStatusView.  It's not readily apparent to me how it's intended to be used, but I can clearly see that my recovery task was executed (based on the timing of the TimeStarted field adjusted for UTC. The Output field is less than helpful: <DataItem type="System.CommandOutput" time="2013-04-19T09:52:16.1126762-04:00" sourceHealthServiceId="DC410D98-C067-3351-D2A0-1E1E4CF6069D"><StdOut></StdOut><StdErr></StdErr><ExitCode>0</ExitCode><ProcessError></ProcessError></DataItem> There are no errors to indicate that the command failed (it's an OS command that runs).  But I find no evidence that that task actually kicked off. A little help?  Some guidance?

  • Anonymous
    November 27, 2013
    Great article Kevin! Do you know how often this check is performed? and is that configurable?

  • Anonymous
    January 21, 2014
    Hi Kevin, Is there a way to run a linux command as a part of the recovery task for the monitor? A little help would be great!

  • Anonymous
    February 18, 2014
    is it possible to do agentless monitoring of windows server machine which is in work group

  • Anonymous
    February 20, 2015
    Hi Kevin,
    I have an event based monitor, I need to crate recovery based on another event id for example monitor will generate and alert when it sees event id 1234 and it has to recover and close the alert when event id 5678 occurs is this possible? if yes can you tell me how to achieve it?

  • Anonymous
    September 10, 2016
    Hi KevinIn Exchange MP, all exchange services get monitor by one unit monitor. Do I need to create recovery task for each exchange service?How can we automate unit monitor which monitors many services?

    • Anonymous
      September 22, 2016
      Kevin - not sure this is 100% on topic... I have a SCOM2K12 MP in which a state goes unhealthy if a specific event ID (let's say 27) is logged in the Application log. It goes back to healthy if a different event ID (let's say 28) is logged. Generally, SCOM will generate an alert when Event ID 27 fires. Sometimes, event ID 28 will fire within say 30 seconds of event ID 27. Is it possible that SCOM doesn't poll the state health frequently enough to fire a notification? Could it maybe be checking every X minutes before generating a notification?
  • Anonymous
    October 05, 2016
    Hi Kevin,I need help regarding configuring the Recovering Task in SCOM for Web Application Availability Monitor.Scenario is: We have multiple application endpoints which are hosted on different App Pool in IIS. We need to set up recovery task in SCOM so that if there is any alert regarding Web Application Availability Monitor for a particular endpoint, it go on restart the App Pool which hosts that particular endpoints and not other App Pools. Environment: SCOM MS in Azure, Agents in In-house DCJust wanted to check whether such kind of Customization is possible in SCOM? If yes, please guide me how to set up this.

  • Anonymous
    November 21, 2016
    Hi Kevin, could you please suggest which account can we use for action account either "Local System Action Account" or "Domain account". becoz we dnt see any result of using these recovery tasks with "Local System Action Account". We have multiple domains.Thanks.

    • Anonymous
      November 21, 2016
      I always recommend use of Local System for the default action account.Local system has full rights to start/stop services on a computer - so it won't be a rights issue.
      • Anonymous
        February 03, 2017
        Hi Kevin, Thanks.Does this requires any trust between different domain. As I see recovery tasks are working good on the machines which are same domain as SCOM MS and cannot run on the servers which are in different domain.
        • Anonymous
          February 03, 2017
          No. The recoveries run as default agent action account. The same as the monitoring workflows. You should use Local System.
          • Anonymous
            February 28, 2017
            Hi Kevin, How can we enable "Recalculate monitor state after recovery finishes"Thanks
  • Anonymous
    May 04, 2017
    Hi Kevin;Thanks for Great article as always...I configured the Monitor in SCOM to monitor a log file for modified time is <10 minutes else generate alert. which works fine.Also configured recovery task for this monitor to restart the application service and wrote a vb script for the same. Script work fine when run it with elevated privilege CMD but on normal CMD prompt it give access denied error.I am not sure SCOM 2012 R2 will run recovery task script under elevated privilege or not. As my recovery script is not running successfully.( Service suppose to restart does not)Also where I can find the logs to check if recovery task run properly in SCOM.regards;Nilesh Gavali.

  • Anonymous
    August 27, 2017
    Hello Kevin,Configured Monitor to monitor Log file, if log file is not updated for last 20 minutes it will trigger alert and run diagnostic task to stop one of the service then start it.But facing challenge as need to know how recovery task run in sequence as we have first recovery task to stop service and second task to start the same service.recovery task are running but the sequence of task are wrong. fist it should stop the service instead it run start service task then stop service.there is now way we can make out which sequence it should follow.need help to get this clarify.