Developer's Guide

  • Docs Home
  • Community Home

1. Adding a New Report

Zenoss reports are simply HTML pages that use TALES markup. For a more thorough discussion, see Chapter 13, Extending the User Interface.

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

http://yourzenossserver:8080/zport/dmd/Reports

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

http://yourzenossserver: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 TALES templates, we can get a test page that has the Zenoss look and 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