Hello Nagios forums,
I am trying to implement a pretty simple check to see if a file exists with the name "test-***" where *** will be any random numbers and/or letters. I have tried several combos in Nagios including:
checkfilesize -a D:/downloads/test1/test-% --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-%%% --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-$% --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-$%%% --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-$* --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-$*** --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-* --nodatamode -c _ItemCount=1:
checkfilesize -a D:/downloads/test1/test-*** --nodatamode -c _ItemCount=1:
but none will match the file named "test-123". Obviously if I hardcode the numbers into the check, it works as intended, but these numbers will constantly be changing. Does anyone know how I can use a wildcard in the filepath for this check?
Thank you
Checkfilesize wildcard in filepath
Re: Checkfilesize wildcard in filepath
Can you post a link to this plugin? Or if it is short/custom, post here in code wraps?
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: Checkfilesize wildcard in filepath
If you are using NSClient++ you can use the build in module CheckDisk/CheckFiles which can do exactly that.
Here is an example.
The following file exists: "C:\Downloads\test1\test-123.txt" AND it has some text added to it (so it doesn't have a byte size of 0).
These commands find any files that start with test-
Using NSClient++ 0.3.9:
Using NSClient++ 0.4.1.105:
Here is an example.
The following file exists: "C:\Downloads\test1\test-123.txt" AND it has some text added to it (so it doesn't have a byte size of 0).
These commands find any files that start with test-
Using NSClient++ 0.3.9:
Code: Select all
Command:
./check_nrpe -H win2008r2-01 -t 30 -c CheckFiles -a path='C:\\Downloads\\test1' pattern='test-*' 'filter=size gt 0b' max-dir-depth=0 MinCrit=0
Output:
test-123.txt|'found files'=1;0;0Code: Select all
Command:
./check_nrpe -H win2008r2-01 -t 30 -c CheckFiles -a path='C:\\Downloads\\test1' pattern='test-*' max-dir-depth=0 MinCrit=0
Output:
test-123.txt|'found files'=1;0;0As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Checkfilesize wildcard in filepath
The plugin I am using is check_wmi_plus.pl:
http://edcint.co.nz/checkwmiplus/?q=faq ... mmandlines
And here's a readme:
http://mastermonsvr.smartmon.com.au/mp- ... mi_plus.pl
I also submitted a query to the check_wmi_plus developers asking about this issue in case they've got a solution. Thanks in advance for the responses
http://edcint.co.nz/checkwmiplus/?q=faq ... mmandlines
And here's a readme:
http://mastermonsvr.smartmon.com.au/mp- ... mi_plus.pl
I also submitted a query to the check_wmi_plus developers asking about this issue in case they've got a solution. Thanks in advance for the responses
Re: Checkfilesize wildcard in filepath
I don't see "wildcards" anywhere in the "checkfilesize" section for that readme, but I do see it for other checks. My guess is it is not implemented.
Former Nagios employee
Re: Checkfilesize wildcard in filepath
I received a reply from the checkwmiplus developer:
Thanks for the help
I figured out a different check to use that works, but I've posted this response here for anyone else who may be interested. Feel free to mark this as solved.It can be done but it can timeout the plugin so I did not include it.
Try this
add -d -z to the command line (without any wildcards) Look near the top of the output for the wmic command used "QUERY:"
Run the wmic command from the command line to make sure it works
Modify the wmic query using "like" and "%"
eg
name like "c:\\temp\\PC_task_manager%"'
Try that, see if it works for you
Thanks for the help
Re: Checkfilesize wildcard in filepath
Nice to hear! We'll go ahead and close this up now.
Former Nagios employee