This article applies as of PRTG 25.4.112


The REST Custom v2 sensor now supports session-based authentication. Use session-based authentication for REST APIs that require a login to retrieve a session token or cookie before making further requests. The sensor performs a new login with each sensor scan.


This article shows you how to configure the sensor using some real-world examples. We tested the sensor with a Veeam Backup Enterprise Manager, Veeam Backup & Replication, Synology File Station, and a Redfish environment. These examples cover common use cases and should help you configure session-based authentication for similar APIs in your environment. Adjust the URLs, headers, and paths as needed based on the API documentation of your target system.


For more information about the REST API credentials in the device settings, see the PRTG Manual: Device Settings.


In this article:


Veeam Backup Enterprise Manager

This example shows you how to monitor job data from the Veeam Backup Enterprise Manager REST API. The API returns a session token in the response header after a login request.


Sensor overview page for REST Custom v2 Enterprise Backup Jobs sensor 

Device credentials for Veeam Backup Enterprise Manager REST API

Device credentials settings example for Veeam Backup & Replication



SettingDescription
Authentication MethodSelect Session-based authentication.
User NameEnter the user name for access to the REST API.
PasswordEnter the password for access to the REST API.
Login PathEnter the path for the login request, for example, https://<host>:9398/api/sessionMngr/?v=v1_5.
ℹ Make sure to substitute the placeholder <host>.
Authentication HeaderSelect Include header for basic authentication (default).
Login Request MethodSelect POST.
POST DataEnter the data to POST to the login path.
Custom HeadersEnter any custom headers or leave this field empty.
Login Result TypeSelect Header (default).
Login Header NameEnter a login header name, for example, X-RestSvcSessionId.
Token TypeSelect Via header or Via cookie.
Header NameThis setting is only available if you select Via header above.

Enter a header name, for example, X-RestSvcSessionId.
Cookie NameThis setting is only available if you selected Via cookie above.

Enter a cookie name, for example, X-RestSvcSessionId.


Sensor settings for REST Custom v2 with Veeam Backup Enterprise Manager REST API

Sensor settings example for Veeam Backup & Replication


Specific Sensor Settings


SettingDescription
Request URLEnter the URL that you want to request. For example, enter https://<host>:9398/api/jobs.
ℹ Make sure to substitute the placeholder <host>.
Request MethodSelect the HTTP request method that you want to use to request the URL.
Custom HTTP HeadersSpecify custom HTTP headers that the REST API request of the sensor contains or leave this field empty.
Timeout (Sec.)Enter a timeout value in seconds.
Content TypeSelect the type of the content that the sensor queries.
Custom Sensor MessageEnter a custom sensor message or leave this field empty.


Channel Settings


SettingDescription
Channel #1 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter length($.Refs).
Channel #1 NameEnter a name to identify the channel. For example, enter Total Jobs.
Channel #1 Value TypeSelect the value type that the channel displays.
Channel #1 UnitSelect the unit of the value that this channel monitors.
Channel #2-#10Select if you want to add more channels.
Channel #2 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter length($.Refs[?(@.Name=="General Backup")]).
Channel #2 NameEnter a name to identify the channel. For example, enter General Backup Jobs.
Channel #2 Value TypeSelect the value type that the channel displays.
Channel #2 UnitSelect the unit of the value that this channel monitors.


Veeam Backup & Replication

This example shows you how to monitor job data from the Veeam Backup & Replication REST API. The API returns a session token in the response header after a login request.



Device credentials for Veeam Backup & Replication REST API


SettingDescription
Authentication MethodSelect Session-based authentication.
User NameEnter the user name for access to the REST API.
PasswordEnter the password for access to the REST API.
Login PathEnter the path for the login request. For example, enter https://<host>:9419/api/oauth2/token.
ℹ Make sure to substitute the placeholder <host>.
Authentication HeaderSelect Do not include an authentication header.
Login Request MethodSelect POST.
POST DataEnter the data to POST to the login path. For example, enter grant_type=password&username=%restusername&password=%restpassword&refresh_token
=&code=&use_short_term_refresh=&vbr_token=
.
Custom HeadersEnter any custom headers or leave this field empty. For example, enter
accept: application/json
x-api-version: 1.2-rev0
Content-Type: application/x-www-form-urlencoded
Login Result TypeSelect JSON.
JSONPathEnter the JSONPath to the session key value in the login response. For example, enter $.access_path.
Token TypeSelect Bearer (default).


Sensor settings for REST Custom v2 with Veeam Backup & Replication REST APISensor settings example for Veeam Backup & Replication


Specific Sensor Settings


SettingDescription
Request URLEnter the URL that you want to request. For example, enter https://<host>:9419/api/v1/jobs/states.
ℹ Make sure to substitute the placeholder <host>.
Request MethodSelect the HTTP request method that you want to use to request the URL.
Custom HTTP HeadersSpecify custom HTTP headers that the REST API request of the sensor contains or leave this field empty.
Timeout (Sec.)Enter a timeout value in seconds.
Content TypeSelect the type of the content that the sensor queries.
Custom Sensor MessageEnter a custom sensor message or leave this field empty.


Channel Settings


SettingDescription
Channel #1 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter $.data.0.lastResult.
Channel #1 NameEnter a name to identify the channel. For example, enter Job Status.
Channel #1 Value TypeSelect the value type that the channel displays.
Channel #1 UnitSelect the unit of the value that this channel monitors.
Channel #2-#10Select if you want to add more channels.


Synology File Station

This setup connects to a Synology File Station API, which authenticates via a login cookie returned from a GET request. The example retrieves and filters shared folders.



Device credentials for Synology File Station REST API


SettingDescription
Authentication MethodSelect Session-based authentication.
User NameEnter the user name for access to the REST API.
PasswordEnter the password for access to the REST API.
Login PathEnter the path for the login request. For example, enter https://<host>:5001/webapi/auth.cgi?api=SYNO.API.Auth&method=login&version=3&account=%restusername&passwd
=%restpassword&session=FileStation
.
ℹ Make sure to substitute the placeholder <host>.
Authentication HeaderSelect Do not include an authentication header.
Login Request MethodSelect GET.
Custom HeadersEnter any custom headers or leave this field empty.
Login Result TypeSelect Cookie.
Login Cookie NameEnter the cookie name to get the session key value in the login response. For example, enter id.
Token TypeSelect Via cookie.
Cookie NameEnter the cookie name to use for authorization. For example, enter id.


Sensor settings for REST Custom v2 with Synology File Station REST API


Specific Sensor Settings


SettingDescription
Request URLEnter the URL that you want to request. For example, enter https://<host>:5001/webapi/query.cgi?api=SYNO.FileStation.List&version=2&method=list_share.
ℹ Make sure to substitute the placeholder <host>.
Request MethodSelect the HTTP request method that you want to use to request the URL.
Custom HTTP HeadersSpecify custom HTTP headers that the REST API request of the sensor contains or leave this field empty.
Timeout (Sec.)Enter a timeout value in seconds.
Content TypeSelect the type of the content that the sensor queries.
Custom Sensor MessageEnter a custom sensor message or leave this field empty.


Channel Settings


SettingDescription
Channel #1 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter count($.data.shares[?(@.name=="docker")]).
Channel #1 NameEnter a name to identify the channel. For example, enter Docker Shares.
Channel #1 Value TypeSelect the value type that the channel displays.
Channel #1 UnitSelect the unit of the value that this channel monitors.
Channel #2-#10Select if you want to add more channels.
Channel #2 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter count($.data.shares).
Channel #2 NameEnter a name to identify the channel. For example, enter Total Shares.
Channel #2 Value TypeSelect the value type that the channel displays.
Channel #2 UnitSelect the unit of the value that this channel monitors.


Redfish

This example uses a Redfish REST API. It creates a session with a POST request and returns a token in the response header. We used a Fujitsu PRIMERGY device for the implementation of this example.



Device credentials for Redfish REST API



SettingDescription
Authentication MethodSelect Session-based authentication.
User NameEnter the user name for access to the REST API.
PasswordEnter the password for access to the REST API.
Login PathEnter the path for the login request. For example, enter /redfish/v1/SessionService/Sessions.
Authentication HeaderSelect Do not include an authentication header.
Login Request MethodSelect POST.
POST DataEnter the data to POST to the login path. You can use placeholders, for example, {"UserName": "%restusername", "Password": "%restpassword"}.
Custom HeadersEnter any custom headers. For example, enter Content-Type: application/json.
Login Result TypeSelect Header (default).
Login Header NameEnter a login header name, for example, X-Auth-Token.
Token TypeSelect Via header.
Header NameEnter a header name, for example, X-Auth-Token.  


Sensor settings for REST Custom v2 with Redfish REST API

Sensor settings example for Veeam Backup & Replication


Specific Sensor Settings


SettingDescription
Request URLEnter the URL that you want to request. For example, enter https://%host//redfish/v1/Systems/0.
Request MethodSelect the HTTP request method that you want to use to request the URL.
Custom HTTP HeadersSpecify custom HTTP headers that the REST API request of the sensor contains or leave this field empty.
Timeout (Sec.)Enter a timeout value in seconds.
Content TypeSelect the type of the content that the sensor queries.
Custom Sensor MessageEnter a custom sensor message or leave this field empty.


Channel Settings


SettingDescription
Channel #1 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter
$.ProcessorSummary.Count.
Channel #1 NameEnter a name to identify the channel. For example, enter CPU Count.
Channel #1 Value TypeSelect the value type that the channel displays.
Channel #1 UnitSelect the unit of the value that this channel monitors.
Channel #2-#10Select if you want to add more channels.
Channel #2 JSONPath/XPathEnter the JSONPath or XPath that you want to monitor. For example, enter $.MemorySummary.TotalSystemMemoryGiB.
Channel #2 NameEnter a name to identify the channel. For example, enter Memory Size.
Channel #2 Value TypeSelect the value type that the channel displays.
Channel #2 UnitSelect the unit of the value that this channel monitors.