Page 1 of 1

How to check a remote file if been changed?

Posted: Tue Sep 20, 2011 1:14 am
by xpertech
For some reasons I don't use NRPE instead of using SSH proxy wizard to monitor remote host files, and see if files had been changed (based on their size and time).

I know such plugin like check_filesize.sh/check_file_size.sh/check_fileages/... can be used to monitor remote files, but they can only monitor if file is greater or older than previous state, what I want to monitor is once the file had been changed (file size greater or smaller, created or edited time different from original), then warning/critical.

Any idea? thanks!

Re: How to check a remote file if been changed?

Posted: Tue Sep 20, 2011 11:20 am
by nscott
Well keeping track of file size would required you to keep a record of what each file you checked was, which would be cumbersome. You could do it if you wanted to however by (start developer speak) creating some sort of database (could be MySQL, could be a simple flat file) stores as CSV [filepath], [filesize] and then your check go through the database looking for the path and if it didn't find one, create a new entry and start keeping track. If it did find one then it would compare the file size to what it is now and return whatever value you wanted based on the delta.