![](/img/trans.png)
[英]Getting status information of check_mysql-health command in Nagios Core
[英]icinga check command check_nwc_health returns “Unkown option:” but at cli the command works
我想使用 check_nwc_health 檢查在 icinga2 中編寫測試/檢查條件,以獲取 avm dect 200 電源插座的一些狀態信息,其中提供有關 state 連接設備的信息,開機,能耗等(就像你可以做的一切一樣插入:電視、服務器、冰箱、洗衣機、烘干機等)。
檢查幾乎准備就緒,但缺少一點東西,因此腳本無法僅提供一個帶有選項 --name 的設備的 state。 在 shell cli 上,它正在運行,命令如下:
https://labs.consol.de/assets/downloads/nagios/check_nwc_health-7.12.1.2.tar.gz
[icinga@centos7 icinga2]# /usr/lib64/nagios/plugins/check_nwc_health --hostname 10.10.10.3 --port 49000 --community 'Umligro:-)' --mode smart-home-device-status --name 'Wäschetrockner' --verbose
OK - device Wschetrockner ok
device Wschetrockner is connected and switched on
output 使用 --name 選項是正確的。
現在 icinga 配置:
主機配置:
object Host "fritzbox-7390.fritz.box" {
check_command = "hostalive"
address = "10.10.10.3"
vars.os_type = "FritzOS"
vars.avm_port = "49000"
vars.avm_passwort = "Umligro:-)"
vars.avm_mode_status = "smart-home-device-status"
vars.avm_consumption_warning = "80"
vars.avm_consumption_critical = "95"
}
命令.conf:
object CheckCommand "check_fritzbox-7390" {
import "plugin-check-command"
command = [ PluginDir + "/check_nwc_health" ]
"--hostname" = "$avm_host$"
"--port" = "$avm_port$"
"--community" = "$avm_passwort$"
"--mode" = "$avm_mode$"
"--name" = {
value = "--name $avm_device_name$"
description = "Name of smart home device"
skip_key = true
required = true
}
"--verbose" = ""
}
}
services.conf:
apply Service "fritz-device-status-Geschirrspüler_Haus" {
import "generic-service"
check_command = "check_fritzbox-7390"
vars.avm_host = "$address$"
vars.avm_mode = "smart-home-device-status"
vars.avm_device_name = "Geschirrspüler Haus"
vars.avm_consumption_warning = "$nwc_health_warning$"
vars.avm_consumption_critical = "$nwc_health_critical$"
assign where host.vars.os_type == "FritzOS"
}
apply Service "fritz-device-status-Wäschetrockner" {
import "generic-service"
check_command = "check_fritzbox-7390"
vars.avm_host = "$address$"
vars.avm_mode = "smart-home-device-status"
vars.avm_device_name = "Wäschetrockner"
vars.avm_consumption_warning = "$nwc_health_warning$"
vars.avm_consumption_critical = "$nwc_health_critical$"
assign where host.vars.os_type == "FritzOS"
}
而 icinga web 接口 output 看起來像這樣:
fritzbox-7390.fritz.box
fritz-device-status-Geschirrspüler_Haus
UNKNOWN 07-22-2020 15:25:34 0d 0h 35m 55s 1/5 (#0) Unknown option: name Geschirrspüler Haus
fritz-device-status-Wäschetrockner
UNKNOWN 07-22-2020 15:25:04 0d 0h 35m 55s 1/5 (#0) Unknown option: name Wäschetrockner
ping4
OK 07-22-2020 15:24:45 0d 1h 3m 1s 1/5 PING OK - Packet loss = 0%, RTA = 2.26 ms
現在,我的知識和神經已經耗盡,經過大約 6 個小時的搜索,我不得不放棄調試文件。
請有人可以幫助我解決這個問題,也許這只是我忽略的一件小事。
最好的問候,克里斯
您使用的插件不接受“--name”參數,因此只需將其從命令配置中刪除即可。
供參考: https://exchange.icinga.com/lausser/check_nwc_health
正確的語法也如下所示:
"--name" = {
value = "$avm_device_name$"
description = "Name of smart home device"
}
為什么要跳過密鑰然后在參數中傳遞密鑰本身? 命令將處理這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.