8 Replies Latest reply on Feb 10, 2012 10:05 AM by Bill Robinson

    Export Provision Job Run Log and Other Details

    David Maughan

      Hi,

       

      I've been racking my brain going through the undocumented BLcli commands for a few days now trying to export some details for provision jobs.  I wasn't able to get the Utility : exportProvisionRun command to work (I need to be able to direct the log somewhere other than our application server), but was able to get the following to work:

       

      #Export the job run log

      echo "* Exporting log from job \"${JOB_NAME}\" ${JOB_RUN_START_PRINT} ...";

      blcli_execute LogItem getLogItemsByJobRun ${JOB_KEY} ${JOB_RUN_ID} >null;

      blcli_execute Utility listPrint >"//${DATASTORE}/${LOG_EXPORT_LOCATION}/${JOB_NAME}_${JOB_RUN_START_TIME}.log";

       

      This gets me the log, which is rather difficult to read when there's multiple targets (everything is intermixed).  That's not of huge concern though. 

       

      The next part of the plan is to gather other information related to the provision job (the intention being to have as complete of a picture of a provision job

      as possible stored outside of the application):

       

      • MAC Address(es) of target(s) - having trouble getting usable info here. ProvisionJob.getJobPmDeviceInfo (unsure of data type this returns) and ProvisionJob.getDevicesByJobRunId (unsure of data type this returns) don't seem to return usable info
      • Details of PM Device(s) - I can get this info easily if I know the MAC address
        • Architecture
        • Create date/time
        • User created
        • Description
        • State
      • Do not know how to get any of the properties below.
      • IP/Mask/GW/hostname/OM Server Name for targets
      • Boot image setting
      • Other details:
        • System package job was created from
        • DataStore and other custom property values from system package - System Package Properties tab
        • Operations Manager Settings (install agent, push, ACLs, post-install batch job) - Post install Configuration tab

       

      Any help to get me in the right direction here would be greatly appreciated. 

        • 1. Re: Export Provision Job Run Log and Other Details
          Bill Robinson

          i don't understand your comment about not being able to use the Utility exportProvisionRun - why can you only keep the file on the appserver?  where are you running these blcli commands from?

          • 2. Re: Export Provision Job Run Log and Other Details
            David Maughan

            I have a ticket open for that (ISS03905887).  The short story is I'm getting this strange error:

             

            Error Feb 7, 2012 10:35:38 AM Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: java.sql.SQLException: ORA-00904: "PMD"."BL_ACL_ID": invalid identifier

             

            The script is a no-targets NSH script running in BL (not NSH console).  I assume this error is caused by the function trying to write the export to the application server.  Since the documentation doesn't say otherwise, I can't say for sure.  But no form of path has worked (NSH with server name in path, NSH without server name, Windows).

             

            If this export handles multiple targets better than LogItem does, it'd be nice to get it work.  But since I found a way around the issue and have a ticket open, I'd like to move forward to the other data I need.

             

            thanks

             

            Message was edited by: David Maughan

            • 3. Re: Export Provision Job Run Log and Other Details
              David Maughan

              I was able to figure out a bit more of the puzzle...

              • ProvisionJob.getJobPmDeviceInfo - is returning a list of com.bladelogic.om.provisioning.model.job.provision.JobPmDeviceInfoImpl but I'm unsure how to get anything from that still.  I believe this is my ticket to getting the MAC address(es) of the job.
              • ProvisionJob.getDevicesByJobRunId - seems to be returning the server device ID(s) that the provision job creates.

               

              I also started running into a strange situation where a failed provision job (cancelled actually) just stopped returning a value for JobRun.findLastRunKeyByJobKey.  It was working last week, but not now.

               

              Again, any help here would be fantastic (point me to correct commands)...or maybe I'm going at this from the wrong starting point?  Perhaps starting from Devices would be easier?

               

              Thanks

              • 4. Re: Export Provision Job Run Log and Other Details
                Bill Robinson

                what information are you trying to get from this log, and what do you need to do w/ it ?

                • 5. Re: Export Provision Job Run Log and Other Details
                  David Maughan

                  I've got what I need as far as the logs (albeit clunky for parallel job runs), I need other info now and am trying to get it from the jobrun/job.  I'm trying to paint a "full" picture of a provision run that I can store outside of the application.

                   

                  The next part of the plan is to gather other information related to the provision job (the intention being to have as complete of a picture of a provision job

                  as possible stored outside of the application):

                   

                  • MAC address(es) of target(s)
                  • Details of PM Device(s) - I can get this info easily if I know the MAC address
                    • Architecture
                    • Create date/time
                    • User created
                    • Description
                    • State

                   

                   

                  Do not know how to get any of the properties below.

                  • IP/Mask/GW/hostname/OM Server Name for each target
                  • Boot image setting
                  • Other details:
                    • System package job was created from
                    • DATA_STORE and other custom property values from system package - System Package Properties tab
                    • Operations Manager Settings (install agent, push, ACLs, post-install batch job) - Post install Configuration tab
                  • 6. Re: Export Provision Job Run Log and Other Details
                    Bill Robinson

                    what are you trying to do w/ this info? 

                     

                    can you get the device targets from the job run?

                    • 7. Re: Export Provision Job Run Log and Other Details
                      David Maughan

                      As I said above in reply 3, I've not been able to get the MAC addresses for the target device(s) yet.  I was able to get the new server device ID and I think the MACs are hiding in the return of this command: ProvisionJob.getJobPmDeviceInfo which is returning a list of com.bladelogic.om.provisioning.model.job.provision.JobPmDeviceInfoImpl.

                       

                      I'm just not sure what namespace to use to get the properties from that.

                       

                      I'm trying to store all of this data outside of BL so I have the history even if the job/device/log information is deleted from BL.  I can get all of this by opening a job and reading the settings, reviewing the job run log and right-clicking a target MAC (under the job run) and choosing Open System Package. So I assume I can get to most of it using BLcli...

                      • 8. Re: Export Provision Job Run Log and Other Details
                        Bill Robinson

                        blcli_execute ProvisionJob getDevicesByJobRunid <jobRun>

                        blcli_execute Utility listPrint

                        blcli_storeenv devices

                        for device in ${devices)

                        do

                        blclI_execute Server findById ${device}

                        blclI_execute Server getPmDeviceId

                        blcli_storeenv deviceId

                        blcli_execute ProvisionDevice getProvDeviceByDeviceId ${deviceId}

                        blcli_execute ProvDevice getMacAddress

                        blcli_storeenv MAC

                        echo $MAC

                        done

                         

                        also if you get the servername there's ProvisionDevice getMacAddrFromServerName that might work but i think for the other info you want, you need stuff in the ProvDevice namespace.