educatic-info/test/services.rb

22 lines
569 B
Ruby
Executable File

#!/usr/bin/env ruby
require "yaml"
filename = File.join(File.dirname(__FILE__), "services.yaml")
settings = YAML.load(File.read(filename))
services = settings["services"]
services.each_pair do |key, value|
puts "==> #{key} "
cmd = "host #{value['ip']}| grep #{value['hostname']}| wc -l"
counter = %x[#{cmd}].to_i
if counter.zero?
puts " Check this:"
puts " * hostname = #{value['hostname']}"
puts " * ip = #{value['ip']}"
end
unless value['todo'].nil?
puts " TODO:"
puts " * #{value['todo'].join(", ")}"
end
end