Skip to content

Instantly share code, notes, and snippets.

@acondrat
Created February 7, 2019 19:07
Show Gist options
  • Save acondrat/bc244ae82b8d346baca895ee08633723 to your computer and use it in GitHub Desktop.
Save acondrat/bc244ae82b8d346baca895ee08633723 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'open-uri'
OK = 'OK'.freeze
if ARGV.length != 1
raise 'Please provide the service address as a single argument'
end
exit_code = 0
URI.open(ARGV.first) do |f|
f.each_line do |line|
service = line.strip.split(':')
next if service.empty?
service_name = service[0].strip
service_status = service[1].strip
if service_status != OK
puts "The service #{service_name} is #{service_status}."
exit_code = 1
end
end
end
exit exit_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment