最近在公司的项目中使用IBM TBSM进行业务关联配置工作,整个模型描述大概如下:
从模型设计角度来看该业务系统如下:
服务状态 B
业务节点 C1 ,D2 ,E3
业务资源 C11,C12,C13, D21,D22,D31,E32
其中业务节点B1,B2,B3还要设置weight重要度
业务规则:
当业务资源发生黄色事件时,影响业务节点为黄色,业务总体状态为黄色
当业务资源发生红色事件是,如果业务节点weight=1,影响业务节点为红色,业务总体状态为红色,当weight=0时,影响业务节点为红色,业务总体状态为黄色。
在TBSM模板配置中,
首先建立数字聚集规则获取业务资源的最严重状态,得到C,D,E的节点状态
由于要参考weight的值,所以建立数字公示规则,计算业务状态B的值。
公示脚本如下:
log("Name value: " + ServiceInstance.DisplayName); log(0, "Child value: " + ServiceInstance.NUMCHILDREN); log(0, "Weight value: " + ServiceInstance.Weight); log(0, "STATUS value: " + int(ServiceInstance.RADSTATUS)); log(0, "STATUS1 value: " + InstanceNode.URM_APP_STATUS1.Value);
if ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) >= 3 and int(ServiceInstance.Weight) = 0) { log(0, "filter a:"); Values = 3; } elseif ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) >= 3 and int(ServiceStatus) < 5 and int(ServiceInstance.Weight) = 1) { log(0, "filter b:");
Values = 3; } elseif ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) = 5 and int(ServiceInstance.Weight) = 1 ) { Values = 5; } else { Values = 0; } log(0, "Values: " + Values);
Status = Values;
按照IBM 业务的定义,当资源发生状态改变时,先调用数字聚集规则,产生状态变化,在调用数字公式规则计算业务状态,但是在实际使用中发现服务状态总是无法恢复。尝试分析了一下感觉TBSM在系统流程中当数字聚集规则返回状态发生变化时,修改服务状态同时调用了数字公式规则,但此时可能未对ServiceStatus进行加锁操作,导致对ServiceStatus产生了一些并行操作,导致状态计算问题(这个地方可能一般实施人员看不懂,和IBM沟通了几次也没说清楚这个问题,他们一直说他们的产品没问题,按照他们的要求也改过几次脚本,无法解决这个问题,后来想了一个土办法,在脚本中判断一下所有资源的状态,来解决服务恢复问题,参考如下脚本)
log("Name value: " + ServiceInstance.DisplayName); log(0, "Child value: " + ServiceInstance.NUMCHILDREN);
log(0, "Weight value: " + ServiceInstance.Weight); log(0, "STATUS value: " + int(ServiceInstance.RADSTATUS)); log(0, "STATUS1 value: " + InstanceNode.URM_APP_STATUS1.Value);
ServiceStatus = InstanceNode.URM_APP_STATUS1.Value; if( ServiceStatus < InstanceNode.URM_APP_STATUS2.Value) { ServiceStatus = InstanceNode.URM_APP_STATUS2.Value; } SevStatus = ServiceInstance.RADSTATUS;
if( SevStatus > ServiceStatus ) { ServiceStatus = SevStatus ; } index1=0; index = 0; count = 0; red = 0; yellow = 0; green = 0; nodesum =1; nodesum = ServiceInstance.NUMCHILDREN;
while( index1 < ServiceInstance.NUMCHILDREN) { log("ChildName value: " + ServiceInstance.CHILDINSTANCEBEANS[index1].DisplayName); log("ChildRad value: " + ServiceInstance.CHILDINSTANCEBEANS[index1].RADSTATUS);
if( ServiceInstance.CHILDINSTANCEBEANS[index1].RADSTATUS = 0) { green = green + 1; } if( ServiceInstance.CHILDINSTANCEBEANS[index1].RADSTATUS = 3) { yellow = yellow + 1; } if( ServiceInstance.CHILDINSTANCEBEANS[index1].RADSTATUS = 5) { red = red + 1; }
index1 = index1 +1; } log(0, "green: " + green); if( green=nodesum) {
ServiceStatus = 0; } log(0, "yellow: " + yellow); if( yellow > 0 ) { ServiceStatus = 3; } if( nodesum >0) { reddiv = red/nodesum; log(0, "red: " + red); log(0, "nodesum: " + nodesum); if( reddiv >= 0.51) { log(0, "red/nodesum: " + reddiv); ServiceStatus = 5; }else{ if( reddiv > 0 ) { ServiceStatus = 3; }
} } if ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) >= 3 and int(ServiceInstance.Weight) = 0) { log(0, "filter a:"); Values = 3; } elseif ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) >= 3 and int(ServiceStatus) < 5 and int(ServiceInstance.Weight) = 1) { log(0, "filter b:");
Values = 3; } elseif ( int(InstanceNode.URM_STATUS.value) <> 2 and int(ServiceStatus) = 5 and int(ServiceInstance.Weight) = 1 ) { Values = 5; } else { Values = 0; } log(0, "Values: " + Values);
Status = Values;
(有问题可以联系我一起探讨)