Exclude partition on check_disk

Hi all,
I have a second problem with my check_disk Service.
My Linux Server has a local Filesystem and a nfs Filesystem (mnt/sugarcrm). I want to be exclude the nfs Partition (/mn/sugarcrm)
When I restart the Icinga Master, for a short moment the disk_check is OK, but then I saw the nfs Partition again. Whats wrong here?

 // Check System disk Usage
    apply Service "disk" {
    check_command ="disk"

    vars.disk_cfree = "2%"
    vars.disk_wfree = "3%"
    vars.disk_all   = "true"
    vars.disk_local   = "true"
    vars.disk_exclude_type = ["overlay","tmpfs","nsfs","sysfs","shm","debugfs","tracefs","nfs"]
    vars.disk_ignore_ereg_path = ["/daten/docker","/run/docker"]
    vars.disk_partitions_excluded = ["/dev","/mnt/sugarcrm"]
    command_endpoint = host.vars.client_endpoint

    assign where host.vars.disk == "yes"
    }

Does anyone know where is the problem on my config?

1 Like

Hi,

please run the following command:

icinga2 object list --type Service

You’ll get all configured services as output, filter the output for your disk service and post it here please. Do you have a distributed setup with satellites and agents?

Best regards
Michael

Object ‘server01.example.com!disk’ of type ‘Service’:
% declared in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20

  • __name = “server01.example.com!disk”
  • action_url = “”
  • check_command = “disk”
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 62:3-62:23
  • check_interval = 300
  • check_period = “”
  • check_timeout = null
  • command_endpoint = “server01.example.com
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 71:3-71:46
  • display_name = “disk”
  • enable_active_checks = true
  • enable_event_handler = true
  • enable_flapping = false
  • enable_notifications = true
  • enable_passive_checks = true
  • enable_perfdata = true
  • event_command = “”
  • flapping_threshold = 0
  • flapping_threshold_high = 30
  • flapping_threshold_low = 25
  • groups = [ ]
  • host_name = “server01.example.com
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20
  • icon_image = “”
  • icon_image_alt = “”
  • max_check_attempts = 3
  • name = “disk”
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20
  • notes = “”
  • notes_url = “”
  • package = “_etc”
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20
  • retry_interval = 60
  • source_location
    • first_column = 1
    • first_line = 61
    • last_column = 20
    • last_line = 61
    • path = “/etc/icinga2/zones.d/master/Services/default_services.conf”
  • templates = [ “disk” ]
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20
  • type = “Service”
  • vars
    • disk_all = “true”
      % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 66:3-66:26
    • disk_cfree = “2%”
      % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 64:3-64:24
    • disk_local = “true”
      % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 67:3-67:28
    • disk_wfree = “3%”
      % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 65:3-65:24
  • volatile = false
  • zone = “master”
    % = modified in ‘/etc/icinga2/zones.d/master/Services/default_services.conf’, lines 61:1-61:20

So you do have a distributed setup? server01.example.com is your Icinga 2 master server? If not please run the command from above again on the server01.example.com.

My guess is that on the server01.example.com the conf.d directory is still included. Please check the the icinga2.conf file for a line like this:

// Disabled by the node setup CLI command on 2020-06-20 11:08:31 +0200
// include_recursive "conf.d"

Best regards
Michael

Yes I have and yes the first was the output from the icinga-master.
Here are now the output from the client. But strange there are two disk Services :thinking:

Object ‘server02.example.com!disk’ of type ‘Service’:
% declared in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53

  • __name = “server02.example.com!disk”
  • action_url = “”
  • check_command = “disk”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 68:3-68:24
  • check_interval = 60
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 28:3-28:21
  • check_period = “”
  • check_timeout = null
  • command_endpoint = “”
  • display_name = “disk”
  • enable_active_checks = true
  • enable_event_handler = true
  • enable_flapping = false
  • enable_notifications = true
  • enable_passive_checks = true
  • enable_perfdata = true
  • event_command = “”
  • flapping_threshold = 30
  • groups = [ ]
  • host_name = “server02.example.com
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • icon_image = “”
  • icon_image_alt = “”
  • max_check_attempts = 5
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 27:3-27:24
  • name = “disk”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • notes = “”
  • notes_url = “”
  • package = “_etc”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • retry_interval = 30
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 29:3-29:22
  • templates = [ “disk”, “generic-service” ]
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 26:1-26:34
  • type = “Service”
  • vars
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 70:3-70:16
  • volatile = false
  • zone = “”

Object ‘server02.example.com!disk /’ of type ‘Service’:
% declared in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53

  • __name = “server02.example.com!disk /”
  • action_url = “”
  • check_command = “disk”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 68:3-68:24
  • check_interval = 60
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 28:3-28:21
  • check_period = “”
  • check_timeout = null
  • command_endpoint = “”
  • display_name = “disk /”
  • enable_active_checks = true
  • enable_event_handler = true
  • enable_flapping = false
  • enable_notifications = true
  • enable_passive_checks = true
  • enable_perfdata = true
  • event_command = “”
  • flapping_threshold = 30
  • groups = [ ]
  • host_name = “server02.example.com
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • icon_image = “”
  • icon_image_alt = “”
  • max_check_attempts = 5
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 27:3-27:24
  • name = “disk /”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • notes = “”
  • notes_url = “”
  • package = “_etc”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
  • retry_interval = 30
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 29:3-29:22
  • templates = [ “disk /”, “generic-service” ]
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 65:1-65:53
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 26:1-26:34
  • type = “Service”
  • vars
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 70:3-70:16
    • disk_partitions = “/”
  • volatile = false
  • zone = “”

As I guessed the conf.d folder inclusion is not disabled. :slightly_smiling_face:

In a distributed setup the conf.d inclusion can be disabled. Open /etc/icinga2/icinga2.conf on your agent/satellite e.g. server02.example.com in your case and search for a line like:

include_recursive "conf.d"

Now simply comment it out by putting // in front, so you have:

// include_recursive "conf.d"

Now restart the Icinga 2 daemon on the satellite/agent.

Best regards
Michael

Hi Michael,
thanks a lot for yout Support :handshake:
Now I know why there are was two Services :slight_smile:

Problem solved :grinning:

Cheers
Joern

1 Like