Sha256: cf5ff13084c5c69d0e33b2521c8fa6e8d09e89ac6a87faaf789f4b96dd9f3d4d

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

#!/usr/bin/env ruby

## contrib via https://github.com/ytti/oxidized/issues/67

require 'open-uri'
require 'json'

critical = false
pending = false
critical_nodes = []
pending_nodes = []

json = JSON.parse(open("http://localhost:8888/nodes.json"))
json.each do |node|
  if not node['last'].nil?
    if node['last']['status'] != 'success'
      critical_nodes << node['name']
      critical = true
    end
  else
    pending_nodes << node['name']
    pending = true
  end
end

if critical
  puts '[CRIT] Unable to backup: ' + critical_nodes.join(',')
  exit 2
elsif pending
  puts '[WARN] Pending backup: ' + pending_nodes.join(',')
  exit 1
else
  puts '[OK] Backup of all nodes completed successfully.'
  exit 0
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oxidized-0.26.3 extra/nagios_check_failing_nodes.rb
oxidized-0.26.2 extra/nagios_check_failing_nodes.rb
oxidized-0.26.1 extra/nagios_check_failing_nodes.rb
oxidized-0.26.0 extra/nagios_check_failing_nodes.rb