最近在公司的項目中使用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;
(有問題可以聯絡我一起探討)