Sha256: 871fd35e947bfbc6e11f9d27302999945bb7cfd891ff26e28e8230be9d87d529

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

require "thor"
require "zabbix-ruby-client"

class ZabbixRubyClient

  class Cli < Thor
    include Thor::Actions

    def self.source_root
      File.expand_path("../../../templates", __FILE__)
    end

    default_task :help
    class_option :configfile,
      aliases: "-c",
      banner: "PATH",
      default: File.expand_path("config.yml", Dir.pwd),
      desc: "Path to the configuration file to use"
    class_option :taskfile,
      aliases: "-t",
      banner: "PATH",
      default: File.expand_path("minutely.yml", Dir.pwd),
      desc: "Path to the list of plugins to execute"

    desc "init", "Initialize a new zabbix ruby client"
    def init(name = "zabbix-ruby-client")
      directory "client", name
    end

    desc "show", "Displays in console what are the collected data ready to be sent"
    def show
      begin
        Bundler.require
      rescue Bundler::GemfileNotFound
        say "No Gemfile found", :red
        abort
      end
      zrc = ZabbixRubyClient.new(options[:configfile],options[:taskfile])
      zrc.collect
      zrc.show
    end

    desc "upload", "Collects and sends data to the zabbix server"
    def upload
      zrc = ZabbixRubyClient.new(options[:configfile],options[:taskfile])
      zrc.collect
      zrc.upload
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.15 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.14 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.13 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.12 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.11 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.10 lib/zabbix-ruby-client/cli.rb
zabbix-ruby-client-0.0.9 lib/zabbix-ruby-client/cli.rb