bin/check-ceph.rb in sensu-plugins-ceph-0.0.3 vs bin/check-ceph.rb in sensu-plugins-ceph-0.0.4
- old
+ new
@@ -135,20 +135,28 @@
result
end
end
def run # rubocop:disable all
- result = run_cmd('ceph health')
- unless result.start_with?('HEALTH_OK')
- result = strip_warns(result) if config[:ignore_flags]
- end
+ result = check_ceph_health
ok result if result.start_with?('HEALTH_OK')
- result = run_cmd('ceph health detail') if config[:show_detail]
+ result = strip_warns(result) if config[:ignore_flags]
result += run_cmd('ceph osd tree') if config[:osd_tree]
+
if result.start_with?('HEALTH_WARN')
warning result
else
critical result
+ end
+ end
+
+ private
+
+ def check_ceph_health
+ if config[:show_detail]
+ run_cmd('ceph health detail')
+ else
+ run_cmd('ceph health')
end
end
end