cloudstack-nagios 0.7.0 → 0.7.1

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: 61fc52cfa0fc0f9937354c38b572bd9ffc396b57
4
- data.tar.gz: b5e5b1ab1e158758f991f3b3dad2c8bdf5cc1915
3
+ metadata.gz: 15e5da96d486372d134e32cf65e0ee928704a563
4
+ data.tar.gz: 97e5917d4e89e17f42590e68d601d963a86433f6
5
5
  SHA512:
6
- metadata.gz: b44902d21ae8fa6eeb5a516eb8046b27df332c2a568559de327a7eaa0f48bf7403c0d5a37449ff321dc0b4d072d72019dd8916878248b56a0c21133bddaa8f86
7
- data.tar.gz: d2d063072329523d77fd21a86afc006a5211daa9e336971c9319098635c41a1cccc52cdd472c076abee549df775551e27efdfb3202192445789d1fa4483a7872
6
+ metadata.gz: 910a0b2bec25e5eb26b0a86fbb743b0530b71dfaa13b277f6335a00c6fc4323f5e12eab1712ecbb369379f1cc374a3c2054ad198cc952c8137f4d0c115215b98
7
+ data.tar.gz: d5da3d951585491a4cc638a55495fbd4b0be0800f52a887062da423002378e8e13caec81ca5ff3a6535677d72909a708f5406084697fbbf67bf5b77a97c52084
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack-nagios (0.6.2)
4
+ cloudstack-nagios (0.7.0)
5
5
  cloudstack_client (~> 0.4, >= 0.4.4)
6
6
  erubis (~> 2.7.0)
7
7
  highline (~> 1.6.20)
@@ -11,7 +11,7 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- cloudstack_client (0.4.4)
14
+ cloudstack_client (0.5.0)
15
15
  erubis (2.7.0)
16
16
  highline (1.6.20)
17
17
  json (1.8.1)
data/README.md CHANGED
@@ -91,6 +91,12 @@ Generate nagios service configuration for capacity checks:
91
91
  $ cs-nagios nagios_config capacity_services
92
92
  ```
93
93
 
94
+ Generate nagios service configuration for async job checks:
95
+
96
+ ```bash
97
+ $ cs-nagios nagios_config asyncjobs_services
98
+ ```
99
+
94
100
  ### System VM checks
95
101
 
96
102
  For all vm checks access to the cloudstack management network is required in order to run the ckecks via ssh or snmp.
@@ -130,7 +136,7 @@ Example:
130
136
  $ cs-nagios check capacity memory --zone ZUERICH_IX
131
137
  ```
132
138
 
133
- ### Storage Pool checks
139
+ ### Storage pool checks
134
140
 
135
141
  Checks the available disk space on Cloudstack storage pools.
136
142
 
@@ -140,6 +146,16 @@ Example:
140
146
  $ cs-nagios check storage_pool --pool_name fs_cs_zone01_pod01
141
147
  ```
142
148
 
149
+ ### Async jobs checks
150
+
151
+ Checks the number of pending async jobs.
152
+
153
+ Example:
154
+
155
+ ```bash
156
+ $ cs-nagios check async_jobs
157
+ ```
158
+
143
159
  ## References
144
160
 
145
161
  * [Cloudstack API documentation](http://cloudstack.apache.org/docs/api/apidocs-4.2/TOC_Root_Admin.html)
@@ -55,4 +55,27 @@ class Check < CloudstackNagios::Base
55
55
  exit data[0]
56
56
  end
57
57
 
58
+ desc "async_jobs", "check the number of pending async jobs"
59
+ option :warning,
60
+ desc: 'warning level',
61
+ type: :numeric,
62
+ default: 5,
63
+ aliases: '-w'
64
+ option :critical,
65
+ desc: 'critical level',
66
+ type: :numeric,
67
+ default: 10,
68
+ aliases: '-c'
69
+ def async_jobs
70
+ jobs = client.send_request('command' => 'listAsyncJobs', 'listall' => 'true')['asyncjobs']
71
+ outstanding_jobs = jobs.select {|job| job['jobstatus'] == 0 }
72
+ if outstanding_jobs.size < options[:warning]
73
+ code = 0
74
+ elsif outstanding_jobs.size < options[:critical]
75
+ code = 1
76
+ else
77
+ code = 2
78
+ end
79
+ puts "async_jobs #{RETURN_CODES[code]} - jobs = #{outstanding_jobs.size} | jobs=#{outstanding_jobs.size}"
80
+ end
58
81
  end
@@ -80,6 +80,20 @@ class NagiosConfig < CloudstackNagios::Base
80
80
  )
81
81
  end
82
82
 
83
+ desc "asyncjobs_services", "generate nagios capacity services configuration"
84
+ option :template,
85
+ desc: "path of ERB template to use",
86
+ default: File.join(File.dirname(__FILE__), '..', 'templates', 'cloudstack_asyncjobs_services.cfg.erb'),
87
+ aliases: '-t'
88
+ def asyncjobs_services
89
+ service_template = load_template(options[:template])
90
+ puts service_template.result(
91
+ bin_path: bin_path,
92
+ config_file: options[:config],
93
+ date: date_string
94
+ )
95
+ end
96
+
83
97
  no_commands do
84
98
  def date_string
85
99
  Time.new.strftime("%d.%m.%Y - %H:%M:%S")
@@ -0,0 +1,35 @@
1
+ ###############################################################################
2
+ #
3
+ # Cloudstack async jobs services configuration file
4
+ #
5
+ # Created by: cloudstack-nagios
6
+ # Date: <%= date %>
7
+ # Version: Nagios 3.x config file
8
+ #
9
+ # --- DO NOT EDIT THIS FILE BY HAND ---
10
+ # cloudstack-nagios will overwite all manual settings during the next update
11
+ #
12
+ ###############################################################################
13
+
14
+ define command {
15
+ command_name cs-nagios_check-asyncjobs
16
+ command_line <%= bin_path -%>cs-nagios check async_jobs -w $ARG1$ -c $ARG2$ --config <%= config_file %>
17
+ register 1
18
+ }
19
+
20
+ define service {
21
+ hostgroup_name Cloudstack-SystemVM
22
+ service_description Cloudstack Async Jobs
23
+ display_name Cloudstack Async Jobs
24
+ use Generic-Service,service-pnp
25
+ check_command cs-nagios_check-asyncjobs!80!90
26
+ register 1
27
+ }
28
+
29
+ ###############################################################################
30
+ #
31
+ # Service configuration file
32
+ #
33
+ # END OF FILE
34
+ #
35
+ ###############################################################################
@@ -1,4 +1,3 @@
1
-
2
1
  ###############################################################################
3
2
  #
4
3
  # Cloudstack capcity services configuration file
@@ -1,4 +1,3 @@
1
-
2
1
  ###############################################################################
3
2
  #
4
3
  # Service configuration file
@@ -1,3 +1,3 @@
1
1
  module CloudstackNagios
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
@@ -141,6 +141,7 @@ files:
141
141
  - lib/cloudstack-nagios/files/snmpd.conf
142
142
  - lib/cloudstack-nagios/helper.rb
143
143
  - lib/cloudstack-nagios/templates/cloudstack_api_hosts.cfg.erb
144
+ - lib/cloudstack-nagios/templates/cloudstack_asyncjobs_services.cfg.erb
144
145
  - lib/cloudstack-nagios/templates/cloudstack_capacity_services.cfg.erb
145
146
  - lib/cloudstack-nagios/templates/cloudstack_router_hosts.cfg.erb
146
147
  - lib/cloudstack-nagios/templates/cloudstack_router_services.cfg.erb