Topic
  • 8 replies
  • Latest Post - ‏2014-03-12T11:15:39Z by IsaacGraf
kftiv
kftiv
15 Posts

Pinned topic Obtaining information from TBSM in an Impact Event Enrichment policy

‏2014-02-18T16:10:27Z |

Hi all,

We're considering enriching events in OMNIbus with information from TBSM. We are generating Service Instances based on external configuration database which contains an Environment attribute (DTAP). Now we would like to obtain this information from TBSM where the information is stored in an additional parameter. Also, we would like to enrich the event after TBSM processing with the Business Service that is affected by the event.

I found a sample Impact policy "GetStatusForAttributeOfInstance", but it is using a Data Source named "StateModel" which does not exist and has a commented out section describing a Data Source called "ServiceInstanceBean" which also doesn't exist. I wonder what type of Data Source could be used to direct queries to the TBSM Data models.

I've also tried using the TBSMShell function with the dumpInstanceInfo RAD shell command, but that didn't work for me either.

Any suggestions on how to obtain TBSM service instance info and enrich events with this info, possibly with some example policy code?

Thanks

  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-02-19T15:57:45Z  

    Hi,

    You can try using the ServiceInstanceBean data type (it is "built in" to TBSM- it won't show up in the UI) and use GetByFilter to get the object for a particular instance. Something like:

    Type = "ServiceInstanceBean";
    Filter = "SERVICEINSTANCENAME = '" + ServiceName + "'";
    OrgNodes = GetByFilter(Type, Filter, false);

    ServiceInstance = OrgNodes[0];

    InstanceEnvironment = ServiceInstance.Environment;

    If the service instance has an additional property called Environment then it should be set to the InstanceEnvironment variable in the policy.

    If this doesn't work for you, there may be other approaches, so let me know.

     

    Thanks,

    Isaac

     

     

     

     

  • kftiv
    kftiv
    15 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-02-24T16:12:26Z  
    • IsaacGraf
    • ‏2014-02-19T15:57:45Z

    Hi,

    You can try using the ServiceInstanceBean data type (it is "built in" to TBSM- it won't show up in the UI) and use GetByFilter to get the object for a particular instance. Something like:

    Type = "ServiceInstanceBean";
    Filter = "SERVICEINSTANCENAME = '" + ServiceName + "'";
    OrgNodes = GetByFilter(Type, Filter, false);

    ServiceInstance = OrgNodes[0];

    InstanceEnvironment = ServiceInstance.Environment;

    If the service instance has an additional property called Environment then it should be set to the InstanceEnvironment variable in the policy.

    If this doesn't work for you, there may be other approaches, so let me know.

     

    Thanks,

    Isaac

     

     

     

     

    Isaac, thanks the ServiceInstanceBean data type is indeed useful to retrieve information stored on the ServiceInstance. Any idea whether this option would be preferred (performance wise or .. ) over a query to the database (in our case the external database used to fill the Service Instance property using SCRAPI and XML toolkit).

    Now for obtaining which Business Service is affected by this failure, other information is needed which is not stored (at least not that I'm aware of) on the Service Instance. Any suggestions (maybe the other approaches you had in mind). looping through the parents until a Service Instance of the "Business Service" type is encountered does not seem to be a sound approach (even unsure how to obtain the (list of) parents for a Service Instance.

    Thanks

  • kftiv
    kftiv
    15 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-02-25T21:21:22Z  
    • IsaacGraf
    • ‏2014-02-19T15:57:45Z

    Hi,

    You can try using the ServiceInstanceBean data type (it is "built in" to TBSM- it won't show up in the UI) and use GetByFilter to get the object for a particular instance. Something like:

    Type = "ServiceInstanceBean";
    Filter = "SERVICEINSTANCENAME = '" + ServiceName + "'";
    OrgNodes = GetByFilter(Type, Filter, false);

    ServiceInstance = OrgNodes[0];

    InstanceEnvironment = ServiceInstance.Environment;

    If the service instance has an additional property called Environment then it should be set to the InstanceEnvironment variable in the policy.

    If this doesn't work for you, there may be other approaches, so let me know.

     

    Thanks,

    Isaac

     

     

     

     

    Isaac a.o.,

    Some further testing with the ServiceInstanceBean have not given me options to use LIKE constructs in the Filter. Since our SERVICEINSTANCENAME is constructed by XMLToolkit, it has a long suffix (hex code with Template name). I tried different ways using .* (regexp) or % (SQL), but both didn't work.

    Also, is it possible to filter using other properties like the Identification fields? When I tried upper(SERVICEINSTANCENAME) it complained that SERVICEINSTANCENAME or SERVICEINSTANCEID are required. I tried a.o. the following:

    Filter="upper(ServiceInstanceName) Like upper('%" + searchStr + "%') or upper(displayName) Like upper('%"+searchStr+"%')";
    Filter="ServiceInstanceName Like upper('%" + searchStr + "%') or upper(displayName) Like upper('%"+searchStr+"%')";
    Filter="ServiceInstanceName Like upper('%" + searchStr + "%')";
    Filter="ServiceInstanceName Like '%" + searchStr + "%'";
    Filter="ServiceInstanceName Like '" + searchStr + "%'";
    Filter="ServiceInstanceName = '" + searchStr + "'";
    Filter="ServiceInstanceName LIKE 'OTA9999%'";

    The first of these examples actually taken from an example policy TBSM_QuickSearch.ipl. Only the second last (with = instead of LIKE) worked.

    Any help or reference to further documentation highly appreciated.

    Thanks

  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-02-26T12:11:17Z  
    • kftiv
    • ‏2014-02-25T21:21:22Z

    Isaac a.o.,

    Some further testing with the ServiceInstanceBean have not given me options to use LIKE constructs in the Filter. Since our SERVICEINSTANCENAME is constructed by XMLToolkit, it has a long suffix (hex code with Template name). I tried different ways using .* (regexp) or % (SQL), but both didn't work.

    Also, is it possible to filter using other properties like the Identification fields? When I tried upper(SERVICEINSTANCENAME) it complained that SERVICEINSTANCENAME or SERVICEINSTANCEID are required. I tried a.o. the following:

    Filter="upper(ServiceInstanceName) Like upper('%" + searchStr + "%') or upper(displayName) Like upper('%"+searchStr+"%')";
    Filter="ServiceInstanceName Like upper('%" + searchStr + "%') or upper(displayName) Like upper('%"+searchStr+"%')";
    Filter="ServiceInstanceName Like upper('%" + searchStr + "%')";
    Filter="ServiceInstanceName Like '%" + searchStr + "%'";
    Filter="ServiceInstanceName Like '" + searchStr + "%'";
    Filter="ServiceInstanceName = '" + searchStr + "'";
    Filter="ServiceInstanceName LIKE 'OTA9999%'";

    The first of these examples actually taken from an example policy TBSM_QuickSearch.ipl. Only the second last (with = instead of LIKE) worked.

    Any help or reference to further documentation highly appreciated.

    Thanks

    Hi, yes the ServiceInstanceBean type does not support LIKE.

    Another approach we could try is to modify the existing policy Main_CheckForDepsEntry. This policy is invoked by TBSM every time a new event comes in that affects a service. It is invoked separately for each service up the hierarchy (its job is to write the service-to-event mapping entry in the alerts.service_deps table in Omnibus).

    This policy receives as inputs the InstanceToProcess object which is the object for the service instance that the event affects (or its ancestors) and it receives a RawEvent object which contains a few fields from the original event (like Identifier and ServerName, ServerSerial).

    What you can do is add logic to this policy that checks properties on the InstanceToProcess object and updates the event if they meet certain criteria.

    For example:

    if (InstanceToProcess.IsBusinessService == "true") {

       RawEvent.Summary = "Business Service: " + InstanceToProcess.displayname;

      ReturnEvent(RawEvent);

    }

    This policy code checks if an additional property called IsBusinessService exists on the instance and is set to "true" and if so it updates the Summary field in the incoming event with the display name of the business service.

    To do something like this, you would configure an additional property on the template(s) of the Business services named IsBusinessService and whose value is true. This way all the instances of these templates would contain this property.

    Isaac

     

     

  • kftiv
    kftiv
    15 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-02-28T17:08:50Z  
    • IsaacGraf
    • ‏2014-02-26T12:11:17Z

    Hi, yes the ServiceInstanceBean type does not support LIKE.

    Another approach we could try is to modify the existing policy Main_CheckForDepsEntry. This policy is invoked by TBSM every time a new event comes in that affects a service. It is invoked separately for each service up the hierarchy (its job is to write the service-to-event mapping entry in the alerts.service_deps table in Omnibus).

    This policy receives as inputs the InstanceToProcess object which is the object for the service instance that the event affects (or its ancestors) and it receives a RawEvent object which contains a few fields from the original event (like Identifier and ServerName, ServerSerial).

    What you can do is add logic to this policy that checks properties on the InstanceToProcess object and updates the event if they meet certain criteria.

    For example:

    if (InstanceToProcess.IsBusinessService == "true") {

       RawEvent.Summary = "Business Service: " + InstanceToProcess.displayname;

      ReturnEvent(RawEvent);

    }

    This policy code checks if an additional property called IsBusinessService exists on the instance and is set to "true" and if so it updates the Summary field in the incoming event with the display name of the business service.

    To do something like this, you would configure an additional property on the template(s) of the Business services named IsBusinessService and whose value is true. This way all the instances of these templates would contain this property.

    Isaac

     

     

    Isaac, quick question. I see log("xxx"); statements in this policy, but I don't see anything being logged in the TBSM_policylogger.log. Any idea where this policy logs or how to turn it on. For debugging what happens when, this is quite important.

    Is this policy BTW invoked directly from the TBSM Data Server (WAS application)? I did see some reference to this service dependency updating in the WAS trace.log?

    Regards

  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-03-03T11:59:32Z  
    • kftiv
    • ‏2014-02-28T17:08:50Z

    Isaac, quick question. I see log("xxx"); statements in this policy, but I don't see anything being logged in the TBSM_policylogger.log. Any idea where this policy logs or how to turn it on. For debugging what happens when, this is quite important.

    Is this policy BTW invoked directly from the TBSM Data Server (WAS application)? I did see some reference to this service dependency updating in the WAS trace.log?

    Regards

    Make sure the policy logger service is turned on. In Impact UI under Services links, if PolicyLogger service light is red then you can right click on it to start it. It should get written to TBSM_policylogger.log.

    The Main_CheckForDepsEntry policy gets invoked internally by the TBSM code when a new event comes in which matches an instance in TBSM.

  • kftiv
    kftiv
    15 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-03-10T16:27:16Z  
    • IsaacGraf
    • ‏2014-03-03T11:59:32Z

    Make sure the policy logger service is turned on. In Impact UI under Services links, if PolicyLogger service light is red then you can right click on it to start it. It should get written to TBSM_policylogger.log.

    The Main_CheckForDepsEntry policy gets invoked internally by the TBSM code when a new event comes in which matches an instance in TBSM.

    Isaac, PolicyLogger service is definitely turned on. Actually there isn't even an option to stop and start it (the option is not available) in our environment (TBSM 6.1.1).  So the log file TBSM_policylogger.log is definitely being written to (it's updated continuously by other policies), but still no activity from the Main_CheckForDepsEntry policy is shown. Grepping on Main in all log files as follows gives me nothing.

    $ grep Main $TBSM_HOME/logs/TBSM_policylogger*

    I only see a condition which will conditionally call the function in the policy:

    DoBulkInserts = RawEvent.DoBulkInserts;
    if (DoBulkInserts <> "true") {

    and if DoBulkInserts="true" it would not do anything. But I don't know what this check means.

    Regards,

  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: Obtaining information from TBSM in an Impact Event Enrichment policy

    ‏2014-03-12T11:15:39Z  
    • kftiv
    • ‏2014-03-10T16:27:16Z

    Isaac, PolicyLogger service is definitely turned on. Actually there isn't even an option to stop and start it (the option is not available) in our environment (TBSM 6.1.1).  So the log file TBSM_policylogger.log is definitely being written to (it's updated continuously by other policies), but still no activity from the Main_CheckForDepsEntry policy is shown. Grepping on Main in all log files as follows gives me nothing.

    $ grep Main $TBSM_HOME/logs/TBSM_policylogger*

    I only see a condition which will conditionally call the function in the policy:

    DoBulkInserts = RawEvent.DoBulkInserts;
    if (DoBulkInserts <> "true") {

    and if DoBulkInserts="true" it would not do anything. But I don't know what this check means.

    Regards,

    Ok sorry. Yes I expect DoBulkInserts will be true, so you should be able to add log statements and your custom code  at the end of the policy, outside the if clause. The code outside of any functions in that policy should still get run.

    Isaac