
gerrit at wikimedia
Aug 11, 2013, 10:13 PM
Post #2 of 2
(9 views)
Permalink
|
|
[MediaWiki-commits] [Gerrit] ceph: add ceph::nagios class - change (operations/puppet)
[In reply to]
|
|
Faidon has submitted this change and it was merged. Change subject: ceph: add ceph::nagios class ...................................................................... ceph: add ceph::nagios class Add a ceph client key, a nagios check, an nrpe config and a monitor, all via the ceph::nagios class. The nrpe bits aren't pretty, but these hopefully will soon be worked on. Change-Id: I4c7ee625f88aa27e7e2d703008f61464a72fe3fa --- M manifests/role/ceph.pp A modules/ceph/manifests/nagios.pp A modules/ceph/templates/check_ceph_health.erb 3 files changed, 98 insertions(+), 1 deletion(-) Approvals: Faidon: Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/role/ceph.pp b/manifests/role/ceph.pp index 09fdbd4..47ca609 100644 --- a/manifests/role/ceph.pp +++ b/manifests/role/ceph.pp @@ -57,7 +57,7 @@ monitor_secret => $passwords::ceph::eqiad::monitor_secret, } - # FIXME: need a Ceph nagios check + include ceph::nagios } class osd inherits role::ceph::eqiad { diff --git a/modules/ceph/manifests/nagios.pp b/modules/ceph/manifests/nagios.pp new file mode 100644 index 0000000..0e7d6c4 --- /dev/null +++ b/modules/ceph/manifests/nagios.pp @@ -0,0 +1,83 @@ +# Class: ceph::nagios +# +# This class sets up an NRPE service check for Ceph healthiness. +# +# Parameters: +# +# Actions: +# Creates a separate Ceph admin key with minimum permissions +# Installs a Nagios plugin to /usr/lib/nagios/plugins +# Sets up the NRPE configuration for the check +# Exports a Nagios monitor service check +# +# Requires: +# Class[ceph] +# Package['nagios-nrpe-server'] +# Package['nagios-plugins-basic'] +# Define['nrpe::monitor_service'] +# +# Sample Usage: +# include ceph::nagios + +class ceph::nagios( + $ensure='present', + $cluster='ceph', + $entity='nagios', +) { + Class['ceph'] -> Class['ceph::nagios'] + + $keyring = "/var/lib/ceph/nagios/${cluster}.keyring" + + case $ensure { + present: { + $ensure_dir = 'directory' + File['/var/lib/ceph/nagios'] -> Ceph::Key[$entity] + } + absent: { + $ensure_dir = 'absent' + # broken due to autorequire bug, + # http://projects.puppetlabs.com/issues/14518 + #Ceph::Key[$entity] -> File['/var/lib/ceph/nagios'] + } + default: { + fail("${name} ensure parameter must be absent or present") + } + } + + file { '/var/lib/ceph/nagios': + ensure => $ensure_dir, + owner => 'root', + group => 'root', + mode => '0644', + backup => false, + force => true, + } + + ceph::key { $entity: + ensure => $ensure, + keyring => $keyring, + caps => 'mon "allow r"', + owner => 'root', + group => 'nagios', + mode => '0440', + require => Package['nagios-nrpe-server'], # for the nagios group + } + + $nagios_plugin_path = '/usr/lib/nagios/plugins/check_ceph_health' + + file { $nagios_plugin_path: + ensure => $ensure, + owner => 'root', + group => 'root', + mode => '0555', + content => template('ceph/check_ceph_health.erb'), + # nagios-plugins-basic for the dir /usr/lib/nagios/plugins, ewww. + require => Package['nagios-plugins-basic'], + } + + nrpe::monitor_service { 'ceph_health': + ensure => $ensure, + description => 'Ceph', + nrpe_command => $nagios_plugin_path, + } +} diff --git a/modules/ceph/templates/check_ceph_health.erb b/modules/ceph/templates/check_ceph_health.erb new file mode 100755 index 0000000..3eaa8f3 --- /dev/null +++ b/modules/ceph/templates/check_ceph_health.erb @@ -0,0 +1,14 @@ +#!/bin/sh + +CLUSTER="<%= @cluster %>" +ENTITY="<%= @entity %>" +KEYRING="<%= @keyring %>" + +HEALTH=$(ceph --cluster "$CLUSTER" --id "$ENTITY" --keyring "$KEYRING" health) + +echo "Ceph $HEALTH" +if echo $HEALTH | grep -q OK; then + exit 0 +else + exit 2 +fi -- To view, visit https://gerrit.wikimedia.org/r/78792 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4c7ee625f88aa27e7e2d703008f61464a72fe3fa Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Faidon <faidon [at] wikimedia> Gerrit-Reviewer: Faidon <faidon [at] wikimedia> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits [at] lists https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
|