none
Diagnostic Action --> Recovery Action

    Question

  • Hello!

    Two questions to today:

    1. I created a Monitor with a Diagnostic Action (microsoft.windows.ScriptProbeAction) that I want use only to return to SCOM Operator a string (and not to change the system state). In order to show the output I add a wscript.echo but in the Monitor summary I can not see any output also if I can read that the script has been executed. What kind of stuff should I modify in order to show the output?
    2. Then I created also a Recovery Action (microsoft.windows.ScriptWriteAction) that should take in input the output of the Diagnostic Action but I do not know what kind of string pass to this Recovery Action in the Arguments field.

    Can you help me with some example?

    Thank you and bye!

    Lizzie!

    Tuesday, April 20, 2010 3:47 PM

Answers

  • I see a couple of issues here.  First, you're using a variable StateTypeData used for the typed property bag, but I don't see that variable getting defined anywhere.  You really don't need a typed property bag here.  Could just use CreatePropertyBag.

    You're also trying to pass a string with a carriage return as a script argument.  That typically causes problems as the command line sees that as multiple arguments.  Probably be better to pass that information as separate values in the property bag.

    I just put up a sample MP showing how to have a recovery run after a diagnostic and pass property bag data between them.  Pretty similar to the basic concept of what you're trying to do here.  http://www.opsmanjam.com/OpsManJam%20Library/Forms/MPAuthor.aspx?RootFolder=%2FOpsManJam%20Library%2FManagement%20Packs


    This posting is provided "AS IS" with no warranties, and confers no rights. Use of attachments are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
    Monday, May 03, 2010 4:13 PM
    Moderator

All replies

  • Hi

    1. Is 'Run automatically' set to 'yes'?

    2. Did you read this? http://blogs.msdn.com/mariussutara/archive/2007/11/20/data-item-xml-monitortaskdatatype.aspx


    http://OpsMgr.ru/
    Tuesday, April 20, 2010 4:18 PM
    Moderator
  • Hi Alexey,

    Both the Diagnostic and Recovery actions are set to "Run Atuomatically". I did not know the link you kindly gave me.

    I tried what explained in the link submitting a propery bag in the Diagnostic tak and passed it as argument to the Recovery task but it seems not working anyway because:

    I still can not see any output coming from the Diagnostic action

    The Recovery action seems not started.

    This is the output of the State Change of the Event:

    <...>
    Event Data:

    Diagnostic and Recovery Options:
     
     Diagnostic Tasks:
     
      Diagnostic Monitor 3 
     Task History:
     
      Diagnostic task ran successfully:  Diagnostic Monitor 3
      Scheduled Time:  4/21/2010 9:20 AM
      Start Time:  4/21/2010 9:20 AM
      Finish Time:  4/21/2010 9:20 AM
      Submitted by:  
      Diagnostic Output:  No output text was available
        The diagnostic task ran successfully. You may attempt a recovery by passing this output information to the recovery task(s) listed below.
        Recovery Tasks:
        
         Recovery Monitor 3

     
     

     following you have the xml with the two actions (hoping you can help me):

          <Diagnostic ID="POCs.Diagnostic.Monitor3" Accessibility="Internal" Enabled="true" Target="POCs.G2" Monitor="POCs.Monitor3" ExecuteOnState="Error" Remotable="true" Timeout="10">
            <Category>Custom</Category>
            <ProbeAction ID="Script" TypeID="Windows!Microsoft.Windows.ScriptProbeAction">
              <ScriptName>Monitor3.DiagnosticTask.vbs</ScriptName>
              <Arguments>$Target/Property[Type='POCs.G2']/PID$ $Data/Context/EventDescription$</Arguments>
              <ScriptBody><![CDATA[Set coll_InputArguments = WScript.Arguments

    MyPropertyBagData = "Arg 0: " & coll_InputArguments.Item(0) & vbNewLine & "Arg 1: " & coll_InputArguments.Item(1)

    Set oAPI = CreateObject("MOM.ScriptAPI")
    Set oBag = oAPI.CreateTypedPropertyBag(StateDataType)

     Call oBag.AddValue("Output", MyPropertyBagData)

    Call oAPI.Return(oBag)]]></ScriptBody>
              <TimeoutSeconds>15</TimeoutSeconds>
            </ProbeAction>
          </Diagnostic>

     

     

          <Recovery ID="POCs.Monitor3.RecoveryTask" Accessibility="Internal" Enabled="true" Target="POCs.G2" Monitor="POCs.Monitor3" ResetMonitor="false" ExecuteOnDiagnostic="POCs.Diagnostic.Monitor3" Remotable="true" Timeout="10">
            <Category>Custom</Category>
            <WriteAction ID="Script" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
              <ScriptName>Monitor3.RecoveryTask.vbs</ScriptName>
              <Arguments>$Data/Diagnostic/DataItem/Property[@Name='Output']$</Arguments>
              <ScriptBody><![CDATA['Event constants
    Const EVENT_TYPE_SUCCESS = 0
    Const EVENT_TYPE_ERROR = 1
    Const EVENT_TYPE_WARNING = 2
    Const EVENT_TYPE_INFORMATION = 4

    Set ScomAPI = CreateObject("MOM.ScriptAPI")
    Call ScomAPI.LogScriptEvent("", 10001, EVENT_TYPE_ERROR, vbNewLine & "---")
     
     
    Set coll_InputArguments = WScript.Arguments

    WScript.Echo coll_InputArguments.Item(0)]]></ScriptBody>
              <TimeoutSeconds>15</TimeoutSeconds>
            </WriteAction>
          </Recovery>

    Wednesday, April 21, 2010 7:46 AM
  • The way you are using CDATA does not look right. 


    Microsoft Corporation
    Monday, May 03, 2010 3:38 PM
  • I see a couple of issues here.  First, you're using a variable StateTypeData used for the typed property bag, but I don't see that variable getting defined anywhere.  You really don't need a typed property bag here.  Could just use CreatePropertyBag.

    You're also trying to pass a string with a carriage return as a script argument.  That typically causes problems as the command line sees that as multiple arguments.  Probably be better to pass that information as separate values in the property bag.

    I just put up a sample MP showing how to have a recovery run after a diagnostic and pass property bag data between them.  Pretty similar to the basic concept of what you're trying to do here.  http://www.opsmanjam.com/OpsManJam%20Library/Forms/MPAuthor.aspx?RootFolder=%2FOpsManJam%20Library%2FManagement%20Packs


    This posting is provided "AS IS" with no warranties, and confers no rights. Use of attachments are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
    Monday, May 03, 2010 4:13 PM
    Moderator
  • Hi Brian and thank you for the example…now everything works!

    Bye!

    Lizzie!

    Tuesday, May 04, 2010 10:09 AM
  • Hi all.

    I want to Clear Counters - Input/output errors, crc errors, collision counters on cisco device interface. 

    I thought i could do it by recovery task, but there is no snmpProbe based recovery task, neither in Operations Console nor in Authoring Console.

    what can i do?

    can i use command line? how?

    thanks

    Monday, November 22, 2010 8:04 AM
  • Hi,

    you can define your own write action (or recovery) based on the System.SnmpProbe (http://msdn.microsoft.com/en-us/library/ee809331.aspx)  and set the IsWriteAction parameter to true.


    http://OpsMgr.ru/
    Monday, November 29, 2010 5:23 AM
    Moderator
  • I want it to be recovery. and do I have to create it manually in XML and not by GUI?

     

    Monday, November 29, 2010 6:30 AM
  • I tried authoring console, but there is no snmp based recovery task.

    Monday, November 29, 2010 6:31 AM
  • >I want it to be recovery. and do I have to create it manually in XML and not by GUI?

    Yes.


    http://OpsMgr.ru/
    Monday, November 29, 2010 9:13 AM
    Moderator
  • I've sent you mail and there is my action that I've created.
    Monday, November 29, 2010 9:30 AM