Sha256: f4b0273de88a3044d700fd086b2acbcd9af4ffdc87d00b477efd780c31f2a323
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: false # # Checks Redis Slave Replication require 'sensu-plugin/check/cli' require 'redis' require_relative '../lib/redis_client_options' class RedisSlaveCheck < Sensu::Plugin::Check::CLI include RedisClientOptions def run redis = Redis.new(default_redis_options) if redis.info.fetch('role') == 'master' ok 'This redis server is master' elsif redis.info.fetch('master_link_status') == 'up' ok 'The redis master links status is up!' else msg = '' msg += "The redis master link status to: #{redis.info.fetch('master_host')} is down!" msg += " It has been down for #{redis.info.fetch('master_link_down_since_seconds')}." critical msg end rescue KeyError critical "Redis server on #{redis_endpoint} is not master and does not have master_link_status" rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-redis-5.0.0 | bin/check-redis-slave-status.rb |
sensu-plugins-redis-4.1.0 | bin/check-redis-slave-status.rb |
sensu-plugins-redis-4.0.0 | bin/check-redis-slave-status.rb |