object CheckCommand "8063-my-disk" {
  command = [ PluginDir + "/check_disk" ]

  arguments = {
    "-w" = {
      value = "$disk_wfree$"
      description = "Exit with WARNING status if less than INTEGER units of disk are free or Exit with WARNING status if less than PERCENT of disk space is free"
      required = true
    }
    "-c" = {
      value = "$disk_cfree$"
      description = "Exit with CRITICAL status if less than INTEGER units of disk are free or Exit with CRITCAL status if less than PERCENT of disk space is free"
      required = true
    }
    "-W" = {
      value = "$disk_inode_wfree$"
      description = "Exit with WARNING status if less than PERCENT of inode space is free"
    }
    "-K" = {
      value = "$disk_inode_cfree$"
      description = "Exit with CRITICAL status if less than PERCENT of inode space is free"
    }
    "-p" = {
      value = "$disk_partitions$"
      description = "Path or partition (may be repeated)"
      repeat_key = true
      order = 1
    }
    "-x" = {
      value = "$disk_partitions_excluded$"
      description = "Ignore device (only works if -p unspecified)"
    }
  }

  vars.disk_wfree = "20%"
  vars.disk_cfree = "10%"
}

object Host "8063-my-server" {
  import "generic-host"
  address = "127.0.0.1"
  address6 = "::1"

  vars.local_disks["basic-partitions"] = {
    disk_partitions = [ "/", "/tmp", "/var", "/home", "/run/user/1000/gvfs" ]
  }
}

apply Service "8063-" for (disk => config in host.vars.local_disks) {
  import "generic-service"
  check_command = "8063-my-disk"
  check_interval = 5s
  retry_interval = 5s

  volatile = true
  vars.volatile_check = true

  vars += config

  vars.disk_wfree = "10%"
  vars.disk_cfree = "5%"

  assign where host.vars.local_disks
}

apply Notification "disk-notification" to Service {
  import "test-mail-service-notification"

  users = [ "test-icingaadmin" ]

  assign where service.vars.volatile_check == true
}

