Google has deprecated the Google Apps (gapps) Reporting API (https://developers.google.com/google-apps/reporting/) in favor of the new Admin SDK Reports API (https://developers.google.com/admin-sdk/reports/). This queries that API for daily domain reports and sends those metrics to a graphite host.
For info on the reported metrics, see: https://developers.google.com/admin-sdk/reports/v1/reference/usage-ref-appendix-a/users
- Sign in to Google's API Console (https://code.google.com/apis/console/) with a gapps admin account.
- Create a new "project".
- In "Services", click the switch to enable the "Admin SDK".
- In "API Access", click "Create an OAuth 2.0 client ID".
- Enter a Product name and click next.
- Select "Service account" and click "Create client ID".
- Click "Download private key" and save that file somewhere that python will be able to read it.
- In your gapps admin dashboard, go to Advanced Tools > Manage third party OAuth Client access
- Paste the "Client ID" of the service account that was created in the API Console in the "Client Name" field.
- Enter the scopes (comma separated) for the Reports API (found here: https://developers.google.com/admin-sdk/reports/v1/guides/authorizing) in the "One or More API Scopes" field and click Authorize.
- Copy gapps_settings.default.py to gapps_settings.py and edit to your environment.
domain_report.py will, by default, fetch the most recent report and send it to graphite without printing anything.
Use domain_report.py --all to backfill all available reports into graphite or --daterange to fill a specific (inclusive) range.
Determining the most recent or earliest available report relies on parsing text from an exception defined in the Python library for interacting with the Admin SDK. Google could easily break this.