I want to know where I can find the JSON schema against which the Script v2 sensor validates the script output.
Where can I find the JSON schema against which the Script v2 sensor validates my script output?
Votes:
0
1 Reply
Accepted Answer
Votes:
0
This article applies as of PRTG 23
Script v2 sensor JSON output schema
This is the JSON schema that the Script v2 sensor verifies the script output against:
- For more information about JSON schema, see http://json-schema.org/.
- For a list of JSON schema validators to check your script output, see https://json-schema.org/implementations.html#validator under Web (Online).
- The JSON schema contains all relevant limitations for the values that you can use in your scripts. For example, that the character limit for messages is 2,000 characters. In the schema, this is reflected as follows:
"message": { "description": "A string that the sensor shows as sensor message.", "type": "string", "maxLength": 2000 },
JSON schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "The output format for Paessler Script v2 sensors.", "type": "object", "properties": { "version": { "description": "The version of the output format.", "type": "integer", "const": 2 }, "status": { "description": "The expected status of the sensor's status channel.", "type": "string", "enum": [ "ok", "warning", "error" ] }, "message": { "description": "A string that the sensor shows as sensor message.", "type": "string", "maxLength": 2000 }, "channels": { "description": "An array containing the descriptions and values of the channels.", "type": "array", "items": { "allOf": [ { "$ref": "#/definitions/channel-schema" }, { "oneOf": [ { "$ref": "#/definitions/channel-integer-schema" }, { "$ref": "#/definitions/channel-float-schema" }, { "$ref": "#/definitions/channel-counter-schema" }, { "$ref": "#/definitions/channel-lookup-schema" } ] } ] }, "maxItems": 50, "uniqueItems": true } }, "required": [ "version", "status" ], "definitions": { "channel-schema": { "description": "A description and a value for a channel.", "type": "object", "properties": { "id": { "description": "The channel ID. It must be unique.", "type": "integer", "minimum": 10, "maximum": 2147483647 }, "name": { "description": "The name of the channel.", "type": "string", "minLength": 1 }, "type": { "description": "The type of channel. Choose between 'integer', 'float', 'counter', or 'lookup'.", "type": "string" }, "kind": { "description": "The kind of data the value represents. This is used to determine how the channel is displayed. Omit for channel type 'lookup'.", "type": "string" }, "value": { "description": "The value of the channel after the last scan. The value must be an integer for channel type 'integer', 'counter', or 'lookup' or a number for channel type 'float'." }, "display_unit": { "description": "The unit to display when the 'kind' is 'custom'.", "type": "string" }, "display_interval": { "description": "The time interval to display when the kind is 'custom' and the channel type is 'counter'.", "type": "string", "enum": [ "second", "minute", "hour", "day" ] } }, "required": [ "id", "name", "type", "value" ], "dependencies": { "display_unit": { "properties": { "kind": { "const": "custom" } } }, "display_interval": { "properties": { "kind": { "const": "custom" }, "type": { "const": "counter" } } } } }, "channel-integer-schema": { "allOf": [ { "properties": { "type": { "const": "integer" }, "value": { "type": "integer" } } }, { "$ref": "#/definitions/channel-absolute-unit-schema" } ] }, "channel-float-schema": { "allOf": [ { "properties": { "type": { "const": "float" }, "value": { "type": "number" } } }, { "$ref": "#/definitions/channel-absolute-unit-schema" } ] }, "channel-counter-schema": { "allOf": [ { "properties": { "type": { "const": "counter" }, "value": { "type": "integer" } } }, { "$ref": "#/definitions/channel-difference-unit-schema" } ] }, "channel-lookup-schema": { "properties": { "type": { "const": "lookup" }, "value": { "type": "integer" }, "lookup_name": { "type": "string", "minLength": 1 } }, "allOf": [ { "required": [ "lookup_name" ] }, { "not": { "required": [ "kind" ] } } ] }, "channel-absolute-unit-schema": { "properties": { "kind": { "anyOf": [ { "enum": [ "size_bytes-per-second_disk", "size_bytes-per-second_network" ] }, { "$ref": "#/definitions/channel-kind-enum-common-schema" } ] } } }, "channel-difference-unit-schema": { "properties": { "kind": { "$ref": "#/definitions/channel-kind-enum-common-schema" } } }, "channel-kind-enum-common-schema": { "enum": [ "custom", "count", "percent", "percent_cpu", "temperature_degrees-celsius", "time_milliseconds", "time_hours", "time_seconds", "size_bytes_memory", "size_bytes_disk", "size_bytes_file", "size_bytes_bandwidth" ] } } }
Created on Jan 16, 2023 2:51:17 PM
Last change on May 2, 2023 7:52:04 AM by
Jacqueline Conforti [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.
Add comment