Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/386258 )

Change subject: gerrit/icinga: fix check_ssh on a custom (service) IP
......................................................................


gerrit/icinga: fix check_ssh on a custom (service) IP

The current check_ssh command definitions always use $HOSTADDRESS$
no matter what.

But in some cases, like gerrit, we have a server AND a service IP
and we don't want all services to listen on all IP addresses, just
on the service IP.

Idbc1654033fb075eded did this for SSH on port 29418. But that broke
monitoring which was checking the wrong (server) IP.

Add a new Icinga command that makes it possible to check for SSHd
on a custom IP.

Use it for gerrit-ssh.

Also removing tab characters and fixing style of existing commands.

Change-Id: I528952be557cbc3d820824537cbcb371828cb280
---
M modules/nagios_common/files/check_commands/ssh.cfg
M modules/profile/manifests/gerrit/server.pp
2 files changed, 18 insertions(+), 11 deletions(-)

Approvals:
  Dzahn: Verified; Looks good to me, approved



diff --git a/modules/nagios_common/files/check_commands/ssh.cfg 
b/modules/nagios_common/files/check_commands/ssh.cfg
index d641d13..8ec4d44 100644
--- a/modules/nagios_common/files/check_commands/ssh.cfg
+++ b/modules/nagios_common/files/check_commands/ssh.cfg
@@ -1,14 +1,14 @@
 # 'check_ssh' command definition
 #define command{
-#      command_name    check_ssh
-#      command_line    /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$'
-#      }
+#    command_name    check_ssh
+#    command_line    /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$'
+#}
 
 # 'check_ssh_port' command definition
 define command{
-       command_name    check_ssh_port
-       command_line    /usr/lib/nagios/plugins/check_ssh -p '$ARG1$' 
'$HOSTADDRESS$'
-       }
+    command_name    check_ssh_port
+    command_line    /usr/lib/nagios/plugins/check_ssh -p '$ARG1$' 
'$HOSTADDRESS$'
+}
 
 ####
 # use these checks, if you want to test IPv4 connectivity on IPv6 enabled 
systems
@@ -18,10 +18,17 @@
 define command{
         command_name    check_ssh_4
         command_line    /usr/lib/nagios/plugins/check_ssh -4 '$HOSTADDRESS$'
-        }
+}
 
 # 'check_ssh_port_4' command definition
 define command{
-       command_name    check_ssh_port_4
-       command_line    /usr/lib/nagios/plugins/check_ssh -4 -p '$ARG1$' 
'$HOSTADDRESS$'
-       }
+    command_name    check_ssh_port_4
+    command_line    /usr/lib/nagios/plugins/check_ssh -4 -p '$ARG1$' 
'$HOSTADDRESS$'
+}
+
+# check ssh port on custom IP (like a service IP)
+define command{
+    command_name    check_ssh_port_ip
+    command_line    /usr/lib/nagios/plugins/check_ssh -p '$ARG1$' '$ARG2$'
+}
+
diff --git a/modules/profile/manifests/gerrit/server.pp 
b/modules/profile/manifests/gerrit/server.pp
index d3a8736..7569dd0 100644
--- a/modules/profile/manifests/gerrit/server.pp
+++ b/modules/profile/manifests/gerrit/server.pp
@@ -29,7 +29,7 @@
 
     monitoring::service { 'gerrit_ssh':
         description   => 'SSH access',
-        check_command => 'check_ssh_port!29418',
+        check_command => "check_ssh_port_ip!29418!${ipv4}",
         contact_group => 'admins,gerrit',
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/386258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I528952be557cbc3d820824537cbcb371828cb280
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to