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


How can I create a SSH Script sensor that check if a file is older than X hours?

Votes:

0

Your Vote:

Up

Down

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 by  Maria Ahola (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

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]



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.