Single quotes at NRPE arglist

Hey at all,

currently we are trying to migrate from Icinga 1 to Icinga 2 but I am facing big problems using NRPE commands combined with NSClient++.

I tried to use NRPE using ITL and I tried to use NRPE plugin itself but always I am getting same error message:
CRITICAL: Could not get free space for: ShowAll MinWarnFree ShowAll MinWarnFree reason: 3: The system cannot find the path specified.

As far as I understand root of problem seems to be single quotes. Copying command to command line results at same error message. Removing single quotes at arg list (…‘a’ ShowAll MinWarnFree=10% MinCritFree=5%) works fine.

Do you have any idea how to get my problems fixed? What is wrong?
I have to pass arguments to NSClient. It won’t be option to code params into nsclient.ini

Thanks and regards

These are my config files:

object CheckCommand "check_nrpe_drivesize" {
import "plugin-check-command"
command = [ PluginDir + "/check_nrpe" ]
arguments += {
    "-H" = {
        order = 1
        value = "$address$"
    "-a" = {
        order = 4
        value = "$ARG1$"
    "-c" = {
        order = 3
        value = "CheckDriveSize"
    "-u" = {
        order = 2

    template Service "check-nrpe-drivesize-variabel" {
    check_command = "check_nrpe_drivesize"
    max_check_attempts = "2"
    check_period = "24x7"
    check_interval = 10m
    retry_interval = 5m
    enable_notifications = true
    enable_active_checks = true
    enable_passive_checks = false
    enable_event_handler = true
    enable_flapping = false
    enable_perfdata = false
    vars.ARG1 = "$host.vars.NRPE_DRIVESIZE$"

    object Host "XXXX" {
    import "Generic-Server"
    display_name = "XXX"
    address = "XXXX"
    vars.NRPE_DRIVESIZE = "ShowAll Drive=E: MinWarnFree=20G MinCritFree=10G"
    vars.Prio = 3
    vars.contacts = XXXX

Inspect command:
'/usr/lib64/nagios/plugins/check_nrpe' '-H' '' '-u' '-c' 'CheckDriveSize' '-a' 'ShowAll MinWarnFree=10% MinCritFree=5%'


please don’t try to create you own custom check command in this regard, but re-use the nrpe command provided within the ITL.

Typically this looks like this:

apply Service "drivesize" {
  check_command = "nrpe"
  vars.nrpe_command = "CheckDriveSize"
  vars.nrpe_arguments = [ "ShowAll", "Drive=E:", "MinWarnFree=20G",  "MinCritFree=10G" ]

In case you’re using the Director, navigate to Commands > External > and search for nrpe. Select it and export the fields nrpe_command and nrpe_arguments, save and store. In your service template or apply rule then select and assign the values once check_command is set to nrpe, same as above.


Hi Michael,

thanks a lot for your reply.
I already tried to use ITL command but it didn’t work either.
To make it more easy I set arglist directly at service template and not via host variable.

I tried to reproduce it again but this time I am getting error message while clicking to “Inspect”:

Parsing JSON result failed: Malformed UTF-8 characters, possibly incorrectly encoded

#0 /usr/share/icingaweb2/modules/director/library/Director/Core/RestApiResponse.php(21): Icinga\Module\Director\Core\RestApiResponse->parseJsonResult(String)
#1 /usr/share/icingaweb2/modules/director/library/Director/Core/RestApiClient.php(166): Icinga\Module\Director\Core\RestApiResponse::fromJsonResult(String)
#2 /usr/share/icingaweb2/modules/director/library/Director/Core/RestApiClient.php(82): Icinga\Module\Director\Core\RestApiClient->curlRequest(String, String, String, Boolean, Boolean)
#3 /usr/share/icingaweb2/modules/director/library/Director/Core/RestApiClient.php(185): Icinga\Module\Director\Core\RestApiClient->request(String, String, Object(stdClass))
#4 /usr/share/icingaweb2/modules/director/library/Director/Core/CoreApi.php(118): Icinga\Module\Director\Core\RestApiClient->get(String, Object(stdClass))
#5 /usr/share/icingaweb2/modules/director/application/controllers/InspectController.php(111): Icinga\Module\Director\Core\CoreApi->getObject(String, String)
#6 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\InspectController->objectAction()
#7 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#8 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#9 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#10 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#11 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#12 {main}

Service output looks like:
CRITICAL: Could not get free space for: [ "ShowAll", "Drive [ "ShowAll", "Drive reason: 123: Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr�gerbezeichnung ist falsch.

And config files looke like:

template Service "TEST-ITL-NRPE" {
    check_command = "nrpe"
    vars.nrpe_arguments = "[ \"ShowAll\", \"Drive=E:\", \"MinWarnFree=20G\",  \"MinCritFree=10G\" ]"
    vars.nrpe_command = "CheckDriveSize"

apply Service "TEST-ITL-NRPE-Apply" {
    import "TEST-ITL-NRPE"

    assign where == "XXXX"

    import DirectorOverrideTemplate

That’s not a correct array notation. Look at my example above, where the array elements are strings themselves.

OK, I can see difference but I don’t know how to define array at Icinga 2 Director.
Director always adds quotation marks at beginning and end.

I am to stupid for this system :smiley:


Edit the data field nrpe_arguments and change type to array.

1 Like

Thanks a lot Markus and Michael!!!
You are my heroes :wink:

Now it works fine.