lib/riemann/tools/zpool.rb in riemann-tools-1.3.0 vs lib/riemann/tools/zpool.rb in riemann-tools-1.4.0
- old
+ new
@@ -10,18 +10,29 @@
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',
- message: output,
- state: status.success? ? 'ok' : 'critical',
+ description: output,
+ state: state,
)
rescue Errno::ENOENT => e
report(
service: 'zpool health',
- message: e.message,
+ description: e.message,
state: 'critical',
)
end
end
end