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

Can I monitor last modified date of a Unix file?

Votes:

0

Hi all,

I have a Windows Scheduled Task that runs a report on a Sybase DB, and outputs the results to 3 files on a mapped Samba share on a Unix server.

I want to be able to monitor the last modified date of each of the 3 files and graph this in PRTG. This will allow me to historically map the run time of each report.

I tried to use something like the below as a custom ssh script:

  1. !/bin/bash

stat=`stat -c %Z /opt/cbis/bo_cbis_home/work/banking/export/cash_rec_reports_net.log`

echo 0:$stat:working

But PRTG stated that the output was not well formed.

Is there anyway that I can do this?

Thanks in advance

Andrew

p.s. Im still pretty new to PRTG so if i've missed something simple, go easy on me!

file-modification samba scheduled-task ssh-script

Created on Oct 11, 2013 9:56:55 AM



3 Replies

Votes:

0

How you should be able to get this to work would be to create an SSH script with this text

stat=$(stat -c %Z /etc/network/interfaces)

echo 0:$stat:working

the issue I think is '' that you used to define the variable since that returns the command there and not the number result. Also, you don't need to call out bash since this sensor already takes care of that. Also make sure that you are using the SSH Script Sensor and not the advanced since the advanced look for different formatting.

Created on Oct 14, 2013 12:55:48 PM by  Greg Campion [Paessler Support]



Votes:

0

Hi Greg, thanks for your advice.

I've managed to get over the initial issue with my result being "not well formed", by doing something similar to what you have suggested above.

Whilst the script is now working, it is returning an epoch number (1,381,881,603), is there a way that PRTG can translate that into a real time, or do I need to do that from within my script?

Also, is there a way I can tell PRTG to say "if the value has not changed, do not report it"? The monitored files will only be updated between 1am and 8am, and I just want to be able to graph the run times - for the time being.

Thanks

Andrew

Created on Oct 16, 2013 7:36:48 AM



Votes:

0

Unfortunately you will need to convert the time yourself in the sensor, there is no way to do this with the EXE / XML sensor.

This is also sadly not something that can be done with the EXE/XML sensor. You might want to try and program the sensor to be differential that way when there is no change it registers a 0 but other than that there isn't an option for this in that sensor.

Created on Oct 16, 2013 2:03:55 PM by  Greg Campion [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.