Running a Logger Report via API for CSV results on demand via Python

Blog Post created by aaron.kramer@hpe.com on Jul 29, 2016

Recently a customer asked how to get CSV results from a Logger report to an external system. This can be done using Logger GUI to email report results on a scheduled basis or on demand, but this customer wanted to get the CSV results onto a fileshare and not deal with email.


This can be done using the Logger API, and here is how.


It helps to understand how this is done if we break down the task into a few smaller chunks.

- A report can be run by making the proper API calls (Login, RunReport, Logout) from an external system

- The results are returned in either CSV or PDF form, and the results can be written to a file.

- The script that does all this can be executed from a unix crontab, which is a way to schedule something to happen in the unix world.


The Logger API is documented in a guide, here: Web Services API Guide for Logger 6.2

We will use the SOAP API to Login, Run a Report, and Logout.

The Python script (attached) leverages a library called SUDS to make the calls to SOAP. In addition to Python, the SUDS module needs to be installed on your external client system. Nothing is added to Logger itself.

- install or use a previously installed python 2.x on your external client machine. http://www.python.org or it comes with most modern linux distributions

- install SUDS, via pip or another method of your choice

- copy the attached script to your client machine, and edit the parameters in the script to match your environment (Logger credentials, Logger IP Address, Report ID, Report Parameters, etc., location for output file).

- run the script for testing

- optional: add cron job to run the report on a schedule

There are some lines in the script that can be uncommented to provide extra logging for debugging purposes.


With some additional python scripting this script can be used to run reports on different loggers, concatenate results, etc.


By implementing this script, this customer saved a lot of effort and time!!!!


This work was done with Logger 6.2. Feedback is always welcome.