Giuseppe Lavagetto has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/344624 )
Change subject: redis::monitoring: convert ores to nrpe, cleanup ...................................................................... redis::monitoring: convert ores to nrpe, cleanup Change-Id: Ic33a648afd47606f5272f9ceb7b25c0d68c27181 --- M modules/icinga/manifests/plugins.pp D modules/nagios_common/files/check_commands/check_redis.cfg D modules/nagios_common/manifests/check/redis.pp M modules/ores/manifests/redis.pp R modules/redis/files/check_redis D modules/redis/manifests/monitoring/instance.pp M modules/redis/manifests/monitoring/nrpe.pp 7 files changed, 3 insertions(+), 111 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/24/344624/1 diff --git a/modules/icinga/manifests/plugins.pp b/modules/icinga/manifests/plugins.pp index f6dd97e..05a755b 100644 --- a/modules/icinga/manifests/plugins.pp +++ b/modules/icinga/manifests/plugins.pp @@ -105,10 +105,7 @@ mode => '0755', } - class { [ - '::nagios_common::commands', - '::nagios_common::check::redis', - ] : + class { '::nagios_common::commands': } include ::passwords::nagios::mysql diff --git a/modules/nagios_common/files/check_commands/check_redis.cfg b/modules/nagios_common/files/check_commands/check_redis.cfg deleted file mode 100644 index b475df4..0000000 --- a/modules/nagios_common/files/check_commands/check_redis.cfg +++ /dev/null @@ -1,9 +0,0 @@ -define command{ - command_name check_redis_replication - command_line $USER1$/check_redis -H $HOSTADDRESS$ -p $ARG1$ -r $ARG2$,$ARG3$ -C $ARG4$ -} - -define command{ - command_name check_redis - command_line $USER1$/check_redis -H $HOSTADDRESS$ -p $ARG1$ -C $ARG2$ -} diff --git a/modules/nagios_common/manifests/check/redis.pp b/modules/nagios_common/manifests/check/redis.pp deleted file mode 100644 index 623125a..0000000 --- a/modules/nagios_common/manifests/check/redis.pp +++ /dev/null @@ -1,41 +0,0 @@ -# == Class nagios_common::check::redis -# -# Installs the check_redis command and sets up -# the corresponding configuration - -class nagios_common::check::redis( - $config_dir = '/etc/icinga', - $owner = 'icinga', - $group = 'icinga' - ) { - - require_package('libredis-perl') - - require ::passwords::redis - - file { '/etc/icinga/.redis_secret': - ensure => present, - owner => $owner, - group => $group, - mode => '0400', - content => $::passwords::redis::main_password, - } - file { '/etc/icinga/.ores_redis_secret': - ensure => present, - owner => $owner, - group => $group, - mode => '0400', - content => $::passwords::redis::ores_password, - } - - ::nagios_common::check_command { 'check_redis': - require => [ - File["${config_dir}/commands"], - Class['packages::libredis_perl'] - ], - config_dir => $config_dir, - owner => $owner, - group => $group, - - } -} diff --git a/modules/ores/manifests/redis.pp b/modules/ores/manifests/redis.pp index c28f8da..64e61a3 100644 --- a/modules/ores/manifests/redis.pp +++ b/modules/ores/manifests/redis.pp @@ -64,11 +64,7 @@ settings => $common_settings, map => $instance_settings_real, } - redis::monitoring::instance { $instances: - settings => $common_settings, - map => $instance_settings_real, - cred_file => '/etc/icinga/.ores_redis_secret', - } + redis::monitoring::nrpe_instance{ $instances: } $uris = apply_format("localhost:%s/${password}", $instances) diamond::collector { 'Redis': diff --git a/modules/nagios_common/files/check_commands/check_redis b/modules/redis/files/check_redis similarity index 100% rename from modules/nagios_common/files/check_commands/check_redis rename to modules/redis/files/check_redis diff --git a/modules/redis/manifests/monitoring/instance.pp b/modules/redis/manifests/monitoring/instance.pp deleted file mode 100644 index 801b815..0000000 --- a/modules/redis/manifests/monitoring/instance.pp +++ /dev/null @@ -1,50 +0,0 @@ -# === define redis::monitoring::instance -# -# Define used for monitoring a redis instance -# -# Accepts, for ease of use, the same parameters as the redis::instance define -# - -define redis::monitoring::instance( - $ensure = present, - $settings = {}, - $map = {}, - $lag_warning = 60, - $lag_critical = 600, - $cred_file = '/etc/icinga/.redis_secret', - ) { - - validate_ensure($ensure) - validate_hash($settings) - validate_hash($map) - - if $title =~ /^[1-9]\d*/ { - # Listen on TCP port - $instance_name = "tcp_${title}" - $port = $title - } else { - fail('redis::monitoring::instance title must be a TCP port.') - } - - # Check if slaveof in settings, and not empty - if has_key($settings, 'slaveof') { - $slaveof = $settings['slaveof'] - } elsif (has_key($map, $port) and has_key($map[$port], 'slaveof')) { - $slaveof = $map[$port]['slaveof'] - } else { - $slaveof = undef - } - - if $slaveof { - monitoring::service{ "redis.${instance_name}": - description => "Redis replication status ${instance_name}", - check_command => "check_redis_replication!${port}!${lag_warning}!${lag_critical}!${cred_file}", - retry_interval => 2, - } - } else { - monitoring::service{ "redis.${instance_name}": - description => "Redis status ${instance_name}", - check_command => "check_redis!${port}!${cred_file}", - } - } -} diff --git a/modules/redis/manifests/monitoring/nrpe.pp b/modules/redis/manifests/monitoring/nrpe.pp index 17bd126..49a6cc4 100644 --- a/modules/redis/manifests/monitoring/nrpe.pp +++ b/modules/redis/manifests/monitoring/nrpe.pp @@ -1,10 +1,9 @@ class redis::monitoring::nrpe { require_package('libredis-perl') - # TODO: move the source here once we're done with the migration file { '/usr/lib/nagios/plugins/check_redis': ensure => present, - source => 'puppet:///modules/nagios_common/check_commands/check_redis', + source => 'puppet:///modules/redis/check_redis', mode => '0755', } -- To view, visit https://gerrit.wikimedia.org/r/344624 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic33a648afd47606f5272f9ceb7b25c0d68c27181 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits