Created
July 9, 2012 16:32
-
-
Save kevinkarwaski/3077473 to your computer and use it in GitHub Desktop.
Scout Management Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'scout_api' | |
#************************************* | |
# Playing around with the Scout API... | |
#************************************* | |
#Create the connection object. | |
scout = Scout::Account.new(ENV['SCOUT_ACCOUNT'], ENV['SCOUT_USER'], ENV['SCOUT_PASSWORD']) | |
# Get an array of all servers as hashes. | |
servers = Scout::Server.all | |
count = 0 | |
# Find all the servers where checkup_status is "Failure". | |
0.upto(servers.length - 1) do |i| | |
if servers[i][:checkup_status] == "Failure" | |
puts "#{servers[i][:name]}\n" | |
puts "#{servers[i][:hostname]}\n" | |
puts "#{servers[i][:checkup_status]}\n" | |
puts "#{servers[i][:last_checkin]}\n" | |
count += 1 | |
puts "#{count}\n" | |
end | |
end | |
puts "Servers with Checkup failure: #{count}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment