Sha256: 751906d3a908a7d3e57b183209786f79e927e653d79c86836418f37a39350760

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

# frozen_string_literal: true

require 'riemann/tools'
require 'riemann/tools/mdstat_parser.tab'

module Riemann
  module Tools
    class Md
      include Riemann::Tools

      def mdstat_parser
        @mdstat_parser ||= MdstatParser.new
      end

      def tick
        status = File.read('/proc/mdstat')
        res = mdstat_parser.parse(status)

        state = res.values.all? { |value| value =~ /\AU+\z/ } ? 'ok' : 'critical'

        report(
          service: 'mdstat',
          description: status,
          state: state,
        )
      rescue Errno::ENOENT => e
        report(
          service: 'mdstat',
          description: e.message,
          state: 'critical',
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riemann-tools-1.4.0 lib/riemann/tools/md.rb