7 Replies Latest reply: Jun 20, 2013 9:51 AM by Stéphane Leibovitsch RSS

Output ACL Push job results to csv file

Stuart NameToUpdate

Hi,

 

I'm trying to export ACL Push Job results to a .csv file via a script, however when running the below script, the output file is empty. The results are displayed in the NSH window, however I can't seem to get it to output to a file.

 

Any ideas?

 

blcli_setoption serviceProfileName <profile>

blcli_setoption roleName <role>

blcli_connect

 

blcli_execute AclPushJob getDBKeyByGroupAndName <path to ACL job> <ACL job name>

blcli_storeenv DBKEY

 

blcli_execute JobRun findLastRunKeyByJobKey $DBKEY

blcli_storeenv JOBKEY

 

blcli_execute JobRun jobRunKeyToJobRunId $JOBKEY

blcli_storeenv JOBID

 

blcli_execute LogItem getLogItemsByJobRun "$DBKEY" "$JOBID"

 

blcli_execute Utility setTargetObject

 

blcli_execute Utility listPrint  > /c/Temp/test.csv

 

blcli_dicsonnect

 

 

I'm using version BladeLogic 8.1  SP3 if that makes any difference.

 

 

Many thanks

  • 1. Re: Output ACL Push job results to csv file
    Bill Robinson

    ...

    blcli_execute LogItem getLogItemsByJobRun "$DBKEY" "$JOBID"

     

    blcli_execute Utility setTargetObject

     

    blcli_execute Utility listPrint

    blcli_storeenv logMessages

    echo ${logMessages} > /c/Temp/test.txt

     

    btw, it's not going to come out in csv format...

  • 2. Re: Output ACL Push job results to csv file
    Stuart NameToUpdate

    Thanks very much Bill, that works like a charm!

  • 3. Re: Output ACL Push job results to csv file
    Stéphane Leibovitsch

    Hello all,

     

    to follow up with this solution, which works quite well when applied to any type of job, I'm also trying to get the output of NSH script jobs (or any kind of job) and I can't find how to do this.

     

    Using Utility.exportJobResult displays this output but I want to write a fully generic log function which works with all types of jobs, hence my use of LogItems. However I can't find how to get the NSH script jobs output with this API.

     

    I'd be grateful for any help about this.

     

    Thanks for your help

    Stéphane

  • 4. Re: Output ACL Push job results to csv file
    Bill Robinson

    so JobRun getLogItemsByJobRunId does nothing on a nsh job for you ?

  • 5. Re: Output ACL Push job results to csv file
    Stéphane Leibovitsch

    It does but all the output from the script is zapped.

     

    I have made a recursive function which browses Batch job runs and its dependencies and for each job, the following code is executed :

     

    blcli_execute LogItem getLogItemsByJobRun-api ${JOB_DB_KEY}  ${JOB_RUN_KEY##*:}

    blcli_execute Utility setTargetObject

    blcli_execute JobLogItem getMessage

    blcli_execute Utility setTargetObject

    blcli_execute Utility listPrint

    blcli_storeenv BLCLI_OUTPUT

    echo $BLCLI_OUTPUT

     

    This outputs :

    Started running the job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' on application server 'blasb02-js2'(2,005,000) The job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' has failed

    Started running the job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' on application server 'blasb02-js2'(2,005,000) Started running member job SOFT-TOOLS_1.0_Windows_BL-2.0 The job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' has failed Member job adsgbbl_PATROL_AGENT_4.6.0_20130605142915 failed

    Started running the job 'SOFT-TOOLS_1.0_Windows_BL-2.0' on application server 'blasb02-js2'(2,005,000) The job 'SOFT-TOOLS_1.0_Windows_BL-2.0' has failed Member job SOFT-TOOLS_1.0_Windows_BL-2.0 failed

    Started running the job 'SOFT-TOOLS_1.0_Windows_BL-2.0' on application server 'blasb02-js2'(2,005,000) Started running member job CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0 The job 'SOFT-TOOLS_1.0_Windows_BL-2.0' has failed Member job SOFT-TOOLS_1.0_Windows_BL-2.0 failed

    Started running the job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' on application server 'blasb02-js2'(2,005,000) The job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' has failed Member job CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0 failed

     

    Rather than the expected (from export*JobResult):

     

    Job Name,"adsgbbl_PATROL_AGENT_4.6.0_20130605142915 - Run at Jun 5, 2013 2:29:23 PM"

    Start Time,Jun 5, 2013 2:29:23 PM

    End Time,Jun 5, 2013 2:32:06 PM

    Status,Completed with Errors

     

    Participant,Type,Date,Message

    "Run at Jun 5, 2013 2:29:23 PM",Info,Jun 5, 2013 2:29:23 PM,"Started running the job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' on application server 'blasb02-js2'(2,005,000)"

    "Run at Jun 5, 2013 2:29:23 PM",Error,Jun 5, 2013 2:32:06 PM,The job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' has failed

    <div class="subJobLog">

    Job Name,"adsgbbl_PATROL_AGENT_4.6.0_20130605142915 - Run at Jun 5, 2013 2:29:23 PM"

    Start Time,Jun 5, 2013 2:29:23 PM

    End Time,Jun 5, 2013 2:32:06 PM

    Status,Completed with Errors

     

    Participant,Type,Date,Message

    "Run at Jun 5, 2013 2:29:23 PM",Info,Jun 5, 2013 2:29:23 PM,"Started running the job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' on application server 'blasb02-js2'(2,005,000)"

    "Run at Jun 5, 2013 2:29:23 PM",Info,Jun 5, 2013 2:29:24 PM,Started running member job SOFT-TOOLS_1.0_Windows_BL-2.0

    "Run at Jun 5, 2013 2:29:23 PM",Error,Jun 5, 2013 2:32:06 PM,The job 'adsgbbl_PATROL_AGENT_4.6.0_20130605142915' has failed

    "Run at Jun 5, 2013 2:29:23 PM",Error,Jun 5, 2013 2:32:06 PM,Member job adsgbbl_PATROL_AGENT_4.6.0_20130605142915 failed

    <div class="subJobLog">

    Job Name,"SOFT-TOOLS_1.0_Windows_BL-2.0 - Run at Jun 5, 2013 2:29:24 PM"

    Start Time,Jun 5, 2013 2:29:24 PM

    End Time,Jun 5, 2013 2:32:06 PM

    Status,Completed with Errors

     

    Participant,Type,Date,Message

    "Run at Jun 5, 2013 2:29:24 PM",Info,Jun 5, 2013 2:29:24 PM,"Started running the job 'SOFT-TOOLS_1.0_Windows_BL-2.0' on application server 'blasb02-js2'(2,005,000)"

    "Run at Jun 5, 2013 2:29:24 PM",Error,Jun 5, 2013 2:32:06 PM,The job 'SOFT-TOOLS_1.0_Windows_BL-2.0' has failed

    "Run at Jun 5, 2013 2:29:24 PM",Error,Jun 5, 2013 2:32:06 PM,Member job SOFT-TOOLS_1.0_Windows_BL-2.0 failed

    <div class="subJobLog">

    Job Name,"SOFT-TOOLS_1.0_Windows_BL-2.0 - Run at Jun 5, 2013 2:29:24 PM"

    Start Time,Jun 5, 2013 2:29:24 PM

    End Time,Jun 5, 2013 2:32:06 PM

    Status,Completed with Errors

     

    Participant,Type,Date,Message

    "Run at Jun 5, 2013 2:29:24 PM",Info,Jun 5, 2013 2:29:24 PM,"Started running the job 'SOFT-TOOLS_1.0_Windows_BL-2.0' on application server 'blasb02-js2'(2,005,000)"

    "Run at Jun 5, 2013 2:29:24 PM",Info,Jun 5, 2013 2:29:24 PM,Started running member job CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0

    "Run at Jun 5, 2013 2:29:24 PM",Error,Jun 5, 2013 2:32:06 PM,The job 'SOFT-TOOLS_1.0_Windows_BL-2.0' has failed

    "Run at Jun 5, 2013 2:29:24 PM",Error,Jun 5, 2013 2:32:06 PM,Member job SOFT-TOOLS_1.0_Windows_BL-2.0 failed

    <div class="subJobLog">

    Job Name,"CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0 Run at Jun 5, 2013 2:29:24 PM"

    Start Time,Jun 5, 2013 2:29:24 PM

    End Time,Jun 5, 2013 2:32:05 PM

    Status,Completed with Errors

     

    Participant,Step,Attempt,Date,Type,Message

    run level log,,,Jun 5, 2013 2:29:24 PM,Info,"Started running the job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' on application server 'blasb02-js2'(2,005,000)"

    run level log,,,Jun 5, 2013 2:32:05 PM,Error,The job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' has failed

    run level log,,,Jun 5, 2013 2:32:06 PM,Error,Member job CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0 failed

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:29 PM,Info,"Started running the deploy step job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' on application server 'blasb01-js1'(2,004,000) against target server 'adsgbbl'"

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:30 PM,Info,Deployment job not in single-job mode. Reboot is not allowed. Any reboot requests by certain file operations will be ignored.

     

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:33 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 started

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:37 PM,Info,Metabase initialization failed: 0x80040154

     

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:37 PM,Info,Bldeploy CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 started using file C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\bldeploy.xml with rollback directory C:\Program Files\BMC BladeLogic\RSC\Transactions\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4

     

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:37 PM,Info,Starting dryRun

     

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:37 PM,Info,Dryrun succeeded

     

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:40 PM,Info,"Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 initialized, entering wait queue for processing"

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:40 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 processing instructions

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:40 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 completed. exitCode = 0 (DryRun successful)

    adsgbbl,Simulate,1,Jun 5, 2013 2:29:41 PM,Info,The job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' has succeeded on server adsgbbl

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,"Started running the deploy step job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' on application server 'blasb01-js1'(2,004,000) against target server 'adsgbbl'"

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Checking size of '//blfsvip01/usr/nsh/storage/depot/blpackages/CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1'

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Checking size of '//blfsvip01/usr/nsh/storage/depot/installables/2025278.1/CHECK'

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Invoking: /opt/bmc/bladelogic/bin/ls -A -l -R //blfsvip01/usr/nsh/storage/depot/installables/2025278.1/CHECK

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Checking size of '//blfsvip01/usr/nsh/storage/depot/installables/2025278.1/checktoolsmulti.cmd'

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Invoking: /opt/bmc/bladelogic/bin/ls -A -l -R //blfsvip01/usr/nsh/storage/depot/installables/2025278.1/checktoolsmulti.cmd

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Package on server blfsvip01 is 11484 bytes in size.

    adsgbbl,Stage,1,Jun 5, 2013 2:30:45 PM,Info,Invoking: /opt/bmc/bladelogic/bin/ndf -H -c -h adsgbbl

    adsgbbl,Stage,1,Jun 5, 2013 2:30:47 PM,Info,Staging directory on server adsgbbl has 2877300736 bytes available.

    adsgbbl,Stage,1,Jun 5, 2013 2:30:48 PM,Info,The job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' has succeeded on server adsgbbl

    adsgbbl,Commit,1,Jun 5, 2013 2:31:53 PM,Info,Deployment job not in single-job mode. Reboot is not allowed. Any reboot requests by certain file operations will be ignored.

     

    adsgbbl,Commit,1,Jun 5, 2013 2:31:53 PM,Info,"Started running the deploy step job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' on application server 'blasb01-js1'(2,004,000) against target server 'adsgbbl'"

    adsgbbl,Commit,1,Jun 5, 2013 2:31:57 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 started

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info,Metabase initialization failed: 0x80040154

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info,Bldeploy CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 started using file C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\bldeploy.xml with rollback directory C:\Program Files\BMC BladeLogic\RSC\Transactions\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info,Starting apply

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info, Processing asset BLPACKAGE

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info, Processing asset CUSTOMSOFTWARE

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info, Executing command: "set deploypath=C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 set source=2025278.1\CHECK set deployscript=C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\2025278.1\checktoolsmulti.cmd C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\2025278.1\checktoolsmulti.cmd"

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Info," [stdout: 1]        C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4>chcp 1252  1>NUL     C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4>set deploypath=C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4     C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4>set source=2025278.1\CHECK     C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4>set deployscript=C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\2025278.1\checktoolsmulti.cmd     C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4>C:\temp\stage\CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4\2025278.1\checktoolsmulti.cmd  05/06/2013 - 14:32:01,46 - ERROR : insuffisant free space : 2877280256 bytes available

    "

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Warning," [stderr: 1]   '100000000' is not recognized as an internal or external command,  operable program or batch file.

    "

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Error, Command returned non-zero exit code: 1

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:01 PM,Error, Apply failed: id = 1

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:02 PM,Info,Starting undo

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:02 PM,Info, Processing asset BLPACKAGE

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:02 PM,Info,Undo succeeded

     

    adsgbbl,Commit,1,Jun 5, 2013 2:32:03 PM,Info,"Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 initialized, entering wait queue for processing"

    adsgbbl,Commit,1,Jun 5, 2013 2:32:04 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 processing instructions

    adsgbbl,Commit,1,Jun 5, 2013 2:32:04 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 auto-rollback on failure started

    adsgbbl,Commit,1,Jun 5, 2013 2:32:04 PM,Info,Package CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0-2025263.1-2147965.4 completed. exitCode = -4001 (Apply failed; auto-rollback successful)

    adsgbbl,Commit,1,Jun 5, 2013 2:32:05 PM,Error,APPLY failed for server adsgbbl. Exit code = -4001

    adsgbbl,Commit,1,Jun 5, 2013 2:32:05 PM,Info,The job 'CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0->CHECK_SOFT-TOOLS_1.0_VM_Windows_BL-1.0' has failed on server adsgbbl

  • 6. Re: Output ACL Push job results to csv file
    Bill Robinson

    What do you mean by zapped ?

  • 7. Re: Output ACL Push job results to csv file
    Stéphane Leibovitsch

    I mean that they don't appear among the messages from the log items. I expected especially to see all error messages from the last part of the logs exported by the Utility functions