Module: SensuPluginsGraphite::GraphiteProxy::Options

Defined in:
lib/sensu-plugins-graphite/graphite_proxy/options.rb

Class Method Summary collapse

Class Method Details

.add_default_options(base) ⇒ Object



8
9
10
11
12
# File 'lib/sensu-plugins-graphite/graphite_proxy/options.rb', line 8

def self.add_default_options(base)
  default_options.each do |name, vals|
    base.send(:option, name, vals)
  end
end

.default_optionsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/sensu-plugins-graphite/graphite_proxy/options.rb', line 14

def self.default_options
  {
    target: {
      description: 'Graphite data target',
      short: '-t TARGET',
      long: '--target TARGET',
      required: true
    },

    server: {
      description: 'Server host and port',
      short: '-s SERVER:PORT',
      long: '--server SERVER:PORT',
      required: true
    },

    username: {
      description: 'Username for basic HTTP authentication',
      short: '-u USERNAME',
      long: '--user USERNAME',
      required: false
    },

    password: {
      description: 'User password for basic HTTP authentication',
      short: '-p PASSWORD',
      long: '--pass PASSWORD',
      required: false
    },

    passfile: {
      description: 'Password file path for basic HTTP authentication',
      short: '-P PASSWORDFILE',
      long: '--passfile PASSWORDFILE',
      required: false
    },

    no_ssl_verify: {
      description: 'Do not verify SSL certs',
      short: '-v',
      long: '--nosslverify'
    },

    help: {
      description: 'Show this message',
      short: '-h',
      long: '--help'
    },

    auth: {
      description: 'Add an auth token to the HTTP request, in the form of "Name: Value",
                                       e.g. --auth yourapitokenvaluegoeshere',
      short: '-A TOKEN',
      long: '--auth TOKEN'
    },

    name: {
      description: 'Name used in responses',
      short: '-n NAME',
      long: '--name NAME',
      default: 'graphite check'
    },

    hostname_sub: {
      description: 'Character used to replace periods (.) in hostname (default: _)',
      long: '--host-sub CHARACTER'
    },

    from: {
      description: 'Get samples starting from FROM (default: -10mins)',
      short: '-f FROM',
      long: '--from FROM',
      default: '-10mins'
    },

    until: {
      description: 'Get samples ending at UNTIL (default: now)',
      short: '-l UNTIL',
      long: '--until UNTIL',
      default: 'now'
    },

    warning: {
      description: 'Generate warning if number of hosts is below received value',
      short: '-w VALUE',
      long: '--warn VALUE',
      proc: proc(&:to_f)
    },

    critical: {
      description: 'Generate critical if number of hosts is below received value',
      short: '-c VALUE',
      long: '--critical VALUE',
      proc: proc(&:to_f)
    },

    below: {
      description: 'Alert if number of hosts is below specified thresholds',
      short: '-b',
      long: '--below'
    }
  }
end

.included(base) ⇒ Object



4
5
6
# File 'lib/sensu-plugins-graphite/graphite_proxy/options.rb', line 4

def self.included(base)
  add_default_options(base)
end