cloudstack-nagios 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dfef0d15a505ec785f1a81b8de68d7656c5f108
4
- data.tar.gz: 8886ff661b1581c56f67a7d08f349378e3495d24
3
+ metadata.gz: f4cb1a12d66fceb783066e28b57ca209902d70f1
4
+ data.tar.gz: 8c939b37609f6feddd829ea35815dd58061e18da
5
5
  SHA512:
6
- metadata.gz: 4fbea4827a0dede42b2cadf9c5aa2bb6c9c07d25d50ca07c8bc8efb64d8f385b350e6157d1f866ed5d182086ef146327c5621d992d8e422479d1c3c7c66e44a6
7
- data.tar.gz: af59b95251ba561f0e96b4397952cd8cf2b252e9d28b54548c5e940d2f734607b591b863f12038fe19bffea4f47afefbc50828c97bc74c9a569336752630ccdf
6
+ metadata.gz: c8e98357a21ac5aff4b643103a9832156d6493fc81928d6f426a2de283044c6552284b422ff8f02ac7104b5b2aa172c148714c3df392b9e3d6f84cfb75103634
7
+ data.tar.gz: e376a8682220887cb5c9eb59d053a8ea3e9eb4f0f9ced4e1efeede31c33e23bb135d5c63179e9f8e43e091d36eecd7682f7d7c2756741cca79235e33c704e191
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack-nagios (0.6.1)
4
+ cloudstack-nagios (0.6.2)
5
5
  cloudstack_client (~> 0.4, >= 0.4.4)
6
6
  erubis (~> 2.7.0)
7
7
  highline (~> 1.6.20)
data/README.md CHANGED
@@ -27,7 +27,7 @@ $ gem install cloudstack-nagios
27
27
  Create the initial configuration:
28
28
 
29
29
  ```bash
30
- $ cs setup
30
+ $ cs-nagios setup
31
31
  ```
32
32
 
33
33
  cloudstack-nagios expects to find a configuartion file with the API URL and your CloudStack credentials in your home directory named .cloudstack-cli.yml. If the file is located elsewhere you can specify the loaction using the --config option.
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["nik.wolfgramm@gmail.com"]
11
11
  gem.description = %q{cloudstack-nagios generates nagios configuration and checks for monitoring CloudStack with nagios.}
12
12
  gem.summary = %q{cloudstack-nagios CloudStack monitoring tools for nagios}
13
- gem.homepage = "https://bitbucket.org/swisstxt/cloudstack-nagios"
13
+ gem.homepage = "https://github.com/swisstxt/cloudstack-nagios"
14
14
  gem.license = 'MIT'
15
15
 
16
16
  gem.required_ruby_version = '>= 1.9.3'
@@ -42,9 +42,15 @@ class Check < CloudstackNagios::Base
42
42
  desc "capacity", "check capacity of storage_pool"
43
43
  option :pool_name, required: true
44
44
  option :zone
45
+ option :over_provisioning, type: :numeric, default: 1.0
45
46
  def storage_pool
46
47
  pool = client.list_storage_pools(name: options[:pool_name], zone: options[:zone]).first
47
- data = check_data(pool['disksizetotal'].to_f, pool['disksizeused'].to_f, options[:warning], options[:critical])
48
+ data = check_data(
49
+ pool['disksizetotal'] * options[:over_provisioning],
50
+ pool['disksizeallocated'].to_f,
51
+ options[:warning],
52
+ options[:critical]
53
+ )
48
54
  puts "storage_pool #{options[:pool_name]} #{RETURN_CODES[data[0]]} - usage = #{data[1]}% | usage=#{pool['disksizeused']}"
49
55
  exit data[0]
50
56
  end
@@ -1,5 +1,7 @@
1
1
  class NagiosConfig < CloudstackNagios::Base
2
2
 
3
+ class_option :bin_path, desc: "absolute path to the nagios-cloudstack binary"
4
+
3
5
  desc "router_hosts", "generate nagios hosts configuration for virtual routers"
4
6
  option :template,
5
7
  desc: "path of ERB template to use",
@@ -48,6 +50,7 @@ class NagiosConfig < CloudstackNagios::Base
48
50
  desc: "path of ERB template to use",
49
51
  default: File.join(File.dirname(__FILE__), '..', 'templates', 'cloudstack_storage_pool_services.cfg.erb'),
50
52
  aliases: '-t'
53
+ option :over_provisioning, type: :numeric, default: 1.0
51
54
  def storage_pool_services
52
55
  service_template = load_template(options[:template])
53
56
  storage_pools = client.list_storage_pools.select do |pool|
@@ -55,6 +58,7 @@ class NagiosConfig < CloudstackNagios::Base
55
58
  end
56
59
  puts service_template.result(
57
60
  storage_pools: storage_pools,
61
+ over_provisioning: options[:over_provisioning],
58
62
  bin_path: bin_path,
59
63
  config_file: options[:config],
60
64
  date: date_string
@@ -82,7 +86,11 @@ class NagiosConfig < CloudstackNagios::Base
82
86
  end
83
87
 
84
88
  def bin_path
85
- File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'bin'))
89
+ unless options[:bin_path]
90
+ return ''
91
+ else
92
+ return options[:bin_path].end_with?('/') ? options[:bin_path] : options[:bin_path] + "/"
93
+ end
86
94
  end
87
95
  end
88
96
 
@@ -36,7 +36,6 @@ module CloudstackNagios
36
36
  code = 1
37
37
  else
38
38
  code = 2
39
- usage_percent = 0
40
39
  end
41
40
  [code, usage_percent.round(0)]
42
41
  end
@@ -15,7 +15,7 @@
15
15
  <% capacity_types.each do |cap_type, cap_values| -%>
16
16
  define command {
17
17
  command_name cs-nagios_check-capacity_<%= cap_values[:method_name] %>
18
- command_line <%= bin_path -%>/cs-nagios check capacity <%= cap_values[:method_name] %> -w $ARG1$ -c $ARG2$ --config <%= config_file %>
18
+ command_line <%= bin_path -%>cs-nagios check capacity <%= cap_values[:method_name] %> -w $ARG1$ -c $ARG2$ --config <%= config_file %>
19
19
  register 1
20
20
  }
21
21
 
@@ -14,25 +14,25 @@
14
14
 
15
15
  define command {
16
16
  command_name cs-nagios_check-memory
17
- command_line <%= bin_path -%>/cs-nagios check router memory -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
17
+ command_line <%= bin_path -%>cs-nagios check router memory -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
18
18
  register 1
19
19
  }
20
20
 
21
21
  define command {
22
22
  command_name cs-nagios_check-cpu
23
- command_line <%= bin_path -%>/cs-nagios check router cpu -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
23
+ command_line <%= bin_path -%>cs-nagios check router cpu -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
24
24
  register 1
25
25
  }
26
26
 
27
27
  define command {
28
28
  command_name cs-nagios_check-network
29
- command_line <%= bin_path -%>/cs-nagios check router network -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
29
+ command_line <%= bin_path -%>cs-nagios check router network -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
30
30
  register 1
31
31
  }
32
32
 
33
33
  define command {
34
34
  command_name cs-nagios_check-rootfsrw
35
- command_line <%= bin_path -%>/cs-nagios check router rootfs_rw -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
35
+ command_line <%= bin_path -%>cs-nagios check router rootfs_rw -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ --config <%= config_file %>
36
36
  register 1
37
37
  }
38
38
 
@@ -15,7 +15,7 @@
15
15
  <% storage_pools.each do |storage_pool| -%>
16
16
  define command {
17
17
  command_name cs-nagios_check-storage_pool
18
- command_line <%= bin_path -%>/cs-nagios check storage_pool --pool_name <%= storage_pool['name'] -%> --zone <%= storage_pool['zonename'] -%> -w $ARG1$ -c $ARG2$ --config <%= config_file %>
18
+ command_line <%= bin_path -%>cs-nagios check storage_pool --pool_name <%= storage_pool['name'] -%><%= " --over_provisioning #{over_provisioning}" if over_provisioning != 1.0 && storage_pool['type'] == 'NetworkFilesystem' -%> --zone <%= storage_pool['zonename'] -%> -w $ARG1$ -c $ARG2$ --config <%= config_file %>
19
19
  register 1
20
20
  }
21
21
 
@@ -1,3 +1,3 @@
1
1
  module CloudstackNagios
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -147,7 +147,7 @@ files:
147
147
  - lib/cloudstack-nagios/templates/cloudstack_storage_pool_services.cfg.erb
148
148
  - lib/cloudstack-nagios/version.rb
149
149
  - lib/cloudstack_nagios.rb
150
- homepage: https://bitbucket.org/swisstxt/cloudstack-nagios
150
+ homepage: https://github.com/swisstxt/cloudstack-nagios
151
151
  licenses:
152
152
  - MIT
153
153
  metadata: {}