How to check a remote file if been changed?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

How to check a remote file if been changed?

Post 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!
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

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

Post 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.
Nicholas Scott
Former Nagios employee
Locked