从Icinga2输出中删除NFS安装的分区?

时间:2017-04-08 13:27:56

标签: linux monitoring partition icinga2

我们有大约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
}

1 个答案:

答案 0 :(得分:1)

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

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