mirror of https://github.com/Icinga/icinga2.git
parent
be4324c606
commit
9b9ee5c425
|
@ -163,6 +163,7 @@ Custom Attributes:
|
|||
Name | Description
|
||||
----------------|--------------
|
||||
ssh_address | **Optional.** The host's address. Defaults to "$address$".
|
||||
ssh_port | **Optional.** The port that should be checked. Defaults to 22.
|
||||
|
||||
### <a id="itl-disk"></a> disk
|
||||
|
||||
|
|
|
@ -193,10 +193,18 @@ object CheckCommand "ntp_time" {
|
|||
object CheckCommand "ssh" {
|
||||
import "plugin-check-command"
|
||||
|
||||
command = [
|
||||
PluginDir + "/check_ssh",
|
||||
"$ssh_address$"
|
||||
]
|
||||
command = PluginDir + "/check_ssh"
|
||||
|
||||
arguments = {
|
||||
"-p" = {
|
||||
value = "$ssh_port$"
|
||||
optional = true
|
||||
}
|
||||
"host" = {
|
||||
value = "$ssh_address$"
|
||||
skip_key = true
|
||||
}
|
||||
}
|
||||
|
||||
vars.ssh_address = "$address$"
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@
|
|||
%attribute %string "value"
|
||||
%attribute %string "description"
|
||||
%attribute %number "optional"
|
||||
%attribute %number "skip_key"
|
||||
%attribute %string "set_if"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -59,13 +59,15 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
|
|||
const Value& arginfo = kv.second;
|
||||
|
||||
bool optional = false;
|
||||
bool skip_key = false;
|
||||
String argval;
|
||||
|
||||
if (arginfo.IsObjectType<Dictionary>()) {
|
||||
Dictionary::Ptr argdict = arginfo;
|
||||
argval = argdict->Get("value");
|
||||
optional = argdict->Get("optional");
|
||||
|
||||
skip_key = argdict->Get("skip_key");
|
||||
|
||||
String set_if = argdict->Get("set_if");
|
||||
|
||||
if (!set_if.IsEmpty()) {
|
||||
|
@ -106,7 +108,8 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
|
|||
}
|
||||
|
||||
Array::Ptr command_arr = command;
|
||||
command_arr->Add(argname);
|
||||
if (!skip_key)
|
||||
command_arr->Add(argname);
|
||||
if (!argval.IsEmpty())
|
||||
command_arr->Add(argresolved);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue