lib/zabbix-ruby-client.rb in zabbix-ruby-client-0.0.8 vs lib/zabbix-ruby-client.rb in zabbix-ruby-client-0.0.9

- old
+ new

@@ -3,13 +3,18 @@ require "zabbix-ruby-client/plugins" require "yaml" class ZabbixRubyClient - def initialize(config_file) + def initialize(config_file,task_file) begin @config ||= YAML::load_file(config_file) + if File.exists? task_file + @tasks ||= YAML::load_file(task_file) + else + @tasks = @config["plugins"] + end rescue Exception => e puts "Configuration file cannot be read" puts e.message return end @@ -53,10 +58,10 @@ end end end def collect - @config['plugins'].each do |plugin| + @tasks.each do |plugin| run_plugin(plugin['name'], plugin['args']) end end def show