Do you need to schedule reports that contain charts or dashboards? Do you want to automate how you share dashboards? You can obtain your as PDF or PNG files programmatically with a GraphQL mutation. You can also export dashboards as PDF files using the UI.
For example, you can generate static, snapshot versions of your New Relic dashboards and send them to Slack or download as files.
Export dashboard pages
Obtain the dashboard's GUID: Click the icon by the dashboard's name to access the metadata widget and see the dashboard's GUID.
Get the individual pages' GUIDs using the query below:
{actor {entitySearch(query: "id ='YOUR_PAGE_GUID' OR parentId ='YOUR_PAGE_GUID' AND tags.isDashboardPage = 'true'") {results {entities {guidname... on DashboardEntityOutline {guidnamedashboardParentGuid}}}}}}Run the dashboardCreateSnapshotURL mutation in the NerdGraphQL explorer as many times as dashboard pages you want to export. You just need to provide the desired dashboard page GUID as a parameter.
Get the link to retrieve your dashboard page as a PDF. The link looks similar to:
https://gorgon.nr-assets.net/image/e0c22263-2d88-40bc-940a-b885dbc1d98d?format=PDF&width=2000&height=2000Configure the exported file, if necessary.
Configure the file you retrieve
Edit the returned link to change the format of your export (PDF or PNG), or resize it.
For example, if you obtain the link:
https://gorgon.nr-assets.net/image/e0c22263-2d88-40bc-940a-b885dbc1d98d?format=PDF&width=2000&height=2000
You could:
- Substitute
PDF
forPNG
to get an image. - Modify the width and height fields to adjust the size to your needs. The maximum value is
2000
.
Troubleshooting
Here's what to do if you experience any of the following errors while trying to export a dashboard:
From New Relic UI: We ran into an error while creating the PDF. Please try again
From New Relic NerdGraph: Operation on dashboard entity failed with guid:YOUR_GUID with cause: Error 504 calling Gorgon with url https://chart-image.service.newrelic.com/dashboard-url-from-guid/YOUR_GUID: upstream request timeout
These errors can be caused if the generation of the PDF exceeds the API max response time. If you encounter these errors, check if any of the widgets on your dashboard have a large time window. For example, you might compare data from an entire month versus previous months. If you see a large time window, try decreasing the window.
Another possible cause of these errors is that your dashboard may have a large number of widgets. If you have widgets you don't use, you might try removing some to see if this resolves the error.