Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

12.10 10 Scheduling Reports

VERSION 2  Click to view document history
Created on: Oct 26, 2009 4:20 PM by Zenoss API - Last Modified:  Oct 27, 2009 10:49 AM by Noel Brockett

#12.10. Scheduling Reports

By default, all reports in Zenoss run on demand and present information the moment you run the report. To schedule reports, you can use the reportmail tool. This allows you to pick a specific report and have its output emailed to a list of recipients on a pre-determined schedule. reportmail is a command line tool that is designed primarily to be run out of the UNIX crontab, allowing for flexible scheduling.

The following steps demonstrate how you would set up the standard Availability Report to be emailed to every Monday morning at 6 a.m.

  1. Find the proper URL to the Availability Report by navigating to it in the Web interface and taking note of the URL in your browser.

    report-url.png
  2. Log in to your Zenoss server and switch to the zenoss user by running the command:

    su - zenoss

  3. Create a script that will invoke reportmail with the appropriate options with the following commands:

    mkdir -p $ZENHOME/scripts
    cat <<EOF > $ZENHOME/scripts/emailAvailabilityToJoe.sh
    #!/bin/sh
    REPORTS_URL="http://zenoss.example.com:8080/zport/dmd/Reports"

    $ZENHOME/bin/reportmail \
    --user=admin \
    --password=zenoss \
    --from="zenoss@example.com" \
    --address="joe@example.com \
    --subject="Zenoss: Availability Report" \
    --url="$REPORTS_URL/Performance Reports/Availability Report"
    EOF

    chmod 755 $ZENHOME/scripts/emailAvailabilityToJoe.sh

    Note

    You can run reportmail --help on your Zenoss server for additional help on reportmail options.

  4. Run crontab -e to edit the zenoss user's crontab. You will be presented with an editor that allows you to set up scheduled commands.

  5. Type a capital O to add a new line, and then enter the following job definition:

    # Email availability report to Joe every Monday morning at 6am.
    0 6 * * 1 bash -lc '$ZENHOME/scripts/emailAvailabilityToJoe.sh'

    Note

    You can run man 5 crontab on your Zenoss server for more help on crontab formatting.

  6. Type ESCAPE, and then :wq to save this crontab.

Comments (3)