9 Replies Latest reply on Sep 14, 2012 2:15 AM by Ashitosh Wagh

    BLCLI: Unable to create Template RULE for Windows Service State

      I trying to create a Template Rule, that checks Services state like: Running, Stopped etc.

      Capture.JPG

       

      for this i ran many BLCLI Script like this, I guess there is something wrong in values in bold letters.

       

      blcli_execute Template addRuleWithServerObjectCondition "${TEMPLATE_GROUP}"  "${TEMPLATE_NAME}" "${RuleGroupName}" "r1"  "description" "refNumber" "false"  "notes" "" "Windows Service" "Application Layer Gateway Service" "Must Exist" "State" "equals" "RUNNING"

       

       

      But everytime, I am getting some error..

        • 1. Re: BLCLI: Unable to create Template RULE for Windows Service State
          Ashitosh Wagh

          Hi Wali,

           

          Try following list of commands...

           

          blcli TemplateGroup createGroupWithParentName ${Template_Parent_Group} /

           

          blcli TemplateGroup createGroupWithParentName ${TEMPLATE_GROUPNAME} /${TemplateParentGroup}

           

          *) save Group id return by above command  in  TEMPGROUPID

           

          blcli_execute Template createServiceListTemplate ${TEMPLATE_NAME} ${TEMPGROUPID} true

           

          *) save Template Key  return by above command  in  TEMPKEY

           

          blcli Template addServicePart ${TEMPKEY} Alerter

           

          blcli Template addRuleWithServerObjectCondition /${Template_Parent_Group}/${TEMPLATE_GROUPNAME} ${TEMPLATE_NAME} "/" TestRule Test_description "111" false "Test notes" "" "Windows Service" Alerter "MUST EXIST" "StartupType (Windows)" equals AUTO_START

           

          Template is getting created.

           

          Thanks

          Ashitosh

          • 2. Re: BLCLI: Unable to create Template RULE for Windows Service State
            Ashitosh Wagh

            Hi Wali,

             

             

            Mark the answer as Correct if it answers your question correctly.

             

            Thanks

            Ashitosh

            • 3. Re: BLCLI: Unable to create Template RULE for Windows Service State

              Once I check it, I will surely mark is as correct..

               

              Thanks ashitosh

               

              ==================================================

              Warm Regards,

              MD WALI ALAM

              CFS | Service Automation, HCL Technologies - ISD

              • 4. Re: BLCLI: Unable to create Template RULE for Windows Service State

                In my case template is already created, part is already added.

                template_group="/CTF"

                template_name="service_ct"
                service_name="Application Layer Gateway Service"

                 

                 

                 

                 

                 

                I am just asking for script to create rule to check service state.

                 

                like following you mentioned above..

                 

                blcli Template addRuleWithServerObjectCondition /${Template_Parent_Group}/${TEMPLATE_GROUPNAME} ${TEMPLATE_NAME} "/" TestRule Test_description "111" false "Test notes" "" "Windows Service" Alerter "MUST EXIST" "StartupType (Windows)" equals AUTO_START

                 

                 

                but this is not working in my case..

                 

                 

                parse error near `}'

                 

                while there is no } in the script.

                • 5. Re: BLCLI: Unable to create Template RULE for Windows Service State
                  Ashitosh Wagh

                  Hi Wali,

                   

                  Blcli syantax I used is for csv format...For NSH you need to replace variables with $variable name.

                   

                  First try with real values and then Replace variables.

                   

                  For NSH blcli command for you is:

                   

                  blcli_execute Template addRuleWithServerObjectCondition /CTF service_ct "/ " "TestRule1" "Test_description" "111" false "Test notes" "" "Windows Service" Alerter "MUST EXIST" "Status (Windows)" equals RUNNING

                   

                  Above command Returns Template Key.

                   

                  If you want to use Varaibles in NSH

                   

                  blcli_execute Template addRuleWithServerObjectCondition /$Template_Parent_Group $TemplateName "/ " "TestRule1" "Test_description" "111" false "Test notes" "" "Windows Service" Alerter "MUST EXIST" "Status (Windows)" equals RUNNING

                   

                   

                  Please Let me know if you face any issue.

                   

                  Thanks

                  Ashitosh

                  • 6. Re: BLCLI: Unable to create Template RULE for Windows Service State
                    Bill Robinson

                    you can enclose the variables w/ {} in nsh - this should work:

                     

                    blcli Template addRuleWithServerObjectCondition "/${Template_Parent_Group}/${TEMPLATE_GROUPNAME}" "${TEMPLATE_NAME}" "/" TestRule Test_description "111" false "Test notes" "" "Windows Service" Alerter "MUST EXIST" "StartupType (Windows)" equals AUTO_START

                     

                    but it looks like you may not have defined the variables in the right case.  you said you used:

                    template_group="/CTF"

                    template_name="service_ct"
                    service_name="Application Layer Gateway Service"

                     

                    but then you have TEMPLATE_NAME, TEMPLATE_GROUPNAME, the case does not match, nor does some of the variable names.

                    • 7. Re: BLCLI: Unable to create Template RULE for Windows Service State

                      this is modified script:

                       

                       

                      blcli -v defaultProfile -r BLAdmins

                       

                      Template addRuleWithServerObjectCondition "/CTF" "service-ct" "TestRule" "Test_description" "111" "false" "Test notes" "" "Windows Service" "Application Layer Gateway Service" "MUST EXIST" "State (Windows)" "equals" "RUNNING"

                       

                       


                      still same error..

                       

                      PS: I didn't set any variable. directly entered their name and location.

                      • 8. Re: BLCLI: Unable to create Template RULE for Windows Service State
                        Ashitosh Wagh

                        Hi Wali,

                         

                        addRuleWithServerObjectCondition   is Non Released BLCLI.

                         


                        To run this BLCLI you need to use blcli2 -Dcom.bladelogic.cli.debug.release-only="false"

                         

                        blcli2 -Dcom.bladelogic.cli.debug.release-only="false" -v defaultProfile0 Template addRuleWithServerObjectCondition "/CTF" "service-ct" "TestRule" "Test_description" "111" "false" "Test notes" "" "Windows Service" "Application Layer Gateway Service" "MUST EXIST" "State (Windows)" "equals" "RUNNING

                         

                         

                        Follow following List of command on NSH shell

                         

                        ***connect with Profile on NSH.

                         

                        % blcred authprofile -add -profile defaultProfile0 -host APPserver_Name:PORT -type SRP

                         

                        %blcred cred -acquire -profile defaultProfile0 -username USER -password PASSWORD

                         

                        % blcli2 -Dcom.bladelogic.cli.debug.release-only="false" -v defaultProfile0 Template addRuleWithServerObjectCondition "/CTF" "service-ct" "TestRule" "Test_description" "111" "false" "Test notes" "" "Windows Service" "Application Layer Gateway Service" "MUST EXIST" "State (Windows)" "equals" "RUNNING

                         

                         

                        This should work. Let me know if you face problem.

                         

                        Thanks

                        Ashitosh

                        • 9. Re: BLCLI: Unable to create Template RULE for Windows Service State
                          Ashitosh Wagh

                          Hi Wali,

                           

                          Make sure you added service part using

                           

                          % blcli2 -Dcom.bladelogic.cli.debug.release-only="false" -v defaultProfile0 Template addServicePart $TEMPKEY "Application Layer Gateway Service"

                           

                          and then use above posted  blcli for rule add.

                           

                          Hope, this will solve your problem.

                           

                          Thanks

                          Ashitosh