PRTG Manual: Live Graphs
You can use live sensor graphs from PRTG in other web pages using the PRTG API. PRTG renders graphs as .png or .svg files. You can include them in other web pages.
Authentication with API key or user name and passhash (or user name and password) must always be included in each PRTG API request. See section HTTP API for more information.
Examples Live graph as a .png file: /chart.png?type=graph&width=300&height=160&graphid=2&id=0 Live graph as an .svg file: /chart.svg?type=graph&width=300&height=160&graphid=2&id=0 |
To switch between PNG and SVG images, change the file extension of /chart to .png or .svg.
The URL does not start with /api. When placing these URLs on web pages, keep in mind that the URLs contain the account user name and password/passhash. This can imply security issues. We recommend that you set up a dedicated read-only user account in PRTG that is member of a dedicated user group, for example, that only has read access to the root group and all underlying entries or, even better, only for the object IDs that are used for graph URLs.
Parameters for Live Graph URLs (chart.png or chart.svg)
Parameter |
Description |
---|---|
type |
Must be graph |
graphid |
Select time span of the graph:
|
width |
Width of the image in pixels |
height |
Height of the image in pixels |
id |
The object ID of the desired graph object. This is usually the ID of a sensor. |
clgid |
The NodeID of the cluster node of the desired graph object Use the format clgid=%7BXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX%7D. You can also use clgid=%7B00000000-0000-0000-0000-000000000000%7D to return a graph that has data from all cluster nodes. |
graphstyling |
Allow control of some graph styles:
|
bgcolor |
Background color of the PNG image, for example, #fffff. This affects the area that surrounds the graph. The value must be URL encoded, for example, %23fffff. |
plotcolor |
Color of the graph's plot area, for example, #fffff. This affects the whole area within the graph box. The value must be URL encoded, for example, %23fffff. |
plotcolor1 |
Alternating color of the graph's plot area, for example, #fffff. This affects the tiles within the graph box alternating with plotcolor2. The result is a striped graph box. The value must be URL encoded, for example, %23fffff. This parameter is overwritten when using the parameter plotcolor. |
plotcolor2 |
Alternating color of the graph's plot area, for example, #fffff. This affects the tiles within the graph box alternating with plotcolor1. The result is a striped graph box. The value must be URL encoded, for example, %23fffff. This parameter is overwritten when using the parameter plotcolor. |
gridcolor |
Color of grid lines in the graph's plot area, for example, #fffff. This affects the horizontal and vertical lines within the graph box. The value must be URL encoded, for example, %23fffff. |
hide |
Do not show defined channels in the graph. Use the ID of a channel to hide it. For example, use hide=-4 to not show the Downtime channel in the graph. To hide more than one channel, use commas to separate the IDs. |
Retrieving Chart Legends (JSON)
You can show the legend of a sensor graph (channel IDs, colors, units, channel names) in the JavaScript Object Notation (JSON) format.
Example Chart legend in the JSON format: /api/chartlegend.json?id=sensorid |
KNOWLEDGE BASE
How can I use the PRTG Application Programming Interface (API)?