- access to command line
- understanding of python
- understanding of custom report creation
- Zenoss 4.x
A number of the reports rely on Python code to generate data (report plugins). These plugins can be run directly from the command-line, and the results saved as either raw Python output or as CSV data. This article describes how to list the plugins and run the report plugins with options to control their generation.
Listing the Report Plugins
To view the complete list of report plugins, run the following command as the zenoss user on the Zenoss master:
python $ZENHOME/Products/ZenReports/ReportRunner.py --list
Running the Report Plugins
To run a report plugin, run the ReportRunner as the zenoss user:
python $ZENHOME/Products/ZenReports/ReportRunner.py plugin_name
python $ZENHOME/Products/ZenReports/ReportRunner.py macaddress
or the full path to the plugin can be specified as in this example:
python $ZENHOME/Products/ZenReports/ReportRunner.py /opt/zenoss/Products/ZenReports/plugins/macaddress
Note that report plugin names may be duplicated, so the full path to the plugin may be required in order to run the correct plugin. As an example, the report plugin 'interface_utilization' exists in two different directories.
Modifying Report Plugin Parameters
The parameters that can be passed to the report plugins are very plugin specific, and at the moment require inspection to determine the arguments to pass to the reports.
In this example, we pass the start and end dates, as well as the organizer to report on to the Enterprise Report interface_utilization report plugin.
(note the following command would be entered on one line in the shell)
python $ZENHOME/Products/ZenReports/ReportRunner.py interface_utilization startDate=9/1/2014 endDate=9/31/2014 organizer=/Devices/Server
To Export the Plugin Data as CSV
By default, the ReportRunner exports plugin output as a Python data structure, but it can also export the data as Comma-Seperated-Value (CSV) format. To export the data, two command-line options can be specified: --export and --export_file
For example, to save the previous script data as CSV and in the file /tmp/September__server_utilization.csv
python $ZENHOME/Products/ZenReports/ReportRunner.py interface_utilization \
startDate=9/1/2014 endDate=9/31/2014 organizer=/Devices/Server --export=csv --export_file=/tmp/September__server_utilization.csv
To View All ReportRunner Options
The help for the ReportRunner command can be obtained through the following command:
python $ZENHOME/Products/ZenReports/ReportRunner.py --help
Note that while report plugins can be run from a remote collector, the performance difference can vary dramatically depending upon how much access to the ZODB is required, and how much work is done on the remote collector, as well as the type of work done on the collector. In order to take advantage of being on a collector, reports will require modifications which is outside the scope of this document.