1 2 Previous Next 15 Replies Latest reply on Oct 15, 2012 8:03 AM by Carlos da Cunha e Silva

    Bladelogic(BL) compliance job results via blcli for use in nsh script

      Hello ,

       

      We are looking for a way to get the status result of Bladelogic(BL) compliance job. What we mean here is to get information if the compliance job that was ran against specific target to tell me if the target is "off compliance" or the target is "in compliance"

       

      1 - "off compliance"

      0 - "in compliance"

       

      or

       

      False - "off compliance"

      True - "in compliance"

       

      Let's say that you have to do full automation of process and you are running compliance job "XXXYYZZ" and based on the results below you want to do something else. For example update BL server property file to the server is "GOOD" or "WRONG".

      1 - "off compliance"

      0 - "in compliance"

       

      We already tried this approach by using below command, but that is not suitable for our needs. We are looking for simplistic way as the above to determine if the TARGET is "in compliance" or "off compliance" please.

       

      blcli -v "defaultProfile" Utility simpleExportComplianceRunLatest "/sampleTemplateGroup" "sampleTemplate" "/sampleRuleGroup/sampleRule" "/sampleJobGroup" "sampleJob" "C:/temp/sampleJobResult.csv"

       

      The idea is to get the results from nsh script in order to automate tasks.

       

      Thank you in advance for your help.

        • 1. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
          Ashitosh Wagh

          Easy Solution for this if you manage move Result Column to first column in csv by awk or anything.

           

          on Nsh execute command

           

          cat /c/temp/ash.csv | cut -d","  -f1,3 | grep Fail

           

          Will give Result in format : 

          Fail,vm-Target1

          Fail,vm-Target2

          Fail,vm-Target3

           

          This is easy way to find Fail Targets.

           

          Thanks

          Ashitosh

          • 2. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script

            Hi Ashitosh,

             

            Thank you for your respond and proposal solution!

             

            This is regarding compliance job, so I can run it against one target and by using "Utility simpleExportComplianceRunLatest" this will create CSV file let's say: "TEMP.csv"

             

            then I can do

            nCOUNTER=`cat "TEMP.csv" | grep Fail | wc -l`

            if [ $nCOUNTER -eq 0 ]

            then

                 echo "SERVER is OFF compliance"

            else

                 echo "SERVER is IN compliance"

            fi

             

            What I don't like with this approach:

            -------------------------------------------

            This will be batch job that will run daily and by using this tool: "Utility simpleExportComplianceRunLatest", I have to somewhere store the result in our case that is the CSV file. My question is what would be that place please, obviously it can not be the local directory from where I am running the script.

             

            It seems this tool can only write the file locally. It can't handle a windows share as:

             

            \\servername\C$\WHATEVERDIRECTORY

            or

            \\servername\WHATEVERSHAREDDIRECTORY

             

            Thanks,

            George

            • 3. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
              Ashitosh Wagh

              Hi George,

               

              simpleExportComplianceRunLatest is not accepting share directory PATH currently.

               

              But to access data from remotely I will give you a workaround.

               

              Create Shortcut of local.csv to \\servername\C$\Dir\shortcut.lnk and in BLCLI give path of local.csv

               

              blcli -v "defaultProfile" Utility simpleExportComplianceRunLatest "/sampleTemplateGroup" "sampleTemplate" "/sampleRuleGroup/sampleRule" "/sampleJobGroup" "sampleJob" "C:/temp/local.csv"

               

              So with the shortcut you can access .csv file also if multiple files create shortcut to directory One time effort.

              Also, For Linux you can use ln to create links.

               

              Thanks

              Ashitosh

              • 4. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script

                Hi Ashitosh,

                 

                Again thank you for your ideas and helpful replies.

                 

                The nsh script that we are building to get the result of the compliance job will ve part of a BL batch job that will be scheduled in BL. The whole thing will be living in BL. It seems that the above approach will not work with this context. Perhaps I may use the local BL store to write the result file, then pharse it and remove it the reault file from the store. Or even to move the result file from the BL store to the server I want if I have to retain it. I think that I am all set for now. Will experiment on soon and perhaps all will be successful.

                • 5. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                  Bill Robinson

                  Do you know what run of the batch job you will want the result for?  you can use some commands to get the run of the batch job, and then find the child job run ids, and from that pull the compliance results.

                  • 6. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script

                    Hi Bill,

                     

                    Thank you for jumping in this thread!

                     

                    I am really glad to hear that there is another possible way.

                     

                     

                    How things are combined on my end.

                     

                    There will be a single BL batch job lets call it: "BL_batch_TEST",  that BL batch should contains: "BL_compliance_JOB" and "BL_NSH_script_server_property_changer.nsh"

                     

                    1. "BL_batch_TEST"

                        a) "BL_compliance_JOB"

                        b) "BL_NSH_script_server_property_changer.nsh"

                     

                     

                     

                    Bill, based on your e-mail, could you tell me what are my options to get the status of "BL_compliance_JOB".

                     

                    I know that I may repeat myself, but let me clarify something about: "BL_compliance_JOB".

                     

                    Let's say that "BL_compliance_JOB" has 10 rules and one of them is failing, then the status I am looking of the compliance job should be as whole and should be let's say: "FALSE" or "1" if the job has all the rules without FAIL, then I am expecting to get "TRUE" or "0".

                     

                    Thank you,

                    George

                    • 7. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script

                      Hi Folks,

                       

                      We don't see how the above aproaches will help, if that compliance job has to be run against multiple targets at the same time. The aproaches above limit us, to run the compliance job at one target at a time.

                       

                      Let's say we have a BL smart group with 100 servers. The compliance job will be run againts that smart group and the above aproaches are not acceptable in that scenario.

                       

                      Because we don't want to run the compliance job twice at the same target we are updating specific BL property and based on that property the server will be off the smart group and becuase of that we have addtitional NSH script which is part of the BL batch job to take care of the BL property based on the compliance result.

                       

                       

                      Thank you,

                      George

                      • 8. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                        Bill Robinson

                        let me understand the use case a little more - you want to set the property on the servers, and that will exclude them from successive runs of the compliance job (via the batch) ? 

                         

                        what happens if the server goes out of compliance for some reason?  how will you catch that ?  or does this compliance job only need to run once against the server?  what is the issue w/ running the job against a compliant server?

                         

                        i'll work out the blcli in a bit, i just got back from pto so i'm still catching up

                        • 9. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script

                          Hi Bill,

                           

                          Thank you for handling this!

                           

                          1. There will be smart groups, which will be filled based on BL server properties. One of the BL server property will be let's say STATUS with possible VALUES 1,2,3 for example.

                          2. We will have "Smart Group - 1" that will contain servers with STATUS=1, "Smart Group - 2" with STATUS=2 and "Smart Group - 3" with STATUS=3

                          3. We going to run the BL BATCH JOB against "Smart Group - 1".

                          4. BL BATCH JOB will contains: BL COMPLIANCE JOB and NSH SCRIPT (the script will update STATUS=2 if BL COMPLIANCE JOB is OFF compliance and STATUS=3 if BL COMPLIANCE JOB is in compliance)

                          5. The smart group is expected to have 100 of servers.

                           

                          The question is, how to know the status of the BL COMPLIANCE JOB regarding TARGET SERVER (what I mean here is not the status of the BL COMPLIANCE JOB whether it's completed with success or not) if one of the rules is failing then UPDATE the BL SERVER PROPERTY of the TARGET server with STATUS=3 and if all rules are passing UPDATE the BL SERVER PROPERTY of the TARGET server with STATUS=2.

                           

                          On your question if the server is IN compliance the job will send notification to the apropriate parties and will place that problem server to different smart group:  "Smart Group - 3", that way it will be excluded from the original smart group where the BL JOB will hit it otherwise more than once, there is no problem that server to be hit more than once, but it always will fails and obviously something needs to be fixed from our side. Also if the server is OFF compliance it goes to smart group  "Smart Group - 2". Where will be running the same job but with schedule let's say every 3 months.

                           

                          Against "Smart Group - 1" - above BL batch job schedule will be daily or perhaps multiple times a day. (if something is in compliance goes to "Smart Group - 3")

                          Against "Smart Group - 2" - above BL batch job schedule will be perhaps every 3 months. (if something is in compliance goes to "Smart Group - 3")

                           

                          "Smart Group - 3" - against it will never run above BL batch job. It's going to be something as visualization fillter of what are the problem servers.

                           

                           

                          Please let me know if you need more details.

                           

                           

                           

                          Thank you,

                          George

                          • 10. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                            Bill Robinson

                            So in the NSH job, you need to figure out what batch job and batch job run it's a part of, from here we need to derive the compliance job run key.  from there i think the best idea would be to use the exportComplianceRun command as ashitosh mentioned, grep that for failed servers and then set the properties based on that output.

                             

                            when i get some time (you can see i have lots) i'll try to work out the 1st bit.  i already have some ideas on that.

                            • 11. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                              Carlos da Cunha e Silva

                              Actually I have a very similar need. Out of a compliance/remediation job set a server property. Unfortunately this is not something that is provided out of the box (correct me if I am wrong) so I'm very much interested in the scripts you're creating. I wonder if this type of functionality is a good candidate for an enhancement request.

                               

                              Carlos

                              • 12. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                                Bill Robinson

                                carlos, for your case you should be able to run some blcli commands to get the information you need from the compliance job and then run the blcli command to set the server property.

                                 

                                can you elaborate on what criteria you want to pull from the compliance job to set the property?

                                 

                                also, what's the use case for this ?  why do you want to do this ?

                                • 13. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                                  Carlos da Cunha e Silva

                                  Hi Bill,

                                   

                                  We have a quite complex environment. We have different network area's and depending in which area a server is located we need to set different DNS server, TSM backup server, etc. We use server properties to define all these parameters. Now this works fine for newly provisioned servers since we can correctly configure this from the start and normallly these values don't change during the lifecycle of a server. Beside newly provisioned servers we also have the existing estate which was present before we started with Bladelogic. At import time we were able to set some server properties but not all of them and we we're also not sure that they are all correct.

                                   

                                  So we want to extract all these settings. Some are easy like DNS, others like a TSM backup instance are a little bit harder. Based on the network id we're able to determine if these settings are compliant or not.

                                   

                                  After we have determined if a server is compliant or not we want to correct the server property accordingly. The main reason why we want to use a property is because it's easier to create smartgroups.

                                  • 14. Re: Bladelogic(BL) compliance job results via blcli for use in nsh script
                                    Bill Robinson

                                    so, if after running your compliance job against the target it's compliant you want to set a property like "IS_COMPLIANT" to 'true' ?

                                     

                                    is there only a single property you will use to track compliance for all these settings, and are you checking these settings in a single compliance job ?

                                    1 2 Previous Next