New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.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


database sensor to check last update timestamp

Votes:

0

Your Vote:

Up

Down

Is it possible to setup a postgreSQL sensor with a query that checks a "last updated" timestamp column to make sure the date/time is < 24 hours old? If the last update value is > 24 hours older than the current system date/time it sends a warning or down?

postgresql timestamp

Created on May 22, 2019 6:47:16 AM by  nightowl (0) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hello Nightowl,

Then it would be required to calculate the difference between the current system time and the time returned in that table. The result needs to be a single integer which is then return to PRTG in the script. You can use the DATEDIFF() function for that.

DATEDIFF ( datepart , startdate , enddate ) 

This is documented here: https://docs.microsoft.com/en-us/sql/t-sql/functions/datediff-transact-sql?view=sql-server-2017

In PRTG itself you can then click on the gauge symbol of the channel and configure the limits as desired.


Kind regards,
Felix Saure, Tech Support Team

Created on May 23, 2019 7:21:30 AM by  Felix Saure [Paessler Support]



5 Replies

Votes:

0

Your Vote:

Up

Down

Hi Nightowl,

How does the output of the column look like? Is it a date format or an integer like seconds since last update?


Kind regards,
Felix Saure, Tech Support Team

Created on May 22, 2019 9:12:47 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

It is a date format: 2019-05-20 01:11:47-07

Created on May 22, 2019 3:18:59 PM by  nightowl (0) 1



Accepted Answer

Votes:

0

Your Vote:

Up

Down

Hello Nightowl,

Then it would be required to calculate the difference between the current system time and the time returned in that table. The result needs to be a single integer which is then return to PRTG in the script. You can use the DATEDIFF() function for that.

DATEDIFF ( datepart , startdate , enddate ) 

This is documented here: https://docs.microsoft.com/en-us/sql/t-sql/functions/datediff-transact-sql?view=sql-server-2017

In PRTG itself you can then click on the gauge symbol of the channel and configure the limits as desired.


Kind regards,
Felix Saure, Tech Support Team

Created on May 23, 2019 7:21:30 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I don't think postgres has a datediff function, does it?

It has date_part, so perhaps I can use that...as long as it returns an integer, right?

Then, do I interpret the result in the alert notifications?

Created on May 24, 2019 10:34:55 PM by  nightowl (0) 1



Votes:

0

Your Vote:

Up

Down

Hi Nightowl,

I haven't worked with it so far, but according to this article, datediff should work.

Anyways, you're right, an integer / float needs to be returned. The thresholds are set in the sensor settings to define if the sensor should go into an error after a particular time. Te status will then also be visible in the notifications you send.


Kind regards,
Felix Saure, Tech Support Team

Created on May 27, 2019 7:25:56 AM by  Felix Saure [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.