What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

How create a lookup that handle 'null' values



Hi everyone,

I am currently testing a REST Custom Sensor JSON Sensor where I would like to monitor a REST API that should give a state about different services.

For that I created a custom template for this specific page :

{ "prtg": { "result": [ { "channel": "Incident", "value": lookup($.service.current_incident_type, "minor", "scheduled", "major"), "LimitMode": 1 } ] } }

My issue : The state of the service communicated on this REST API is a string "major", "minor", "scheduled" OR null

PRTG does display following on the sensor : " Could no evaluate channel value of Incident: expected type string for parameter 0 but got <nil>."

Is there a way to handle null value in a lookup file ?

Thank you in advance for your support !

Best regards

lookups null prtg rest

Created on Jan 6, 2021 11:12:35 AM

5 Replies



Hello Kevin,

Thank your for your message and best wishes for this year.

Regarding your question, can you please provide us the JSON response you get from your API, please make sure to remove all confidential information if necessary.


Created on Jan 7, 2021 10:16:28 AM by  Florian Lesage [Paessler Support]



Hi Florian,

Thank you for your answer and wishes, I also wish you all the best for this new year.

Yeah sure !

Bellow two possible answer coming from the API with the first responding a string ("major") and the second a null value. What i want to read is the "current_incident_type" value.

{ "incidents": [], "maintenances": [], "service": { "children": null, "current_incident_type": "major", "id": 16102, "name": "Service 1", "parent_id": 16095 } }

{ "incidents": [], "maintenances": [], "service": { "children": null, "current_incident_type": null, "id": 16104, "name": "Service 2", "parent_id": 16095 } }

Possible values are ("major", "minor" , "scheduled" , null) I would like to set my sensor to error for "major" and "minor" and OK for "scheduled" and null

I hope this help you understand my issue.

Best regards, Kevin

Created on Jan 7, 2021 10:35:01 AM



Thank you very much for the information.

As the result returns no value (null) and not "null" as a string, I'm afraid that the REST Custom sensor can't be used. However, you have the possibility to use a custom script and handle the values (including null) as you want.

Here is the manual of the EXE/Script Advanced sensor you can use to monitor the services: https://www.paessler.com/manuals/prtg/exe_script_advanced_sensor

I also invite you to have a look to the manual about custom sensor to see how to return information in PRTG with a script: https://www.paessler.com/manuals/prtg/custom_sensors#advanced_sensors

If you have further questions, let me know.

Created on Jan 7, 2021 12:50:21 PM by  Florian Lesage [Paessler Support]



Hi Florian,

Thanks a lot for your answer. I followed your advice and finally create a script with a 'Python Script Advanced' Sensor in order to also handle null values.

I have been able to solve my problem so and monitor this status page.

Best regards, Kevin

Created on Jan 12, 2021 7:36:36 AM



Hi Kevin,

Thank you for the update, I'm glad to ear that you make it through. Have an excellent day.

Best regards.

Created on Jan 12, 2021 7:40:48 AM by  Florian Lesage [Paessler Support]

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.