Question about monitor disk usage of Windows which has multiple drives with check_nt

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


    When I monitor disk C of a windows server, I use below configuration and it works.


    object Service "DiskUsage" {

    import "generic-service"

    check_command = "nscp"

    host_name = "Windows_Server"

    vars.nscp_variable = "USEDDISKSPACE"

    vars.nscp_params = "c"

    vars.nscp_warn = 85

    vars.nscp_crit = 90

    }


    But I have a few windows servers and some windows servers have more than one disk, such disk D, E, ,F, etc

    How can I make above configuration applicable for all the windows servers?


    Thanks

  • Actually i would create a apply rule in the icinga2 Service:


    Code
    1. apply Service "DiskUsage C" {
    2. import "generic-service"
    3. check_command = "nscp"
    4. vars.nscp_variable = "USEDDISKSPACE"
    5. vars.nscp_params = "c"
    6. vars.nscp_warn = 85
    7. vars.nscp_crit = 90
    8. assign where host.vars.os == "Windows"
    9. }


    With this assign it will be added to all Hosts that have the attribute vars.os = "Windows" in the Host Object


    Further you could add the following for a other drive:


    Code
    1. apply Service "DiskUsage D" {
    2. import "generic-service"
    3. check_command = "nscp"
    4. vars.nscp_variable = "USEDDISKSPACE"
    5. vars.nscp_params = "d"
    6. vars.nscp_warn = 85
    7. vars.nscp_crit = 90
    8. assign where "D" in host.vars.disks
    9. }


    That means that you have to add the following array with the dive letters to the host and a according apply rule to add them.


    Code
    1. vars.disks = [ "D" , "E"  ]