Sha256: cc454d2be71216740f98c159e89f15d30b25330794e5ec7c433d1c07997f068c
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
#! /usr/bin/env ruby # # check-chronos # # DESCRIPTION: # This plugin checks that Chronos can query the existing job graph. # # OUTPUT: # plain text # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: sensu-plugin # gem: rest-client # # USAGE: # # # NOTES: # # LICENSE: # Copyright 2015, Tom Stockton (tom@stocktons.org.uk) # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' require 'rest-client' class ChronosNodeStatus < Sensu::Plugin::Check::CLI option :server, description: 'Chronos hosts, comma separated', short: '-s SERVER', long: '--server SERVER', default: 'localhost' option :port, description: 'Chronos port', short: '-p PORT', long: '--port PORT', default: '80' option :timeout, description: 'timeout in seconds', short: '-t TIMEOUT', long: '--timeout TIMEOUT', proc: proc(&:to_i), default: 5 def run servers = config[:server] failures = [] servers.split(',').each do |server| begin r = RestClient::Resource.new("http://#{server}:#{config[:port]}/scheduler/jobs", timeout: config[:timeout]).get if r.code != 200 failures << "Chronos on #{server} is not responding" end rescue Errno::ECONNREFUSED, RestClient::ResourceNotFound, SocketError failures << "Chronos on #{server} is not responding" rescue RestClient::RequestTimeout failures << "Chronos on #{server} connection timed out" end end if failures.empty? ok "Chronos is running on #{servers}" else critical failures.join("\n") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-mesos-0.1.1 | bin/check-chronos.rb |
sensu-plugins-mesos-0.1.0 | bin/check-chronos.rb |