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 to setup template file for REST Custom Sensor

Votes:

0

I am trying to monitor Cisco UCS IMC Redfish API using PRTG REST Custom Sensor. The data I want to monitor is the IMC firmware version and its udpate status. From testing, I can get return in JSON format as below

{
    "@odata.id": "/redfish/v1/TaskService/Tasks/BmcFwUpdate",
    "Name": "Task BmcFwUpdate",
    "@odata.context": "/redfish/v1/$metadata#TaskService/Tasks/Members/$entity",
    "TaskStatus": "OK",
    "@odata.type": "#Task.v1_3_0.Task",
    "Id": "BmcFwUpdate",
    "TaskState": "Completed",
    "Oem": {
        "Cisco": {
            "FWVersion": "4.0(1d)",
            "UpdateStatus": "Success (100%)"
        }
    },
    "Description": "Cisco IMC backup firmware version"
}

I setup a template file in %PRTG Install folder%\Custom Sensors\REST folder as below.

{
    "prtg": {
        "description" : {
            "comment": "Get Cisco UCS IMC firmware version and update status"
        },
        "result": [{
                "channel": "FWVersion",
                "ValueLookup": "prtg.standardlookups.cisco.ucs.fwstatus",
                "Value": $.Oem.Cisco.FWVersion
            }, {
                "channel": "UpdateStatus",
                "ValueLookup": "prtg.standardlookups.cisco.ucs.fwstatus",
                "value": $.Oem.Cisco.UpdateStatus
            }
        ]
    }
}

After setup the sensor, I got error "Could not create channel FWVersion: expected number but got 4.0(1d) (string)". So it appears the sensor did manage to access the API get the correct data, but as "value" only takes in int and float, the channel creation failed. From PRTG doco https://www.paessler.com/manuals/prtg/custom_sensors I cannot find alternative field to use instead of "value". I tried with "text", but the sensor returns "parsing error". Can anyone help?

api prtg rest template

Created on Jan 11, 2021 4:18:40 AM

Last change on Jan 11, 2021 8:30:19 AM by  Florian Lesage [Paessler Support]



1 Reply

Accepted Answer

Votes:

2

Hi there,

You are right, the parameter value can only show float or integer value. The only option would be showing the version number in the sensor message section. The syntax might look like this:

{
"prtg": {
"description" : {
"comment": "Get Cisco UCS IMC firmware version and update status"
},
"result": [
"channel": "UpdateStatus",
"ValueLookup": "prtg.standardlookups.cisco.ucs.fwstatus",
"value": $.Oem.Cisco.UpdateStatus
}
]
"text": $.Oem.Cisco.FWVersion
}
}

Kind regards,
Birk Guttmann, Tech Support Team

Created on Jan 15, 2021 10:06:23 AM by  Birk Guttmann [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.