diff --git a/doc/5-icinga-template-library.md b/doc/5-icinga-template-library.md
index a225e5f3b..cfdc56c2c 100644
--- a/doc/5-icinga-template-library.md
+++ b/doc/5-icinga-template-library.md
@@ -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.
### disk
diff --git a/itl/command-common.conf b/itl/command-common.conf
index ace098fbc..489892aa6 100644
--- a/itl/command-common.conf
+++ b/itl/command-common.conf
@@ -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$"
}
diff --git a/lib/icinga/icinga-type.conf b/lib/icinga/icinga-type.conf
index b856b7431..ead1ea7f0 100644
--- a/lib/icinga/icinga-type.conf
+++ b/lib/icinga/icinga-type.conf
@@ -208,6 +208,7 @@
%attribute %string "value"
%attribute %string "description"
%attribute %number "optional"
+ %attribute %number "skip_key"
%attribute %string "set_if"
}
},
diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp
index 4b93fb3c8..f5a401d23 100644
--- a/lib/icinga/pluginutility.cpp
+++ b/lib/icinga/pluginutility.cpp
@@ -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::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);
}