Start a Conversation

Unsolved

This post is more than 5 years old

1571

March 3rd, 2015 09:00

M&R direct APG-Frontend-Report generator access

Hi all,

I am trying to make the APG-Frontend-Reprot genereator execute the report on demand directly, without use of Task-Scheduler, as we would like to add some automation to that task and also use it as debug tool when some of the reports take too long to generate. Is there anyone strongly Java capable to be able to translate the .task deinition XML into the java commandline to run it from e.g. cron, script or subtask?

Thanks for any help.


Cheers T.

April 1st, 2015 03:00

Hi Tom,

Not sure if it helps or not but here is what you can try:

  • List the scheduled tasks on FE:

$ manage-tasks.sh list

Scheduled Tasks List:

Id                                                                      Name                                        Category           Last Result  Current Status  Schedule

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

centralized-management/centralized-management/esrs-send-config.task     esrs-send-config-centralized-management     ESRS               error        disabled        0 0 * * 0

scheduled-reports/user1/2015-03-25_16-04-58_170.task                    Smarts Discovery                            report-scheduling  success      idle            0 8 * * *

property-store/Default/import-properties.task                           import-properties-Default                   Database           success      idle            conditional

centralized-management/centralized-management/online-update-check.task  online-update-check-centralized-management  OnlineUpdate       error        disabled        0 0 * * *

frontend-search/Default/refresh-frontend-search.task                    refresh-frontend-search-Default                                success      idle            0 20 * * *

frontend-report-generator/Default/stored_reports_cleanup.task           Stored reports cleanup-Default                                 success      idle            42 * * * *

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

  • Run the specified task and catch the command line of the running reports task with grep:

$ manage-tasks.sh start scheduled-reports/user1/2015-03-25_16-04-58_170.task

Task with id 'scheduled-reports/user1/2015-03-25_16-04-58_170.task' has been launched.

$ ps -ef | grep com.watch4net.apg.report.scheduling.generator.ScheduledReportGenerationTask | grep -v grep

w4n      13326 21106 99 12:14 ?        00:00:05 /opt/emc/APG/Java/Sun-JRE/8.0u31/bin/java -cp /opt/emc/APG/Tools/Task-Scheduler/Default/lib/java-task-launcher.jar:lib/* -Dcom.watch4net.apg.scheduler.task.run.number=9 -Dcom.watch4net.apg.scheduler.task.file.path=../../Task-Scheduler/Default/data/task_repository/scheduled-reports/user1/2015-03-25_16-04-58_170.task -Dcom.watch4net.apg.scheduler.task.forced.execution=true -Dcom.watch4net.apg.scheduler.task.id=scheduled-reports/user1/2015-03-25_16-04-58_170.task -Dcom.watch4net.apg.scheduler.task.log.dir=../../Task-Scheduler/Default/logs/scheduled-reports/user1/2015-03-25_16-04-58_170 -Dcom.watch4net.apg.scheduler.task.name=Smarts Discovery -javaagent:lib/apg-bootstrap-agent.jar -Djava.util.logging.config.file=conf/logging.properties com.watch4net.apg.scheduler.executor.JavaTaskProcessMain com.watch4net.apg.report.scheduling.generator.ScheduledReportGenerationTask main terminate 0,4,5,14 {"ownerId":1,"link":"0:f436ddb4-2e79a52c","storage":{"storedRecipients":"admin","storedOption":1},"type":"SingleReport"} conf/report-generation-config.xml

This should give you some hints how the task is executed.

Let us know if it helps.

Cheers,

Stan

April 1st, 2015 07:00

Thanks Stano.

This we've tried and its a short step forward of course. But still utilizing the Task-Schedulers' java classes and we still need to prepare the .task file.

We are looking for direct access to the report-generators' library calls.

Cheers,

Tom

August 31st, 2015 06:00

Hi Tom,

I know it's been a while. Did you manage to figure it out in the end?

Actually I have had a similar request recently and it looks like it is possible to generate on-demand reports with (ab-)using
the Frontend-Report-Generator.

I have hacked a quick script to do it:

$ cat generate-report.sh

#!/bin/sh

REPORT_LINK=$1

if [ x$REPORT_LINK == x"" ] ; then

        echo "Error: Please make sure to provide report link as parameter!"

        echo "Click on desired report in W4n UI and copy the URL"

        echo "For example: http:// :8080/APG/#/0-ffffff8e-ffffffc7-c80db036-4949c9e6"

        echo "The report link is the last part of URL: 0-ffffff8e-ffffffc7-c80db036-4949c9e6"

        echo "$0 0-ffffff8e-ffffffc7-c80db036-4949c9e6"

        exit 1

fi

APG_HOME="/opt/emc/APG"

JAVA_BIN="$APG_HOME/Java/Sun-JRE/8.0u31/bin"

REPORT_GENERATOR="$APG_HOME/Tools/Frontend-Report-Generator/Default"

JDBC_DRIVERS="$APG_HOME/Databases/JDBC-Drivers/Default"

REPORT_PARAMS="{\"ownerId\":1,\"link\":\"$REPORT_LINK\",\"storage\":{\"storedRecipients\":\"\",\"storedOption\":1},\"type\":\"SingleReport\"}"

REPORT_CONFIG=$REPORT_GENERATOR/conf/report-generation-config.xml

cd $REPORT_GENERATOR

$JAVA_BIN/java -cp "$JDBC_DRIVERS/lib/*:$REPORT_GENERATOR/lib/*:$REPORT_GENERATOR/lib/core/*" \

        -javaagent:lib/apg-bootstrap-agent.jar -Djava.util.logging.config.file=conf/logging.properties \

        com.watch4net.apg.report.scheduling.generator.ScheduledReportGeneration \

        $REPORT_PARAMS $REPORT_CONFIG

Note: ownerId = 1 is typically the admin user. That means the resulting stored report will be visible for admin. If you need to figure out the other IDs take a look at the .task file for specific user.

Let me know if it helps. Cheers!

No Events found!

Top