Topic
  • 13 replies
  • Latest Post - ‏2013-03-19T05:23:15Z by SystemAdmin
SystemAdmin
SystemAdmin
172 Posts

Pinned topic How do I apply this rule on a TBSM template?l

‏2013-03-08T06:13:47Z |
Hello people.I am stuck on applying rule to the template.The rules are
------------------------------------------------------------------------------------------------|
Parent | Child | Parent p is marginal | Parent p is bad |
----------------|---------------|--------------------------------|------------------------------|
A Any 1 child is bad Any 2 children are bad
B    

Parent p | C | OR | |
D    
E Any 1 child is marginal Any 2 children are marginal
F    

------------------------------------------------------------------------------------------------|
Updated on 2013-03-19T05:23:15Z at 2013-03-19T05:23:15Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-08T06:25:55Z  
    Hello again,The rules did not come clearly so here I am attaching a screenshot of same.
  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-08T06:35:11Z  
    Hi, if I understand correctly, you want a rule where the parent goes bad if 2 children are bad or marginal and the parent goes marginal if 1 child is bad or marginal?

    If so, you should be able to do this by using a policy dependency rule and adding a new policy function. The policy function would be something like the following:

    function MyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status) {
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    while (ChildrenStatusArray[i] NULL) {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5) {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3) {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }
    if (NumBad > 1 OR NumMarginal > 1) {
    Status = 5; // turn parent red
    } else if (NumBad = 1 OR NumMarginal = 1) {
    Status = 3; // turn parent marginal
    } else {
    Status = 0; // parent should be green
    }
    }

    hope this helps,
    Isaac
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-08T07:59:55Z  
    • IsaacGraf
    • ‏2013-03-08T06:35:11Z
    Hi, if I understand correctly, you want a rule where the parent goes bad if 2 children are bad or marginal and the parent goes marginal if 1 child is bad or marginal?

    If so, you should be able to do this by using a policy dependency rule and adding a new policy function. The policy function would be something like the following:

    function MyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status) {
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    while (ChildrenStatusArray[i] NULL) {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5) {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3) {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }
    if (NumBad > 1 OR NumMarginal > 1) {
    Status = 5; // turn parent red
    } else if (NumBad = 1 OR NumMarginal = 1) {
    Status = 3; // turn parent marginal
    } else {
    Status = 0; // parent should be green
    }
    }

    hope this helps,
    Isaac
    @IsaacGraf What do these signify,could you explain them to me....*ServiceInstance, Status*?Is there any alternate way to do this say using aggregation rules?In the meantime I will test the policy...but i need to know those terms
  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-08T09:11:09Z  
    @IsaacGraf What do these signify,could you explain them to me....*ServiceInstance, Status*?Is there any alternate way to do this say using aggregation rules?In the meantime I will test the policy...but i need to know those terms
    The comments at the top of the policy should explain the variables.
    I can't think of another way to do this that doesn't involve editing policies. (This is a policy aggregation rule- just not one of the ones out of the box).
    One thing I forgot to mention is since this a numeric policy rule, you need to check the Status checkbox at the bottom of the rule and assign the Marginal threshold to be 3 and the Bad threshold to be 5. This will map the Status variable you set in the function to
    the color for the parent service.

    Regards,
    Isaac
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-11T07:06:28Z  
    • IsaacGraf
    • ‏2013-03-08T06:35:11Z
    Hi, if I understand correctly, you want a rule where the parent goes bad if 2 children are bad or marginal and the parent goes marginal if 1 child is bad or marginal?

    If so, you should be able to do this by using a policy dependency rule and adding a new policy function. The policy function would be something like the following:

    function MyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status) {
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    while (ChildrenStatusArray[i] NULL) {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5) {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3) {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }
    if (NumBad > 1 OR NumMarginal > 1) {
    Status = 5; // turn parent red
    } else if (NumBad = 1 OR NumMarginal = 1) {
    Status = 3; // turn parent marginal
    } else {
    Status = 0; // parent should be green
    }
    }

    hope this helps,
    Isaac
    Hi Issac,

    I think this should be
    while (ChildrenStatusArray[i] != NULL) or while (ChildrenStatusArray[i] != "") instead of
    while (ChildrenStatusArray[i] NULL).What do you think ?

    Regards.
  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-11T11:35:52Z  
    Hi Issac,

    I think this should be
    while (ChildrenStatusArray[i] != NULL) or while (ChildrenStatusArray[i] != "") instead of
    while (ChildrenStatusArray[i] NULL).What do you think ?

    Regards.
    Yes sorry for the typo. It should be:

    while (ChildrenStatusArray[i] != NULL)

    Thanks,
    Isaac
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-12T07:07:47Z  
    • IsaacGraf
    • ‏2013-03-11T11:35:52Z
    Yes sorry for the typo. It should be:

    while (ChildrenStatusArray[i] != NULL)

    Thanks,
    Isaac
    Hi Issac,

    Im unable to test the policy.When I fire test alerts one marginal causes parent to go marginal and one bad causes the parent to go bad,also two marginal causes the parent to remain marginal.I tried using

    log("//////////childStatus/////////"+ChildrenStatusArray[i]);

    inside as well as outside the function.It gave '//////////childStatus/////////NULL' outside the function but did not display anything for the same part written inside.I think the ChildrenStatusArray is coming null and it is unable to read the status or get information from the children.Can you or someone else help me out with this?

    Regards.
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-12T13:59:30Z  
    • IsaacGraf
    • ‏2013-03-11T11:35:52Z
    Yes sorry for the typo. It should be:

    while (ChildrenStatusArray[i] != NULL)

    Thanks,
    Isaac
    Also Issac could you leave your email id so that i may contact you .
    Thanks.
  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-12T20:23:41Z  
    Hi Issac,

    Im unable to test the policy.When I fire test alerts one marginal causes parent to go marginal and one bad causes the parent to go bad,also two marginal causes the parent to remain marginal.I tried using

    log("//////////childStatus/////////"+ChildrenStatusArray[i]);

    inside as well as outside the function.It gave '//////////childStatus/////////NULL' outside the function but did not display anything for the same part written inside.I think the ChildrenStatusArray is coming null and it is unable to read the status or get information from the children.Can you or someone else help me out with this?

    Regards.
    I'm not sure why ChildrenStatusArray has null values.
    In the screen where you configured the aggregation rule (which has the policy button on it) what kind of child rule is configured?
    Can you send a screen shot of the rule UI?
    Can you also attach the full policy and the policy log file?

    Thanks,
    Isaac
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-13T13:44:35Z  
    • IsaacGraf
    • ‏2013-03-12T20:23:41Z
    I'm not sure why ChildrenStatusArray has null values.
    In the screen where you configured the aggregation rule (which has the policy button on it) what kind of child rule is configured?
    Can you send a screen shot of the rule UI?
    Can you also attach the full policy and the policy log file?

    Thanks,
    Isaac
    The numeric aggregation rule and the policy view.The policy written is as follows

    log("//////////childStatus/////////"+ChildrenStatusArray[i]);

    function MSCPolicyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status)
    {
    //The policy name is NumericAttributeFunctions
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    log("//////////childStatus/////////"+ChildrenStatusArray[i]);
    while (ChildrenStatusArray[i] != "")
    {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5)
    {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3)
    {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }

    if (NumBad > 1 OR NumMarginal > 1)
    {
    Status = 5; // turn parent red
    }
    elseif (NumBad = 1 OR NumMarginal = 1)
    {
    Status = 3; // turn parent marginal
    }
    else
    {
    Status = 0; // parent should be green
    }
    }

    Where do I check for the log of this paritcular policy alone...?any specific location?
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-13T13:46:12Z  
    • IsaacGraf
    • ‏2013-03-12T20:23:41Z
    I'm not sure why ChildrenStatusArray has null values.
    In the screen where you configured the aggregation rule (which has the policy button on it) what kind of child rule is configured?
    Can you send a screen shot of the rule UI?
    Can you also attach the full policy and the policy log file?

    Thanks,
    Isaac
    The numeric aggregation rule and the policy view.The policy written is as follows

    log("//////////childStatus/////////"+ChildrenStatusArray[i]);

    function MSCPolicyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status)
    {
    //The policy name is NumericAttributeFunctions
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    log("//////////childStatus/////////"+ChildrenStatusArray[i]);
    while (ChildrenStatusArray[i] != "")
    {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5)
    {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3)
    {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }

    if (NumBad > 1 OR NumMarginal > 1)
    {
    Status = 5; // turn parent red
    }
    elseif (NumBad = 1 OR NumMarginal = 1)
    {
    Status = 3; // turn parent marginal
    }
    else
    {
    Status = 0; // parent should be green
    }
    }

    Where do I check for the log of this paritcular policy alone...?any specific location?
  • IsaacGraf
    IsaacGraf
    34 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-13T19:30:44Z  
    The numeric aggregation rule and the policy view.The policy written is as follows

    log("//////////childStatus/////////"+ChildrenStatusArray[i]);

    function MSCPolicyRule(ChildrenStatusArray, AllChildrenArray, ServiceInstance, Status)
    {
    //The policy name is NumericAttributeFunctions
    i = 0;
    NumBad = 0;
    NumMarginal = 0;
    log("//////////childStatus/////////"+ChildrenStatusArray[i]);
    while (ChildrenStatusArray[i] != "")
    {
    ChildStatus = ChildrenStatusArray[i];
    if (ChildStatus = 5)
    {
    NumBad = NumBad + 1;
    }
    if (ChildStatus = 3)
    {
    NumMarginal = NumMarginal + 1;
    }
    i = i + 1;
    }

    if (NumBad > 1 OR NumMarginal > 1)
    {
    Status = 5; // turn parent red
    }
    elseif (NumBad = 1 OR NumMarginal = 1)
    {
    Status = 3; // turn parent marginal
    }
    else
    {
    Status = 0; // parent should be green
    }
    }

    Where do I check for the log of this paritcular policy alone...?any specific location?
    I would remove the top log statement before the function.
    Also, I would place the other log statement inside the while loop, so it will log the status for each child.

    The logging should be written to INSTALLHOME/tbsm/logs/TBSM_policylogger.log.
    There is no log file that is specific to the policy.

    Isaac
  • SystemAdmin
    SystemAdmin
    172 Posts

    Re: How do I apply this rule on a TBSM template?l

    ‏2013-03-19T05:23:15Z  
    Thanks Issac,The rule finally works.