01. 07. 2010 Patrick Zambelli Unified Monitoring

Check File or Directory Size

To implement an effective and easy to customizable monitoring of the size of a single file or an entire directory on a Microsoft based system, can be implemented a very simple check.
Making use of the default NetEye monitoring agent for Microsoft, the NSClient++, a new NRPE command can be defined without mayor adaptations in the NSC.ini file.

The only things you have to make sure, are that arguments have been enabled and that the passing of special characters ( in this case we need to pass a ‘\’ ) via NRPE is allowed. The parameters to set are:

  • allow_arguments=1
  • allow_nasty_meta_chars=1

First define a new check command called “check_file_size” of the structure:

Nagios Command definition

$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ File:$ARG3$=$ARG4$

Define a Service where you specify the arguments for:

  • ARG1: Warning size
  • ARG2: Critical Size
  • ARG3: File name return description
  • ARG4: The path to the folder or filename.
    C:\\temp\\test.txt
  • C:\\temp\\*

ADVICE: Make sure to escape the used backslashes!

Size Units: B=Bytes K=KiloBytes M=MegaBytes G=GigaBytes

Nagios Service definition example

Nagios Service definition example

Patrick Zambelli

Patrick Zambelli

Project Manager at Würth Phoenix
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.

Author

Patrick Zambelli

After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.

2 Replies to “Check File or Directory Size”

  1. JJ says:

    hello,

    I don’t undersant:
    I have the following command :

    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ MaxCrit=$ARG2$ File:$ARG3$=$ARG4$

    and my arguments are :
    check_file_size!9M!10M!”Server log”!”C:\\Adobe\\Adobe LiveCycle ES2\\jboss\\server\\lc_turnkey\\*”

    Doesn’t work.

    Please help me

    Thanks in advance.

  2. Patrick Zambelli says:

    Hi,

    your command syntax seems to be fine.
    Can you specify the error you get ? Can you provide the agent’s log for additional hint ?

    In any case if you use NSClient++ you have to ensure to enable the NRPE dll and to enable the arguments + the “nasty characters” argument in NSC.ini

    bye

Leave a Reply

Your email address will not be published. Required fields are marked *

Archive