<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> 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.

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

i_speechExamples

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

i_round_blueTo switch between PNG and SVG images, change the file extension of /chart to .png or .svg.

i_round_redThe 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:

  • 0=live
  • 1=last 48 hours
  • 2=30 days
  • 3=365 days

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 node ID of the cluster node of the desired graph object

i_round_blueUse 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:

  • Display legend: graphstyling=showLegend%3D%271%27
  • Hide legend: graphstyling=showLegend%3D%270%27
  • Control font size: graphstyling=baseFontSize%3D%27XX%27 (XX is the font size)
  • Control legend and font size at the same time: graphstyling=showLegend%3D%271%27+baseFontSize%3D%275%27

bgcolor

Background color of the PNG image, for example, #fffff. This affects the area that surrounds the graph.

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

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

i_round_redThe value must be URL encoded, for example, %23fffff.

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

i_round_redThe value must be URL encoded, for example, %23fffff.

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

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

i_speechExample

Chart legend in the JSON format:

/api/chartlegend.json?id=sensorid

More

i_square_blueKNOWLEDGE BASE

How can I use the PRTG Application Programming Interface (API)?