New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Add a channel with date/time via JSON read by HTTP Data Advanced sensor

Votes:

0

Your Vote:

Up

Down

I'm using an HTTP Data Advanced sensor to monitor some JSON, containing several channels. In theory, this JSON should be overwritten every 5 minutes with new, so the sensor runs every 5 minutes too. However, in reality the JSON is not always overwritten.

In order to know when the results in PRTG are from, I'd like to add a channel to the JSON names something like "Query Time (UTC)". How can I successfully add this channel?

Attempt 1 - just throw the date in

However, doing this without any additional parameters in the JSON causes the sensor to fail (not unexpectedly) -

The returned JSON does not match the expected structure ('2018-08-01T10:49:26.0Z' is not a valid integer value). (code: PE231)

{
    "prtg": {
        "result": [
            {
                "channel": "Query Time (UTC)",
                "value": "2018-08-01T10:49:26.0Z"
            },
            {...},
            {...},
            {...}
        ]
    }
}

Attempt 2 - use the 'Custom' unit type

I've also tried to include the "unit" and customUnit parameters, but that leads to another error -

The returned JSON does not match the expected structure ('1 Aug 2018). (code: PE231)

{
    "prtg": {
        "result": [
            {
                "channel": "Query Time (UTC)",
                "value": "1 Aug 2018, 10:49 AM",
                "unit": "Custom",
                "CustomUnit": "UTC"
            },
            {...},
            {...},
            {...}
        ]
    }
}

Attempt 3 - use the 'duration' function

After some research, I came across the 'duration' function. It's not clear from the documentation exactly where it can be used, so I thought I'd give it a go, but that failed too -

The returned JSON does not match the expected structure ('duration(2018-08-01T10:49:26.0000000Z). (code: PE231)

{
    "prtg": {
        "result": [
            {
                "channel": "Query Time (UTC)",
                "value": "duration(2018-08-01T10:49:26.0000000Z, now())"
            },
            {...},
            {...},
            {...}
        ]
    }
}

custom-unit date http-data-advanced

Created on Aug 1, 2018 11:59:19 AM by  dgard (0) 1



4 Replies

Votes:

0

Your Vote:

Up

Down

"value": duration(2018-08-01T10:49:26.0000000Z, now()) ...should work. If not, please provide your entire configuration file. Add !nopublish to the beginning of your post to avoid having it published.


Kind regards,
Stephan Linke, Tech Support Team

Created on Aug 2, 2018 6:31:21 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Ah, sorry - please encapsulate the time string: '2018-08-01T10:49:26.0000000Z'.

Additionally, please make sure to use the latest PRTG version to have all features of the REST sensor available :)


Kind regards,
Stephan Linke, Tech Support Team

Created on Aug 2, 2018 8:51:26 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I've now encapsulated the time string but I'm still getting the same error.

The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

{
    "prtg": {
        "result": [
            {
                "channel": "Query Age",
                "value": duration('2018-08-01T10:49:26.0000000Z', now())
            },
            {...},
            {...},
            {...}
        ]
    }
}

I'm not sure what the latest version is, but we're running 18.3.42.1748+.

Created on Aug 2, 2018 9:05:28 AM by  dgard (0) 1



Votes:

0

Your Vote:

Up

Down

Ha, keep your eyes peeled. The issue is not the actual date, but another value in the JSON:

"channel": "Incoming Messages",
"value": "102

The 102 is missing the " at the end. That should be the reason why it's not working.


Kind regards,
Stephan Linke, Tech Support Team

Created on Aug 3, 2018 8:18:03 AM by  Stephan Linke [Paessler Support]



Please log in or register to enter your reply.


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.