check_newest_file_age problem with excluding

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lesnikov
Posts: 28
Joined: Sat Jan 19, 2013 10:40 pm
Location: Slovenia

check_newest_file_age problem with excluding

Post by lesnikov »

Hi.

Im having problem with this plugin. I hope someone will help me out
The problem is I'm having problems excluding file types,
example in backup directory (backup root directory bac2014) I have backup files witch I need to monitor (backup file name:0001,0002,0003,0004)
the problem is I also have logs from backups in root directory witch are getting changed every minute (backup.log)
So if I run this plugin, plugin will say no warning no critical becouse he is checking logs witch have last time of 1min.

Is there any way to exclude file types from plugin search? like to exclude *.log etc..? So that plugin will search only backups not logs...


the plugin im using is:
http://exchange.nagios.org/directory/Pl ... ge/details

Best ragards
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_newest_file_age problem with excluding

Post by abrist »

First, this sub forum is for nagios-plugins - as in the package, so I will move this to general core.
This plugin does not support exclusions. You could alter the $file_list (line #282) var to include your exclusions:

Code: Select all

file_list=`ls -t $full_path | grep -v "log\|etc"`
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
lesnikov
Posts: 28
Joined: Sat Jan 19, 2013 10:40 pm
Location: Slovenia

Re: check_newest_file_age problem with excluding

Post by lesnikov »

thank you. works perfectly
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_newest_file_age problem with excluding

Post by slansing »

Excellent, thanks for letting us know!
Locked