NSClient++ Help (#1) - Checkfile subfolders and creationfilter (#841) - Message List

Checkfile subfolders and creationfilter

Hello, i have some problems with checkfiles.

the first one: if i want to now if a filewritedate is younger then 25 days this work for me:

/usr/lib/nagios/plugins/check_nrpe -H hostip -p 5666 -c CheckFiles -a path=c:
test pattern=*.log filter="written lt"-25d "syntax=%filename% - %write%" MaxCrit=1

but: if i use creation as filter i get a "critical" message.

/usr/lib/nagios/plugins/check_nrpe -H hostip -p 5666 -c CheckFiles -a path=c:
test pattern=*.log filter="creation lt"-25d "syntax=%filename% - %creation%" MaxCrit=1# message: backup - Copy.log - Thursday, July 28, 2011 07:33:40, found files: 1 > critical|'found files'=1;0;1

only if i say -225d or more i will get a checkfile ok. in the tutorialpage for checkfiles the filter is named "create" but only creation works without syntaxerror.

the second one:

if i use the same command with a folder which has some subfolders, the checkwritedate command looks only in one subfolder an list the critical files. all other criticalfiles in the other subfolders arend't shown in the output. (found fiels:6 but there are more than 20 in all subfolders.

  • Message #2264

    The keywords are:

    • filename, type_string
    • name, type_string
    • version, type_string
    • path, type_string
    • line_count, type_int
    • size, type_size
    • access, type_date
    • creation, type_date
    • written, type_date

    Secondly filter="written lt"-25d should most likely be filter="written lt -25d" but maybe that is a typo?

    Thridly: filter="written lt -25d" means files older then 25 days? what you want is filter="written gt -25d" read as "written (is greater then) (25 days ago)" (greater meaning after)

    Michael Medin

    • Message #2268

      The keywords are:

      • filename, type_string
      • name, type_string
      • version, type_string
      • path, type_string
      • line_count, type_int
      • size, type_size
      • access, type_date
      • creation, type_date
      • written, type_date

      Yes, but: " Order

      Order is somewhat important but mainly in the fact that some operations are more costly then others. For instance line_count requires us to read and count the lines in each file so choosing between the following:

      filter=create < -2d and line_count > 100

      filter=line_count > 100 and create < -2d "

      Secondly filter="written lt"-25d should most likely be filter="written lt -25d" but maybe that is a typo?

      It seems to work with both. The problem: if i use "written lt -25d" i cant say written lt $ARG2$" as command. This will run into an syntax error.

      Thridly: filter="written lt -25d" means files older then 25 days? what you want is filter="written gt -25d" read as "written (is greater then) (25 days ago)" (greater meaning after)

      i want the following: As long as the file is not older than 25d nagios should report "OK" if i say "written gt -25d" a file that changed just a minute ago is critical. If i use "creation" on a file that is created 20mins ago. i get critical if i say "creation gt -2500d" or ="creation gt -1m" If i use written on the same file i get crit on -2500d and ok on -1m

      So i think something is wrong with creation.

      the problem with recursive folders is gone. I recreated the checkcommand in nagios from scratch. now it works.

      greets and thank you for your fast answer.

      • Message #2275

        Under *nightly* there is a new build of 0.3.9 please see if that fixes this issue.

        Michael Medin

      • Message #2270

        Humm...

        Now this sparks a though... When I merged I noticed I had issues with the "others" (ie. non write) so perhaps I have the wrong version actually?

        Let me check the and I will update tonight if that is the case...

        Michael Medin

        • Message #2271

          thanks for your help.

          Ife fixed my mindproblem with the "lt gt problematic" the thing is: i cant use Maxcrit for this check. i have to use crit=eq:0 then gt works fine.

          btw, if you are looking into the code next time: i have a small suggestion. i use htmlcode in the syntax-section, to start a new line every critical file in the output. It seems that the plugin spawn a "," in front of every new file that is critical. That looks rather ugly in my configuration f.e.:

          "

          file.txt - 2M

          , file2.txt - 4M

          , file3.txt - 3M

          "

          Maybe you can remove this "," or give an option to disable this autoinsert

          bye. Rafael

Subscriptions