I'm trying to alert if files ending in .pgp2 exist in this location. However, all I can figure out how to do is alert when files do NOT exist:
/usr/lib/nagios/plugins/check_smb_file -H 10.20.33.129 -f '/narf' -F '.*\.pgp2'
Can anyone think of how to do this?
Thanks!
check_smb_file - alerting if files are found
Re: check_smb_file - alerting if files are found
Well, I can think of two ways:
1. Use the negate plugin as it can convert all OKs to CRITICALs.
2. Write a wrapper script to grab the output, check it, and then exit differently if needed.
1. Use the negate plugin as it can convert all OKs to CRITICALs.
2. Write a wrapper script to grab the output, check it, and then exit differently if needed.
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.
"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.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: check_smb_file - alerting if files are found
What is the SMB host? A windows box?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_smb_file - alerting if files are found
Yes, it's all windows.Box293 wrote:What is the SMB host? A windows box?
Thanks for the tip on the negate wrapper. Will look into that.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: check_smb_file - alerting if files are found
If you install NSClient++ on the windows box it has built in file based checks. For example:
Check the amount of files in a folder (and sub-folders). Generate a warning if more that 500 files exist, critical if more than 1000 files exist.
NSClient++ 0.3.x
NSClient++ 0.4.1
With these examples you would change pattern=*.* to pattern=*.pgp2
Does this help?
Check the amount of files in a folder (and sub-folders). Generate a warning if more that 500 files exist, critical if more than 1000 files exist.
NSClient++ 0.3.x
Code: Select all
Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'filter=size gt 0b' 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
Code: Select all
Command:
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
Does this help?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_smb_file - alerting if files are found
Oh, that's a good perspective. I leaned toward check_smb_file because I am checking a windows cluster drive. I can still hit the underlying cluster IP with NSClient++ though. Good tip!
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: check_smb_file - alerting if files are found
There's lots of solutions around which gives us lots of flexibility
Let us know how you go with this.
Let us know how you go with this.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.