Sha256: 0ced49ae4ba316e08a704664c3b798fff4b99400ed7c9e36616850c8766efd49
Contents?: true
Size: 724 Bytes
Versions: 9
Compression:
Stored size: 724 Bytes
Contents
#! /usr/bin/env ruby $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib')) require 'json' require 'panoptimon-collector-smtp' ARGV[0] or raise "arguments required" conf = JSON.parse(ARGV[0], {symbolize_names: true}) defaults = { port: conf[:default_port] || 25, timeout: conf[:default_timeout] || 3, } raise "must have 'hosts' value in config" unless conf[:hosts] setup = conf[:hosts].map {|h| o = defaults.merge(h.is_a?(Hash) ? h : {host: h}) o[:host] or raise "must have 'host' attribute in entry #{o.inspect}" o[:name] ||= o[:host] o } output = Hash[setup.map {|o| warn "o: #{o.inspect}" [o[:name], Panoptimon::Collector::SMTP.new(o).collect] }] puts JSON.generate(output)
Version data entries
9 entries across 9 versions & 1 rubygems