Skip to main content

A Python client to export a New Relic dashboard PDF or image programmatically.

Project description

dashboard-exporter

A Python client to export a New Relic dashboard PDF or image programmatically.

Installation

This is available on the Python Package Index (PyPI). You can install using pip.

virtualenv env
source env/bin/activate
pip install nrde

To install the development version, run:

pip install https://github.com/AnthonyBloomer/dashboard-exporter/archive/dev.zip

Usage

The first step is export your Personal API Key as an environment variable.

export NEW_RELIC_PERSONAL_API_KEY = "YOUR_API_KEY"

If you have an EU based account, you will also need to export the NEW_RELIC_REGION environment variable:

export NEW_RELIC_REGION = "EU"

Then pass the GUID of a given Dashboard to the exporter function to download a snapshot of your dashboard. You can get the GUID by pressing the info button in your dashboard.

import os
import time

from dashboard_exporter import exporter
import mimetypes

output = exporter(guid="The New Relic Dashboard GUID", file_type="PDF",)

content_type = output.headers["content-type"]
extension = mimetypes.guess_extension(content_type)

output_directory = os.getcwd()
filename = int(time.time())

of = "%s/%s%s" % (output_directory, filename, extension)

with open(of, "wb") as f:
    f.write(output.content)
    f.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nrde-0.2.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

nrde-0.2.0-py2.py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page