Faidon Liambotis has submitted this change and it was merged.

Change subject: memcached: use nrpe when binding to localhost
......................................................................


memcached: use nrpe when binding to localhost

Binding to localhost currently means the check from the nagios server is
provisioned, but failing; this happens specifically on holmium (blog).

Modify the code to provision an nrpe check instead, but only if the bind
address is 127.0.0.1. Keep remote checks for the non-localhost case, as
it's better to not rely to nrpe for checking in those (e.g.  for our mc
cluster).

Since this was made specifically for holmium, also add an "include nrpe"
in the blog class.

RT: 6368
Change-Id: I45f5f9240f74b608cffbae2762987b8e1f88ccbb
---
M manifests/memcached.pp
M manifests/misc/blogs.pp
2 files changed, 35 insertions(+), 27 deletions(-)

Approvals:
  Faidon Liambotis: Verified; Looks good to me, approved



diff --git a/manifests/memcached.pp b/manifests/memcached.pp
index 6863373..a9e1fb6 100644
--- a/manifests/memcached.pp
+++ b/manifests/memcached.pp
@@ -24,37 +24,44 @@
                ensure => running;
        }
 
-       class monitoring {
-               # Nagios
-               monitor_service { "memcached": description => "Memcached", 
check_command => "check_tcp!$memcached_port" }
-
-               # Ganglia
-               package { python-memcache:
-                       ensure => absent;
+       # prefer a direct check if memcached is not running on localhost
+       # no point in running this over nrpe for e.g. our memcached cluster
+       if ($memcached_ip == '127.0.0.1') {
+               nrpe::monitor_service { 'memcached':
+                       description   => 'Memcached',
+                       nrpe_command  => "/usr/lib/nagios/plugins/check_tcp -H 
$memcached_ip -p $memcached_port",
                }
-
-               # on lucid, /usr/lib/ganglia/python_modules file comes from the 
ganglia.pp stuff, which
-               # means there's actually a hidden dependency on ganglia.pp for
-               # the memcache class to work.
-               file {
-                       '/usr/lib/ganglia/python_modules/memcached.py':
-                               owner   => 'root',
-                               group   => 'root',
-                               mode    => '0444',
-                               source  => 
'puppet:///files/ganglia/plugins/memcached.py',
-                               require => 
File['/usr/lib/ganglia/python_modules'],
-                               notify  => Service['gmond'];
-                       '/etc/ganglia/conf.d/memcached.pyconf':
-                               owner   => 'root',
-                               group   => 'root',
-                               mode    => '0444',
-                               source  => 
'puppet:///files/ganglia/plugins/memcached.pyconf',
-                               require => 
File['/usr/lib/ganglia/python_modules/memcached.py'],
-                               notify  => Service['gmond'];
+       } else {
+               monitor_service { 'memcached':
+                       description   => 'Memcached',
+                       check_command => "check_tcp!$memcached_port",
                }
        }
 
-       include memcached::monitoring
+       # Ganglia
+       package { 'python-memcache':
+               ensure => absent,
+       }
+
+       # on lucid, /usr/lib/ganglia/python_modules file comes from the 
ganglia.pp stuff, which
+       # means there's actually a hidden dependency on ganglia.pp for
+       # the memcache class to work.
+       file { '/usr/lib/ganglia/python_modules/memcached.py':
+               owner   => 'root',
+               group   => 'root',
+               mode    => '0444',
+               source  => 'puppet:///files/ganglia/plugins/memcached.py',
+               require => File['/usr/lib/ganglia/python_modules'],
+               notify  => Service['gmond'],
+       }
+       file { '/etc/ganglia/conf.d/memcached.pyconf':
+               owner   => 'root',
+               group   => 'root',
+               mode    => '0444',
+               source  => 'puppet:///files/ganglia/plugins/memcached.pyconf',
+               require => File['/usr/lib/ganglia/python_modules/memcached.py'],
+               notify  => Service['gmond'],
+       }
 }
 
 class memcached::config ($memcached_size, $memcached_port, $memcached_ip, 
$memcached_options) {
diff --git a/manifests/misc/blogs.pp b/manifests/misc/blogs.pp
index 567cd7c..770484a 100644
--- a/manifests/misc/blogs.pp
+++ b/manifests/misc/blogs.pp
@@ -30,6 +30,7 @@
             source => 'puppet:///files/apache/blog_ports.conf';
     }
 
+    include nrpe
     class { 'memcached': memcached_ip => '127.0.0.1' }
     install_certificate{ 'star.wikimedia.org': }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I45f5f9240f74b608cffbae2762987b8e1f88ccbb
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>

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

Reply via email to