0

我们有大约 10 台服务器,它们都安装了 NFS 分区。Icinga 上的所有主机都会显示该 NFS 分区,因此当达到 NFS 分区阈值时,会针对该特定错误发送 10 封邮件通知。

问题是如何从不同的主机中删除 NFS 分区。

目前默认配置如下:

apply Service for (display_name => config in host.vars.snmp.disks) {
    import "generic-service-faxir"

    check_command = "snmp-storage-parameteric"
    vars += config

    if (vars.snmp_warn == ""){
        vars.snmp_warn = "70"
    }
    if (vars.snmp_crit == ""){
        vars.snmp_crit = "85"
    }

    //Converting capacity to percentage
    if(vars.capacity != ""){
        if(vars.capacity_warn != ""){
            vars.snmp_warn = 100 * vars.capacity_warn / vars.capacity
        }
        if(vars.capacity_crit != ""){
            vars.snmp_crit = 100 * vars.capacity_crit / vars.capacity
        }
    }

    //ext2, ext3, and ext4 has 5% reserved for OS
    if (host.vars.os == "Linux"){
         vars.snmp_storage_reserved = 5
    }

   ignore where host.vars.os !in ["Linux", "Windows"]
}

EDIT1: 命令代码如下:

/**
 * based on:
 * snmp storage - Disk/Memory
 *   Url reference: http://nagios.manubulon.com/snmp_storage.html
 */
object CheckCommand "snmp-storage-parameteric" {
    import "snmp-manubulon-command"

    command = [ ManubulonPluginDir + "/check_snmp_storage.pl" ]

    arguments += {
        "-m" = "$snmp_storage_name$"
        "-f" = {
            set_if = "$snmp_perf$"
        }
        "-R" = "$snmp_storage_reserved$"
        "-T" = "$snmp_storage_type$"
        "-G" = ""
     }

    vars.snmp_storage_name = "^/$$"
    vars.snmp_storage_type = "pu"
    vars.snmp_warn = 80
    vars.snmp_crit = 90
    vars.snmp_perf = true
    vars.snmp_storage_reserved=0
}
4

1 回答 1

1

我还没有尝试过,但是您可以查看以下命令参数:

最好是在命令行上测试各种参数,然后将它们添加到您的 CheckCommand 和 Service 定义中。

于 2017-06-18T15:09:22.200 回答