1. Writing a New Zenoss Report

Zenoss reports are simply html pages that use TALES markup.

New pages can be created using the Zope Zope Management Interface (ZMI) interface. Navigate to this url on your Zenoss server:

http://localhost:8080/zport/dmd/Reports

You can add a report at this point in the Report tree by adding "/manage" to the URL in your browser:

http://localhost:8080/zport/dmd/Reports/manage

Here you can select "Report" from the menu on the right, and add a new Report. Name it "test" and save it. After you see your new "test" report, leave the ZMI by selecting the "test" object, and then selecting the "Test" tab at the top of the page.

You will then see a sample page:


Reports

This is Page Template test.

If we use some Zenoss TALES templates, we can get a test page that has the Zenoss look & feel. Navigate back to our test page under the ZMI:

http://localhost:8080/zport/dmd/Reports/test/manage

Now change the text to this:


<tal:block metal:use-macro="here/reportMacros/macros/exportableReport">
<tal:block metal:fill-slot="report">
<tal:block metal:use-macro="here/templates/macros/page1">
<tal:block metal:fill-slot="breadCrumbPane">
<span metal:use-macro="here/miscmacros/macros/reportBreadCrumbsList"/>
</tal:block>
<tal:block metal:fill-slot="contentPane">
<h1>Reports</h1>
This is Page Template <i tal:content='here/title_or_id'/>.
</tal:block>
</tal:block>
</tal:block>
</tal:block>

The meat of a report goes here:


<tal:block metal:fill-slot="contentPane">

...

</tal:block>

Typically, a list of records is pulled from the database, summarized, and then shown in a table using the TALES markup.

Although you can make changes and save them using the web interface, it is a cumbersome editor. It is simpler to make the changes to an external file and reload it. If you store your file in the $ZENHOME/Products/ZenReports/reports directory, you can load it in with the ReportLoader?:

$ cd $ZENHOME/Products/ZenReports

$ python ReportLoader.py --force