Skip navigation
Currently Being Moderated

12.7 Scheduling Reports

VERSION 3  Click to view document history
Created on: Oct 27, 2010 1:32 PM by Zenoss API - Last Modified:  Oct 27, 2010 1:49 PM by Zenoss API

 7. Scheduling Reports

By default, all reports run on demand, presenting information when you run the report. To schedule reports, you can use the reportmail tool. This allows you to select a report and email its output to a list of recipients according to 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. Locate the URL to the Availability Report by navigating to it in the Web interface.

  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://public-demo.zenoss.com/zport/dmd/reports#reports:.zport.dmd.Reports.Performance%20Reports.Availability%20Report
    
    $ZENHOME/bin/reportmail \
    --user=admin \
    --passwd=PASSWD \
    --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

    For help on reportmail options, run reportmail --help on your  Zenoss server.

  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. 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

    Run the following command on your system server for help on crontab formatting:

    man 5 crontab
  6. Save the crontab.

 7.1. ReportMail Command Line Arguments

The following table contains all of the command line arguments for the reportmail tool.

ArgumentExplanation
-u URL, --url=URLUniform Resource Locator of report to send. This also can be the URL of any other page in the system.
-U USER, --user=USERUser to log in to the system. This user must have permission to view the supplied URL.
-p PASSWD, --passwd=PASSWDPassword to log in to the system.
-a ADDRESS, --address=ADDRESSEmail address for report delivery (may be given more than once.) Default value comes from the user's profile.
-s SUBJECT, --subject=SUBJECTSubject line for email message. Default value is the title of the page.
-f FROMADDRESS, --from=FROMADDRESSOrigination address for the email being sent.
-d DIV, --div=DIVDIV to extract from the HTML at URL. The default value is contentPane, which will work for all default reports.
-c COMMENT, --comment=COMMENTComment to include in the body of CSV reports. This is used only if the URL returns comma-separated value data. Most default reports can return CSV-formatted data by appending ?doExport to the end of the URL.
Comments (1)