Sha256: c191f163a9d6075a39179f9ff0727af4cebc95c89040c8ee85cb09ce0560d0ff

Contents?: true

Size: 862 Bytes

Versions: 12

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

require 'open3'

require 'riemann/tools'

module Riemann
  module Tools
    class Zpool
      include Riemann::Tools

      def tick
        output, status = Open3.capture2e('zpool status -x')

        state = if status.success?
                  case output
                  when "all pools are healthy\n" then 'ok'
                  when /state: (DEGRADED|FAULTED)/ then 'critical'
                  else
                    'warning'
                  end
                else
                  'critical'
                end

        report(
          service: 'zpool health',
          description: output,
          state: state,
        )
      rescue Errno::ENOENT => e
        report(
          service: 'zpool health',
          description: e.message,
          state: 'critical',
        )
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
riemann-tools-1.11.0 lib/riemann/tools/zpool.rb
riemann-tools-1.10.0 lib/riemann/tools/zpool.rb
riemann-tools-1.9.1 lib/riemann/tools/zpool.rb
riemann-tools-1.9.0 lib/riemann/tools/zpool.rb
riemann-tools-1.8.2 lib/riemann/tools/zpool.rb
riemann-tools-1.8.1 lib/riemann/tools/zpool.rb
riemann-tools-1.8.0 lib/riemann/tools/zpool.rb
riemann-tools-1.7.1 lib/riemann/tools/zpool.rb
riemann-tools-1.7.0 lib/riemann/tools/zpool.rb
riemann-tools-1.6.0 lib/riemann/tools/zpool.rb
riemann-tools-1.5.0 lib/riemann/tools/zpool.rb
riemann-tools-1.4.0 lib/riemann/tools/zpool.rb