Set parameters for remote disk_check

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


    I've followed documentation from Top Down Command Endpoint to monitor a couple of Linux hosts

    I tried to add a disk service for the zone they lies in, but I cannot run disk without parameters due to grsecurity :


    Code
    1. # sudo -u nagios /usr/lib/nagios/plugins/check_disk -w 10% -c 5%
    2. DISK CRITICAL - /sys/kernel/security is not accessible: Permission denied
    3. # sudo -u nagios /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X /sys/kernel/security
    4. DISK CRITICAL - /sys/kernel/security is not accessible: Permission denied
    5. # sudo -u nagios /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p / -p /srv
    6. DISK OK - free space: / 5411 MB (47% inode=83%); /srv 34340 MB (31% inode=99%);| /=5941MB;10770;11368;0;11967 /srv=76388MB;99669;105206;0;110744


    As you can see, the plug-in tries to access a resource denied by configuration, unless I provide the path it needs to check. I'm OK with that.

    I've the tried to alter the apply Service block in my zone's services.conf (/etc/icinga2/zones.d/nomination/services.conf)



    But neither the first nor the second form seems to affect the way the binary is ran on the monitored client : I still get a CRITICAL error although Custom Variables block in web gui (host.disk) displays the variables


    Code
    1. Custom Variables
    2. Disk {
    3. partitions =>
    4. * /
    5. * /srv
    6. }
    7. Disk Partitions
    8. * /
    9. * /srv


    I've looked in the /usr/share/icinga2/include/command-plugins.conf file to try to figure out the variable I need to pass, hence the 2 tries I made from the following definition



    I though I had to provide the disk_partitions variable to pass the -p parameter(s), but I may be wrong.


    Can you help me configuring this ?

    Thanks !

  • I think an easier way would be to define which partition to check on the Host object instead of the Service object.


    See my example:

    Then, use the default Service definition for checking a disk:

    Code
    1. apply Service for (disk => config in host.vars.disks) {
    2. import "generic-service"
    3. check_command = "disk"
    4. vars += config
    5. }

    Doing it this way will combine all of that information into one Service. Perhaps you'd like to separate them, in which case you would replace the Host object mentioned above to something like this:


  • If the custom attributes are not used as command parameter, first inspect the command line which is run to execute such. You can inspect that via REST API for example.


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


    Maybe your clients also have "conf.d" included (which is the default) and it erroneously sends back wrong check results.

    https://www.icinga.com/docs/ic…ck-thresholds-not-applied