Friday, August 14, 2015

TBSM Multiple Event Identifiers



Introduction
The official documentation doesn't say much about multiple event identifiers.

So let’s do a quick summary of what we can:
- we can set multiple event identifiers in incoming status rule
- we can set multiple event identifiers in EventIdentifiersRules.xml or any artifact of category eventidentifiers in XMLtoolkit

But how to make sure they would match and do know they do match?

Solution
Multiple event identifiers in Incoming status rules are logically associated like there was logical AND operator between them:













So this definition of CAM_FailedRequestsStatusRule_TDW rule should be understood: all rows returned  by CAM_RRT_SubTrans_DataFetcher will affect my service if data returned in the following fields has the following values:
APPLICATION=MyApp AND
SUBTRANSACTION=MySubTrans AND
TRANSACTIONS=MyTrans

Same time, if I have multiple values for same label, it means OR.

For incoming status rule like:























So my instance expects that CAM_BSM_Identity_OMNI rule can catch all events with two alternative BSM_Identity values:
- MyApp#t#MyTrans#s#MySubTrans OR
- MySubTrans(5D21DD108FD43941892543AA0872D0EA)-cdm:process.Activity


If we're looking at EventIdentifierRules.xml, there's a concept of policies and rules, for example:
    <Policy name="ITM6.x">
        <Rule name="ManagedSystemName">
            <Token keyword="ATTR" value="cdm:ManagedSystemName"/>
        </Rule>
    </Policy>
    <Mapping policy="ITM6.x" class="%" />

You can have many policies mapped on many classes (which can be mapped on many templates) and you can have many rules within every policy.

In our case, for ITCAM Tx subtransactions class we have one policy with many rules:
                        <Policy name="CAM_SubTransaction_Activity">
                                    <Rule name="CAM_GetBSM_Identity">
                                                <Token keyword="ATTR" value="cdm:ActivityName" />
                                                <condition operator='like' value='%#s#%' />
                                    </Rule>
                                    <Rule name="CAM_GetApplicationName" field="APPLICATION">
                                                <Relationship relationship='cdm:uses'
                                                            relationshipSource='cdm:process.Activity'>
                                                            <Relationship relationship='cdm:federates'
                                                                        relationshipSource='cdm:process.BusinessProcess'>
                                                                        <Token keyword="ATTR" value="cdm:ActivityName" />
                                                            </Relationship>
                                                </Relationship>
                                    </Rule>
                                    <Rule name="CAM_GetTransactionName" field="TRANSACTIONS">
                                                <Relationship relationship='cdm:uses'
                                                            relationshipSource='cdm:process.Activity'>
                                                            <Token keyword="ATTR" value="cdm:Label" />
                                                </Relationship>
                                    </Rule>
                                    <Rule name="CAM_GetSubTransactionName" field="SUBTRANSACTION">
                                                <Token keyword="ATTR" value="cdm:Label" />
                                                <condition operator='like' value='%#s#%' />
                                    </Rule>
                        </Policy>

and one mapping of that policy on a class:
<Mapping policy="CAM_SubTransaction_Activity" class="cdm:process.Activity" />

But one class has many policies mapped on them:
<Mapping policy="CAM_Transaction_Activity" class="cdm:process.Activity" />
<Mapping policy="CAM_SubTransaction_Activity" class="cdm:process.Activity" />
<Mapping policy="CAM_TT_Object" class="%" />

Means, every mapping of a policy on a class is like element of logical OR operation. And every rule is a logical element of logical AND operation with other rules within same policy.

It is all conditional, because here comes additional aspect of field parameter of <Rule> tag.

The field parameter.
The field parameter in rule in policy in EventIdentifier enables that rule will be used only in case of having such field with such a name also in Incoming status rule specified as service instance name field.
So there's no AND operator between those rules in policy in EventIdentifierRules.xml which haven't been specified in Incoming Status Rule in template.

On another hand, there won't be any value assigned to service instance name fields selected in Incoming Status Rule in Template A if corresponding fields haven't been configured in rules of policies mapped on class (mapped on Template A in CDM_TO_TBSM4x_MAP_Templates.xml) in EventIdentifierRules.xml/

Conclusion
You need two places to go to and configure your event identifiers:
a)     Templates and incoming status rules / numerical rules / text rules – Service Instance Name Fields
b)     XMLtoolkit artifact EventIdentifierRules.xml (or any custom artifact from category eventidentifiers) – field parameters in rules defined within policies
Additionally, don’t forget: your policies defined in eventidentifiers artifacts must be mapped on CDM or custom classes that have mapping definition stored in CDM_TO_TBSM4x_MAP_Templates.xml and map on the same template that has the incoming status rule (numerical/text rule) you want with the Service Instance Name fields you want.
Otherwise your events or KPIs fetcher in fetchers won’t affect your service tree elements and you will not be showing correct status or availability on dashboards and your outage reports will also miss data and will generate false monthly results!

TBSM Event Identifiers - default BSM_Identity vs custom ones.

This is going to be a technical post.
TBSM is still quite powerful tool to track your service components availability and calculate your service outage durations and report on them.
One of the key elements to make it all happen is mapping events or KPIs on the service tree items.
There's a default mechanism for that, or rather a field called BSM_Identity.
I have made a finding that I wanted to share with you. It's not documented too well in the official documentation.
In short: BSM_Identity is event identifier. Name of field in event or SELECT statement that is expected to contain a value that will identify one and just one service instance in TBSM service tree. You can have one or more event identifiers (sometimes you need more same time in order to achieve uniqueness) and they can have other names than BSM_Identity, but BSM_Identity is the one which is default, as stated here:
http://www-01.ibm.com/support/knowledgecenter/SSSPFK_6.1.1.3/com.ibm.tivoli.itbsm.doc/customization/bsms_dlkc_id_rules.html
But how does it work in real life?
We do have to specify name of event identifiers in Incoming Status Rules. We basically can choose from all existing fields in alerts.status in case of ObjectServer being the data feed or all fields returned in SQL SELECT in a data fetcher or all fields returned via policy fetcher. There are no defaults. We have to choose one or more fields.
On another hand, if we integrate with TADDM or CMDBs via SCR API, we don't have to specify any name of a field in eventidentifiers artifacts if we don't want to. In such a case, by default their names will be BSM_Identity.
It means if we want to work with defaults, we can only achieve it if we ensure that we're:
a) adding BSM_Identity field to alerts.status table in ObjectServer,
b) using BSM_Identity alias SQL SELECT statements in data fetchers
c) using BSM_Identity as label in Impact DSA used in policy fetchers
Simple? ;)
I can post more examples if people are interested in it.

Sunday, March 1, 2015

TBSM and eDayTrader sample contents - my comments.



Technically today.

The eDayTrader sample application for testing TBSM and JazzSM has been around, from even before JazzSM era, when we did want to demonstrate TBSM, TADDM and ITM/ITCAM capabilities all together. The eDayTrader application was deployed onto WAS and DB2, and thanks to TADDM you could discover its components, import to TBSM and then monitor with ITM. I remember such a TADDM class at least, long time ago, nevertheless, the eDayTrader J2EE application can give you quite a good sense of what BSM methodology might be about when it comes to service modeling.
Today you can download the eDayTrader sample code for TBSM and, without a need to have that application deployed onto your WAS, you can generate a service dependency tree in TBSM and run the predefined data fetchers to fetch the eDayTrader component service instances metric data from a sample DB2 table and present that data right on your JazzSM/DASH dashboards. This is very handful, first, what I find difficult for our users as such is - still, after years - it helps with understanding of how TBSM and BSM products (today it's NOI - Netcool Operations Insight, TADDM, TBSM, JazzSM and OMNIbus/Monitoring) can be really used, means not only for monitoring applications but also for monitoring some business metrics. It helps to some extent of course, as the eDayTrader templates and fetchers are taken out of context, not sure if even any real, although surely based on some real J2EE application examples. But it is still a good exercise to play around it in TBSM. Secondly, the eDayTrader sample code is handy now, because it familiarizes the users with JazzSM/DASH, the first really new, post-TBSM custom canvas era dashboards editor. So I truly encourage all of the readers who haven't had a chance to play around that exercise, to try, spend some time and see it. You can download the thing here, from developer works (you'll need IBM ID to do that):
https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=7d5ebce8-2dd8-449c-a58e-4676134e3eb8#fullpageWidgetId=Wea1cb2531f10_4ccd_99d7_6ab0334cb21f&file=b45d5b68-1dbd-4ecd-aa25-57c34f4d812f

The PDF describing what might be done with the contents in JazzSM after you deploy them to TBSM, is here:
https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=7d5ebce8-2dd8-449c-a58e-4676134e3eb8#fullpageWidgetId=Wea1cb2531f10_4ccd_99d7_6ab0334cb21f&file=293578da-e095-46be-8f35-594f476400d7

I found few minor issues that might be crossed on some readers' way to complete the exercise.

1. The database setup on Windows. I do have one of my TBSMs on Windows and I did use that particular one for installation of eDayTrader contents. I perhaps did misread the instructions and did something wrong, but I believe that the case of the administrative user used might have been bit better documented. Namely, you're supposed to install the eDayTrader database with an administrative user that will be used for accessing the database tables from withing the TBSM data fetchers. On Windows, the default administrative user is db2admin, and on Linux/Unix it is db2inst1. I passed db2admin everywhere but I executed the *.bat script in my administrative DB2 CLI windows, which is something that I open as my another user (I will not unveil its name here). So what happened - the tables were created fine, the schema was set fine, I could see the tables and data via SELECT statements fine, but I couldn't do same selects in TBSM / Impact queries. The JDBC using db2admin user couldn't see them. I did receive SQLCODE=-204, SQLSTATE=42704 in my data fetcher View Data dialog, means invalid schema in query. Almost went crazy about it, I found few useful commands to check what's up with the schema and here I share it:

>db2 "select substr(GRANTEE,1,16),GRANTEETYPE,substr(tabschema || '.' || tabname,1,64), CONTROLAUTH, ALTERAUTH, DELETEAUTH, INDEXAUTH, INSERTAUTH, REFAUTH, SELECTAUTH, UPDATEAUTH from syscat.TABAUTH where tabschema like 'DAYTRADE'"
should give you something like:
1                GRANTEETYPE 3
              CONTROLAUTH ALTERAUTH DELETEAUTH INDEXAUTH INSERTAUTH REFAUTH SELE
CTAUTH UPDATEAUTH
---------------- ----------- ---------------------------------------------------
------------- ----------- --------- ---------- --------- ---------- ------- ----
------ ----------
DB2ADMIN         U           DAYTRADE.EDAYTRADERDATA
              Y           G         G          G         G          G       G
       G
DB2ADMIN         U           DAYTRADE.LOST_REVENUE_ALL
              Y           G         G          G         G          G       G
       G
DB2ADMIN         U           DAYTRADE.LOST_REVENUE_VIP
              Y           G         G          G         G          G       G
       G

  3 record(s) selected.

so DB2ADMIN is the grantee.
If you've got another user there, use its name in your TBSM JDBC connection setup, or, rerun the DayTrade database creation with this change to create_daytrade_schema.sql:
CONNECT TO DAYTRADE USER db2admin USING <yourpasswordhere>;

So in this case simply drop daytrade database (use FORCE APPLICATION ALL to release all connections if DB2 doesn't allow you dropping it because of available connections) and rerun your installation script (Dashboards-Sample-Data_v1.1-Artifacts\Step2_TBSMConfiguration>daytrade_configuration.bat).

2. I had a nasty issue with locked contents of Impact: service list and data source list. As part of the eDayTrader package installation you've got to install TBSM/Impact project and if you have any SVN locks on any Impact data like lists, that step will fail. When you run the second step of the installation process, you may see friendly messages like:
     [exec] Please make sure no locks exist in "IMPACT_HOME\etc\<servername>_versioncontrol.locks"

which is ok, unless you see:

createImpactAccess:
     [echo] Importing using nci_import
     [exec] Please make sure no locks exist in "IMPACT_HOME\etc\<servername>_ver
sioncontrol.locks"
     [exec] Check impactserver.log for more details
     [exec] Final result - Failure : 1

Also, if you've got errors and exceptions like:
File etc/TBSM_datasourcelist is locked by user SYSTEM
you're in trouble.

How to deal with it - not sure what eventually worked, I went to TBSM/Impact UI and unlocked all data sources and services. It wasn't it. Then I found an SVN command to use:
C:\Program Files\IBM\tivoli\tbsm\platform\win\svn\bin>svn cleanup "C:\Program Files\IBM\tivoli\tbsm\etc"
but it didn't help. At the end I went to version control locks file and removed all entries like:
#This file was written by server.
#Sat Feb 28 23:26:45 CET 2015
impact.locks.numlocks=1
impact.locks.1.user=defaultWIMFileBasedRealm/tipadmin
impact.locks.1.file=etc\\TBSM_EDayTraderData.ds
to:
#This file was written by server.
#Sat Feb 28 23:26:45 CET 2015

and left nothing else inside that file. It didn't help either, so I restarted TBSM WAS profile and that did help. So probably the combination of the server restart and releasing the locks from the file or SVN command did work out.

So here we go. I did install the eDayTrader package from the DW site fine and can move on to playing around it more and show to my customers if necessary. Nice.