CheckFiles test for missing file

Forums NSClient++ support CheckFiles test for missing file

This topic contains 2 replies, has 2 voices, and was last updated by  Michael Medin 3 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2044

    I am trying us NSClient to do two tests on a file. The first is to check the age of an xml file. It needs to be less than 10 minutes. This works great.

    
    /check_nrpe -H 192.168.10.205 -c CheckFiles -a path='c:\XML\empty' pattern=contents.xml.old MaxWarn=1 'filter=creation gt 10m'
    

    The file must also exist. If it doesn’t I need a warning. I was hoping CheckFiles would does this but it does not work for me. I have created two directories for testing one with a file and one without. Both return the same result:

    
    check_nrpe -H 192.168.10.205 -c CheckFiles -a path='c:\XML\empty' pattern=contents.xml.old MaxWarn=1 'filter=written gt 10m'
    CheckFile ok|'found files'=0;1;0
    
    
    /check_nrpe -H 192.168.10.205 -c CheckFiles -a path='c:\XML\file' pattern=Contents.xml.old MaxWarn=1 'filter=written gt 10m'
    CheckFile ok|'found files'=0;1;0
    

    I was wondering if anyone might have a suggestion for checking for an expected file.

    I wasn’t having any luck with 3.8 so I am using one of the nightly builds: 0.3.9-Win32-20110331-2148.

    Cheers,
    Paul

    #8490

    Hello

    In case where the file “contents.xml.old” exist in the “XML” folder:
    {{{
    ./check_nrpe -H 192.168.0.11 -c CheckFile2 -a path=’C:\XML’ pattern=contents.xml.old filter+written=gt:10m MaxWarn=1
    contents.xml.old, contents.xml.old: 1 > warning|’contents.xml.old’=1;0;0;
    }}}

    In case where the file “contents.xml.old” dont exist in the “XML” folder
    {{{
    ./check_nrpe -H 192.168.0.11 -c CheckFile2 -a path=’C:\XML’ pattern=contents.xml.old filter+written=gt:10m MaxWarn=1
    CheckFile ok|’no files found’=0;0;0;
    }}}

    Try this, it works for me.

    [EDIT] Erf, the command dont send a warning… I repost when I get it x)

    #8491

    Michael Medin
    Keymaster

    Replace MaxWarn with warn (see documentation?).

    MaxWarn=5 same as warn=>5 (or something along those lines, so warn= is more flexible… in your case warn=eq:1 (ish).

    I can give you more details when I have checked myself…

    // Michael Medin

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.