I've modified check_ssh and check_by_ssh to support this and wondered if you'd like to include it in the main build.
The change are:
Code: Select all
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 1f8913c..e30f413 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -222,9 +222,14 @@ process_arguments (int argc, char **argv)
timeout_interval = atoi (optarg);
break;
case 'H': /* host */
+ if (p1=strstr(optarg,":"))
+ *p1=0; /* terminate the host-name */
host_or_die(optarg);
hostname = optarg;
- break;
+ if (!p1)
+ break;
+ optarg=p1+1; /* set port number as next param
+ and fall thru... */
case 'p': /* port number */
if (!is_integer (optarg))
usage_va(_("Port must be a positive integer"));
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index ac7a4d4..762f9fe 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -174,6 +174,12 @@ process_arguments (int argc, char **argv)
c = optind;
if (server_name == NULL && c < argc) {
+ char *p;
+ if (p=strstr(argv[c],":")) {
+ *p=0; /* terminate the host-name */
+ if (is_intpos(p+1)) /* set the port number */
+ port=atoi(p+1);
+ }
if (is_host (argv[c])) {
server_name = argv[c++];
}