#!/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| print "==> #{key} " cmd = "host #{value['ip']}| grep #{value['hostname']}| wc -l" counter = %x[#{cmd}].to_i if counter.zero? puts "(ERROR: IP <=> hostname)" puts " hostname = #{value['hostname']}" puts " ip = #{value['ip']}" else puts "(Ok)" end end