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 can I create a SSH Script sensor that check if a file is older than X hours?

Votes:

0

Hi Community,

i'd like to create a ssh Script that allow me to check if one File on a Unix System is older than 2 hours. The interpretation of the age can used by the Time-/Datestamp in the Filesystem.

Example-File: /var/log/debug/sendMails.log

Can anyone help me please?

file-age ssh-advanced-custom-script ssh-script-advanced-sensor

Created on Aug 22, 2017 2:53:10 PM



1 Reply

Votes:

0

Hello Maria,

you can use the "find" command for this. Dependent of your "find" version you may have the options -cmin or -amin. The difference between "cmin" and "amin" are changed time and accessed time. This depends on your usecase.

As an easy use case for your problem would be a command like this: 'find /var/log/debug/sendMails.log -cmin 120'

The result will be empty if the file /var/log/debug/sendMails.log didn't change up until 120 min ago.

I hope this helps,

Eugen

Created on Sep 28, 2017 4:45:16 PM by  Eugen Wilhelm [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.