check_files parameters different in Icinga?

This forum was archived to /woltlab and is now in read-only mode.
  • Hello,

    I try to use the nrpe check_files to check the existence of files on a Windows 7 client. As long as I call the command on a command line on the icinga server it works ok:

    root@icinga2:/usr/lib/nagios/plugins# ./check_nrpe -H 192.168.0.29 -c check_files -a path=c:\\temp\\UJOBS pattern=*.txt filter='written < -2m' 'crit=count>0'


    Now I tried to insert the same to command.conf (yes, I know now to use parameters, but I try to reduce possible errors to fix this problem):

    ==============================

    object CheckCommand "my-check_nrpe" {

    import "plugin-check-command"


    command = [ PluginDir + "/check_nrpe -H 192.168.0.29 -c check_files -a path=c:\\Temp\\UJOBS\\ pattern=*.txt filter='written < -2m' 'crit=count>0'" ]

    }

    ============================

    But then I get on the icinga dashboard the following error message:

    execvpe(/usr/lib/nagios/plugins/check_nrpe -H 192.168.0.29 -c check_files -a path=c:\temp\UJOBS\ pattern=*.txt filter='written < -2m' 'crit=count>0' failed: no such file or directory.


    I tried now several versions with slashes and backslashes but found nothing working.


    Could anybody help me how to fix this problem?


    many thanks in advance and best regards

    Klaus

  • A command does not exist as single string line, but is an array with paths and arguments.


    https://www.icinga.com/docs/ic…ng-basics/#check-commands


    In order to save time with building your own nrpe CheckCommand, I'd suggest to use the existing "nrpe" CheckCommand provided by the ITL. You can pass arguments as needed (-a -> nrpe_arguments) and so on.


    https://www.icinga.com/docs/ic…nt-based-monitoring/#nrpe

  • Many thanks for your help. I'm a step further, but not completely.


    i defined now the following:

    ===============

    object CheckCommand "check_nrpe_ide2" {

    import "plugin-check-command"

    command = [ PluginDir + "/check_nrpe" ]

    arguments = {

    "-H" = "$check_nrpe_host$"

    "-c" = "$check_nrpe_arg$"

    "-a" = "$check_nrpe_parm$"

    }

    vars.check_nrpe_host = "$address$"

    }

    ==================

    apply Service "Kontrolle Infor UJobs" {

    import "generic-service"

    check_command = "check_nrpe_ide2"

    #vars.check_nrpe_arg = "check_load"

    #vars.che

    ck_nrpe_parm = "'20%' '10%' '/'"

    assign where host.name == "ServerV3"

    }

    ========================


    As long as I leave the args commented I get the answer "see to be doing fine"; uncommenting the args I get the error "unknown command".


    I found in the literature something about a nrpe.cfg but my problem is the windows client. Do I have to create such a cfg file at the client?? May be in the nsclient.ini ??


    Best regards

    Klaus

  • I still don't understand why you want to create your own CheckCommand. I'll wrap your command line into a possible service definition using the native "nrpe" CheckCommand, maybe you'll get my idea.


    https://www.icinga.com/docs/ic…ga-template-library/#nrpe


    Code
    1. apply Service "ujobs" {
    2. check_command = "nrpe"
    3. vars.nrpe_command = "check_load" //the command defined in nrpe.cfg on the remote client
    4. vars.nrpe_arguments = [ "20%", "10%", "/" ] //an array of possible overloaded arguments (-a passed to the remote client)
    5. assign where host.vars.agent == "nrpe"
    6. }


    Execute it once and fetch the executed command line from the REST API then.


    https://www.icinga.com/docs/ic…ecuted-command-for-checks

  • Thanks, with your code I get the same error message as before. Sorry, I', not that familiar with the REST API, I get no information there. But in the icingaweb I still get the error "Unknown command : check_load". i have still the impression that there is any configuration entry missing.

  • "check_load" must be defined in your client's nrpe.cfg of course. That error is returned from check_nrpe which receives it from the nrpe daemon.