Version 24 (modified by anonymous, 5 years ago) (diff)

--

TracNav

CheckFile

A new command to check a bunch of files.

BETA

Simple draft and subject to change. This works similarily to CheckEventLog and uses filters to filter out (or in) a certain amount of files and then checks the count against a given number reporting an error if the count is not within bounds.

OptionValuesDescription
fileA filename, filter or pathThe files to check for instance c:\*.* will check the entire drive (bad idea) c:\foo\bar\my\file.txt will check only that file.
filterin, out, any, allSpecify the way you want to filter things. (Se section below)
descriptionsNoneFlag to specify if you want to include string representation of the file data (not implemented yet)
truncatelength of the returned setThis will truncate the output after the specified length. As NRPE can only handle 1024 chars you need to truncate the output.
MaxWarnnumber of recordsThe maximum hits to allow before reporting a warning state.
MaxCritnumber of recordsThe maximum hits to allow before reporting a critical state.
MinWarnnumber of recordsThe minimum hits to allow before reporting a warning state.
MinCritnumber of recordsThe minimum hits to allow before reporting a critical state.
filter-sizesize-expressionThe size a file should have.
filter-creationtime-expressionFilter on a date (the time is specified from "now" not absolute. so filter-created=>2d will mean files created more then 2 days ago will match.
filter-accessedtime-expressionFilter on a date (the time is specified from "now" not absolute.)
filter-writtentime-expressionFilter on a date (the time is specified from "now" not absolute.)
syntaxStringA syntax string that describes how each matched file is shown the string can have the following keywords: %filename%, %creation%, %access%, %write%, %size%

Filter

filter = (in, out, any, all) Specify the way you want to filter things.

inmeans any thing matching this filter will be included in the result.
outmeans any thing matching this filter will be excluded from the result.
anymeans any of the filter rules has to match.
allmeans all of the filter rules have to match.

Thus filter=all filter=in and filter=any filter=out is the combinations that makes the most sense depending on your filter concept.

Examples


This command will check the date of a file (boot.ini) and alert if it's modified (written) date is greater than 3 days (3d).

checkcommand.cfg -

command_line

$USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFile -a file="$ARG1$" filter-written=\>"$ARG2$" syntax="%filename% last updated %write%" MaxCrit=1

service.cfg -

check_command

nrpe_check_file_last_written!"C:
boot.ini"!3d