RPC API Developer's Guide

Get Graph Image

You can use LogicMonitor's RPC API to get the image of a datasource instance graph, a Websites graph or a custom graph widget.

Note: As with all of our API calls, authentication is required.

 

getGraphImage (device instance graphs)

Retrieve an image of a graph

URL:
"https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&graphName=graphName&dataSourceInstanceName=InstanceName&hostDisplayedAs=displayName&time=timePeriod"

 

Request Parameters: You can add the following as query parameters to a getGraphImage request (for a device instance graph):

Parameter

Type

Description

graphName String Required if graphId is not specified. The unique name of the datasource instance graph that you want to retrieve. This value is interchangeable with the graphId.
graphId Integer Required if graphName is not specified. The unique Id of the datasource instance graph that you want to retrieve. This value is interchangeable with the graphName.

To get a graphId in the UI: navigate to the graph, & select graph definition from the drop down menu - the id is in the URL. In the new UI it is displayed in the URL as g:##. In the old UI it is displayed in the URL as gId:##.

dataSourceInstanceName String Required if graphName is specified. The unique name of the datasource instance that corresponds to the specified graph (the concatenation of the Datasource Name and the Instance Name)
dataSourceInstanceId Integer Required if graphId is specified. The unique Id of the datasource instance that corresponds to the specified graph.

To get a dataSourceInstanceId in the UI: navigate to the instance & the id is in the URL. In the new UI it is displayed in the URL as i/##.

hostDisplayedAs String Required. The unique host display name.
time String Optional. The desired time period of the graph. Valid inputs include nhours, ndays, nweeks, nmonths, or nyears (e.g. 2hours).

 

The Output will be an image.

With Curl, you can execute this command to save as a png image

curl -o graphimage.png "https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&graphName=graphName&dataSourceInstanceName=InstanceName&hostDisplayedAs=displayName"

 

Example

Request:
curl -o graphimage.png "https://apiUser.logicmonitor.com/santaba/rpc/getGraphImage?c=apiAccount&u=apiUser&p=example&graphId=853&dataSourceInstanceId=2222"

getGraphImage (service graphs)

Retrieve an image of a services graph

URL:
"https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&serviceCheckpointId=Id&graph=overallStatus|status|responseTime&time=timePeriod"

 

Request Parameters: You can add the following as query parameters to a getGraphImage request (for a service graph):

Parameter

Type

Description

serviceCheckpointId Integer Required. The unique number of the SiteMonitor checkpoint for your service. You can get the checkpoint Ids for your service using a GET Services call (look for the 'checkpoints' object in the result).
graph String

Required. The graph you want to download for your service. Options include:

overallStatus (status for all checkpoints)

status (status for one checkpoint)

responseTime (response metrics for one checkpoint)

performance (performance for one checkpoint)

Note that if you specify graph=overallStatus then the checkpointId you specify must correspond to the Id of the 'Overall' checkpoint.

time String Optional. The desired time period of the graph. Valid inputs include nhours, ndays, nweeks, nmonths, or nyears (e.g. 2hours).

The Output will be an image.

With Curl, you can execute this command to save as a png image

curl -o graphimage.png "https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&serviceCheckpointId=Id&graph=overallStatus|status|responseTime&time=timePeriod"

 

Example

Request:
curl -o graphimage.png "https://apiUser.logicmonitor.com/santaba/rpc/getGraphImage?c=apiAccount&u=apiUser&p=example&serviceCheckpointId=102"

getGraphImage (custom graph widgets)

Retrieve an image of a custom graph widget

URL
"https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&customGraphId=Id&time=timePeriod"

 

Request Parameters: You can add the following as query parameters to a getGraphImage request (for a custom graph widget):

Parameter

Type

Description

customGraphId Integer Required. The Id for the custom graph you'd like to download. In order to get this value, you'll need to first do a getWidget call for your custom graph widget - look for the 'graphid' value in the 'params' object of the response and include that value as the customGraphId value for this request.
time String Optional. The desired time period of the graph. Valid inputs include nhours, ndays, nweeks, nmonths, or nyears (e.g. 2hours).

 

The Output will be an image.

With Curl, you can execute this command to save as a png image

curl -o graphimage.png "https://accountName.logicmonitor.com/santaba/rpc/getGraphImage?c=accountName&u=user&p=password&customGraphId=Id&time=timePeriod"

 

Example

Request:
curl -o graphimage.png "https://apiUser.logicmonitor.com/santaba/rpc/getGraphImage?c=apiAccount&u=apiUser&p=example&serviceCheckpointId=102"