sensu-plugins-azurerm 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +278 -7
  4. data/bin/check-azurerm-core-usage.rb +37 -40
  5. data/bin/check-azurerm-cores-d-usage.rb +121 -0
  6. data/bin/check-azurerm-cores-ds-usage.rb +121 -0
  7. data/bin/check-azurerm-cores-dsv2-usage.rb +121 -0
  8. data/bin/check-azurerm-cores-dv2-usage.rb +121 -0
  9. data/bin/check-azurerm-cores-f-usage.rb +121 -0
  10. data/bin/check-azurerm-cores-fs-usage.rb +121 -0
  11. data/bin/check-azurerm-load-balancers-usage.rb +121 -0
  12. data/bin/check-azurerm-network-interfaces-usage.rb +121 -0
  13. data/bin/check-azurerm-network-security-groups-usage.rb +121 -0
  14. data/bin/check-azurerm-public-ip-addresses-usage.rb +121 -0
  15. data/bin/check-azurerm-route-tables-usage.rb +121 -0
  16. data/bin/check-azurerm-static-public-ip-addresses-usage.rb +121 -0
  17. data/bin/check-azurerm-virtual-machines-usage.rb +37 -40
  18. data/bin/check-azurerm-virtual-network-gateway-connected.rb +31 -34
  19. data/bin/check-azurerm-virtual-network-gateway-failure-connected.rb +51 -54
  20. data/bin/check-azurerm-virtual-networks-usage.rb +121 -0
  21. data/bin/metric-azurerm-service-bus-subscription-message-count.rb +39 -42
  22. data/bin/metric-azurerm-virtual-network-gateway-usage.rb +40 -43
  23. data/lib/sensu-plugins-azurerm.rb +1 -0
  24. data/lib/sensu-plugins-azurerm/common.rb +10 -0
  25. data/lib/sensu-plugins-azurerm/compute_usage.rb +3 -13
  26. data/lib/sensu-plugins-azurerm/network_usage.rb +12 -5
  27. data/lib/sensu-plugins-azurerm/servicebus_usage.rb +3 -6
  28. data/lib/sensu-plugins-azurerm/version.rb +1 -1
  29. metadata +60 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb55a621b355424cc965fb60bfbd7a8eb18efb34
4
- data.tar.gz: 85f6319fd7de0a5bce89a71a5d5ffd4bf1f9f2b6
3
+ metadata.gz: c1b77d428b474e90ec189c1f3f11916872f5a534
4
+ data.tar.gz: 3b7131d05d7076d3be2f59775ddd98bd57dc064b
5
5
  SHA512:
6
- metadata.gz: 901c1808a79b961d78247e4c00189bad6d787b111fc11721702b2bcd201ed7c2ad40f1beed1febef744e0f8e7a292a4ade8c927464f1ac6f9e69c8587617fa4c
7
- data.tar.gz: f82fc17d7f9ab3328b9f5716b059ce544fcf80685d165968f111f0e0bcd7acbb5945baeb98229ccc76bce84948a365f1397696cf6a41ffd345477ba6aa96819f
6
+ metadata.gz: d0327c57cf60ba7831191ffc746aa16455176e96fce436bca4f546f2fa9f365455f75cc8a89af2ee241ab6ff5bae5ef8aef16a2f81408c785e1425e58f61403d
7
+ data.tar.gz: 1e2c3f7d2501a7ab7afc65a6bc93e55fcdd0e08a7f7443e6b69f566013dd645f4b3b7d0e4cb71ada835c9bf9811e2796b5dcea3839ce80213978006801fc087d
data/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
+ ## 0.0.4 - 2016-12-04
7
+ ### Added
8
+ - Checks for the following Quota's:
9
+ - D Family Cores
10
+ - DS Family Cores
11
+ - DSv2 Family Cores
12
+ - Dv2 Family Cores
13
+ - F Family Cores
14
+ - FS Family Cores
15
+ - Load Balancers
16
+ - Network Interfaces
17
+ - Network Security Groups
18
+ - Public IP Addresses
19
+ - Route Tables
20
+ - Static Public IP Addresses
21
+ - Virtual Networks
22
+ ### Changed
23
+ - Refactoring to match the linting guidelines.
24
+ ### Fixed
25
+ - Documentation for Virtual Network Gateways
26
+
6
27
  ## 0.0.3 - 2016-11-24
7
28
  ### Added
8
29
  - Virtual Network Gateways:
data/README.md CHANGED
@@ -9,18 +9,42 @@
9
9
  ## Functionality
10
10
 
11
11
  - check-azurerm-core-usage.rb
12
+ - check-azurerm-cores-d-usage.rb
13
+ - check-azurerm-cores-ds-usage.rb
14
+ - check-azurerm-cores-dsv2-usage.rb
15
+ - check-azurerm-cores-dv2-usage.rb
16
+ - check-azurerm-cores-f-usage.rb
17
+ - check-azurerm-cores-fs-usage.rb
18
+ - check-azurerm-network-interfaces-usage.rb
19
+ - check-azurerm-network-security-groups-usage.rb
20
+ - check-azurerm-public-ip-addresses-usage.rb
21
+ - check-azurerm-route-tables-usage.rb
22
+ - check-azurerm-static-public-ip-addresses-usage.rb
12
23
  - check-azurerm-virtual-machines-usage.rb
13
24
  - check-azurerm-virtual-network-gateway-connected.rb
14
25
  - check-azurerm-virtual-network-gateway-failover-connected.rb
26
+ - check-azurerm-virtual-networks-usage.rb
15
27
  - metric-azurerm-service-bus-subscription-message-count.rb
16
28
  - metric-azurerm-virtual-network-gateway-usage.rb
17
29
 
18
30
  ## Files
19
31
 
20
32
  * /bin/check-azurerm-core-usage.rb
33
+ * /bin/check-azurerm-cores-d-usage.rb
34
+ * /bin/check-azurerm-cores-ds-usage.rb
35
+ * /bin/check-azurerm-cores-dsv2-usage.rb
36
+ * /bin/check-azurerm-cores-dv2-usage.rb
37
+ * /bin/check-azurerm-cores-f-usage.rb
38
+ * /bin/check-azurerm-cores-fs-usage.rb
39
+ * /bin/check-azurerm-network-interfaces-usage.rb
40
+ * /bin/check-azurerm-network-security-groups-usage.rb
41
+ * /bin/check-azurerm-public-ip-addresses-usage.rb
42
+ * /bin/check-azurerm-route-tables-usage.rb
43
+ * /bin/check-azurerm-static-public-ip-addresses-usage.rb
21
44
  * /bin/check-azurerm-virtual-machines-usage.rb
22
45
  * /bin/check-azurerm-virtual-network-gateway-connected.rb
23
46
  * /bin/check-azurerm-virtual-network-gateway-failover-connected.rb
47
+ * /bin/check-azurerm-virtual-networks-usage.rb
24
48
  * /bin/metric-azurerm-service-bus-subscription-message-count.rb
25
49
  * /bin/metric-azurerm-virtual-network-gateway-usage.rb
26
50
 
@@ -40,12 +64,240 @@
40
64
  ./check-azurerm-core-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
41
65
  -client_id "00000000-0000-0000-0000-000000000000"
42
66
  -client_secret "00000000-0000-0000-0000-000000000000"
43
- -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
67
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
44
68
  -location "westeurope"
45
69
  -warning_percentage 80
46
70
  -critical_percentage 90
47
71
  ```
48
72
 
73
+ **check-azurerm-cores-d-usage.rb**
74
+ ```
75
+ ./check-azurerm-cores-d-usage.rb -l "westeurope" -w 80 -c 90
76
+
77
+ ./check-azurerm-cores-d-usage.rb -t "00000000-0000-0000-0000-000000000000"
78
+ -c "00000000-0000-0000-0000-000000000000"
79
+ -S "00000000-0000-0000-0000-000000000000"
80
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
81
+ -l "eastus2" -w 80 -c 90
82
+
83
+ ./check-azurerm-cores-d-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
84
+ -client_id "00000000-0000-0000-0000-000000000000"
85
+ -client_secret "00000000-0000-0000-0000-000000000000"
86
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
87
+ -location "westeurope"
88
+ -warning_percentage 80
89
+ -critical_percentage 90
90
+ ```
91
+
92
+ **check-azurerm-cores-ds-usage.rb**
93
+ ```
94
+ ./check-azurerm-cores-ds-usage.rb -l "westeurope" -w 80 -c 90
95
+
96
+ ./check-azurerm-cores-ds-usage.rb -t "00000000-0000-0000-0000-000000000000"
97
+ -c "00000000-0000-0000-0000-000000000000"
98
+ -S "00000000-0000-0000-0000-000000000000"
99
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
100
+ -l "eastus2" -w 80 -c 90
101
+
102
+ ./check-azurerm-cores-ds-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
103
+ -client_id "00000000-0000-0000-0000-000000000000"
104
+ -client_secret "00000000-0000-0000-0000-000000000000"
105
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
106
+ -location "westeurope"
107
+ -warning_percentage 80
108
+ -critical_percentage 90
109
+ ```
110
+
111
+ **check-azurerm-cores-dsv2-usage.rb**
112
+ ```
113
+ ./check-azurerm-cores-dsv2-usage.rb -l "westeurope" -w 80 -c 90
114
+
115
+ ./check-azurerm-cores-dsv2-usage.rb -t "00000000-0000-0000-0000-000000000000"
116
+ -c "00000000-0000-0000-0000-000000000000"
117
+ -S "00000000-0000-0000-0000-000000000000"
118
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
119
+ -l "eastus2" -w 80 -c 90
120
+
121
+ ./check-azurerm-cores-dsv2-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
122
+ -client_id "00000000-0000-0000-0000-000000000000"
123
+ -client_secret "00000000-0000-0000-0000-000000000000"
124
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
125
+ -location "westeurope"
126
+ -warning_percentage 80
127
+ -critical_percentage 90
128
+ ```
129
+
130
+ **check-azurerm-cores-dv2-usage.rb**
131
+ ```
132
+ ./check-azurerm-cores-dv2-usage.rb -l "westeurope" -w 80 -c 90
133
+
134
+ ./check-azurerm-cores-dv2-usage.rb -t "00000000-0000-0000-0000-000000000000"
135
+ -c "00000000-0000-0000-0000-000000000000"
136
+ -S "00000000-0000-0000-0000-000000000000"
137
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
138
+ -l "eastus2" -w 80 -c 90
139
+
140
+ ./check-azurerm-cores-dv2-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
141
+ -client_id "00000000-0000-0000-0000-000000000000"
142
+ -client_secret "00000000-0000-0000-0000-000000000000"
143
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
144
+ -location "westeurope"
145
+ -warning_percentage 80
146
+ -critical_percentage 90
147
+ ```
148
+
149
+ **check-azurerm-cores-f-usage.rb**
150
+ ```
151
+ ./check-azurerm-cores-f-usage.rb -l "westeurope" -w 80 -c 90
152
+
153
+ ./check-azurerm-cores-f-usage.rb -t "00000000-0000-0000-0000-000000000000"
154
+ -c "00000000-0000-0000-0000-000000000000"
155
+ -S "00000000-0000-0000-0000-000000000000"
156
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
157
+ -l "eastus2" -w 80 -c 90
158
+
159
+ ./check-azurerm-cores-f-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
160
+ -client_id "00000000-0000-0000-0000-000000000000"
161
+ -client_secret "00000000-0000-0000-0000-000000000000"
162
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
163
+ -location "westeurope"
164
+ -warning_percentage 80
165
+ -critical_percentage 90
166
+ ```
167
+
168
+ **check-azurerm-cores-fs-usage.rb**
169
+ ```
170
+ ./check-azurerm-cores-fs-usage.rb -l "westeurope" -w 80 -c 90
171
+
172
+ ./check-azurerm-cores-fs-usage.rb -t "00000000-0000-0000-0000-000000000000"
173
+ -c "00000000-0000-0000-0000-000000000000"
174
+ -S "00000000-0000-0000-0000-000000000000"
175
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
176
+ -l "eastus2" -w 80 -c 90
177
+
178
+ ./check-azurerm-cores-fs-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
179
+ -client_id "00000000-0000-0000-0000-000000000000"
180
+ -client_secret "00000000-0000-0000-0000-000000000000"
181
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
182
+ -location "westeurope"
183
+ -warning_percentage 80
184
+ -critical_percentage 90
185
+ ```
186
+
187
+ **check-azurerm-load-balancers-usage.rb**
188
+ ```
189
+ ./check-azurerm-load-balancers-usage.rb -l "westeurope" -w 80 -c 90
190
+
191
+ ./check-azurerm-load-balancers-usage.rb -t "00000000-0000-0000-0000-000000000000"
192
+ -c "00000000-0000-0000-0000-000000000000"
193
+ -S "00000000-0000-0000-0000-000000000000"
194
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
195
+ -l "eastus2" -w 80 -c 90
196
+
197
+ ./check-azurerm-load-balancers-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
198
+ -client_id "00000000-0000-0000-0000-000000000000"
199
+ -client_secret "00000000-0000-0000-0000-000000000000"
200
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
201
+ -location "westeurope"
202
+ -warning_percentage 80
203
+ -critical_percentage 90
204
+ ```
205
+
206
+ **check-azurerm-network-interfaces-usage.rb**
207
+ ```
208
+ ./check-azurerm-network-interfaces-usage.rb -l "westeurope" -w 80 -c 90
209
+
210
+ ./check-azurerm-network-interfaces-usage.rb -t "00000000-0000-0000-0000-000000000000"
211
+ -c "00000000-0000-0000-0000-000000000000"
212
+ -S "00000000-0000-0000-0000-000000000000"
213
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
214
+ -l "eastus2" -w 80 -c 90
215
+
216
+ ./check-azurerm-network-interfaces-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
217
+ -client_id "00000000-0000-0000-0000-000000000000"
218
+ -client_secret "00000000-0000-0000-0000-000000000000"
219
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
220
+ -location "westeurope"
221
+ -warning_percentage 80
222
+ -critical_percentage 90
223
+ ```
224
+
225
+ **check-azurerm-network-security-groups-usage.rb**
226
+ ```
227
+ ./check-azurerm-network-security-groups-usage.rb -l "westeurope" -w 80 -c 90
228
+
229
+ ./check-azurerm-network-security-groups-usage.rb -t "00000000-0000-0000-0000-000000000000"
230
+ -c "00000000-0000-0000-0000-000000000000"
231
+ -S "00000000-0000-0000-0000-000000000000"
232
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
233
+ -l "eastus2" -w 80 -c 90
234
+
235
+ ./check-azurerm-network-security-groups-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
236
+ -client_id "00000000-0000-0000-0000-000000000000"
237
+ -client_secret "00000000-0000-0000-0000-000000000000"
238
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
239
+ -location "westeurope"
240
+ -warning_percentage 80
241
+ -critical_percentage 90
242
+ ```
243
+
244
+ **check-azurerm-public-ip-addresses-usage.rb**
245
+ ```
246
+ ./check-azurerm-public-ip-addresses-usage.rb -l "westeurope" -w 80 -c 90
247
+
248
+ ./check-azurerm-public-ip-addresses-usage.rb -t "00000000-0000-0000-0000-000000000000"
249
+ -c "00000000-0000-0000-0000-000000000000"
250
+ -S "00000000-0000-0000-0000-000000000000"
251
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
252
+ -l "eastus2" -w 80 -c 90
253
+
254
+ ./check-azurerm-public-ip-addresses-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
255
+ -client_id "00000000-0000-0000-0000-000000000000"
256
+ -client_secret "00000000-0000-0000-0000-000000000000"
257
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
258
+ -location "westeurope"
259
+ -warning_percentage 80
260
+ -critical_percentage 90
261
+ ```
262
+
263
+ **check-azurerm-static-public-ip-addresses-usage.rb**
264
+ ```
265
+ ./check-azurerm-static-public-ip-addresses-usage.rb -l "westeurope" -w 80 -c 90
266
+
267
+ ./check-azurerm-static-public-ip-addresses-usage.rb -t "00000000-0000-0000-0000-000000000000"
268
+ -c "00000000-0000-0000-0000-000000000000"
269
+ -S "00000000-0000-0000-0000-000000000000"
270
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
271
+ -l "eastus2" -w 80 -c 90
272
+
273
+ ./check-azurerm-static-public-ip-addresses-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
274
+ -client_id "00000000-0000-0000-0000-000000000000"
275
+ -client_secret "00000000-0000-0000-0000-000000000000"
276
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
277
+ -location "westeurope"
278
+ -warning_percentage 80
279
+ -critical_percentage 90
280
+ ```
281
+
282
+ **check-azurerm-route-tables-usage.rb**
283
+ ```
284
+ ./check-azurerm-route-tables-usage.rb -l "westeurope" -w 80 -c 90
285
+
286
+ ./check-azurerm-route-tables-usage.rb -t "00000000-0000-0000-0000-000000000000"
287
+ -c "00000000-0000-0000-0000-000000000000"
288
+ -S "00000000-0000-0000-0000-000000000000"
289
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
290
+ -l "eastus2" -w 80 -c 90
291
+
292
+ ./check-azurerm-route-tables-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
293
+ -client_id "00000000-0000-0000-0000-000000000000"
294
+ -client_secret "00000000-0000-0000-0000-000000000000"
295
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
296
+ -location "westeurope"
297
+ -warning_percentage 80
298
+ -critical_percentage 90
299
+ ```
300
+
49
301
  **check-azurerm-virtual-machines-usage.rb**
50
302
  ```
51
303
  ./check-azurerm-virtual-machines-usage.rb -l "westeurope" -w 80 -c 90
@@ -59,7 +311,7 @@
59
311
  ./check-azurerm-virtual-machines-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
60
312
  -client_id "00000000-0000-0000-0000-000000000000"
61
313
  -client_secret "00000000-0000-0000-0000-000000000000"
62
- -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
314
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
63
315
  -location "westeurope"
64
316
  -warning_percentage 80
65
317
  -critical_percentage 90
@@ -81,7 +333,7 @@
81
333
  -tenant "00000000-0000-0000-0000-000000000000"
82
334
  -client "00000000-0000-0000-0000-000000000000"
83
335
  -clientSecret "00000000-0000-0000-0000-000000000000"
84
- -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
336
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
85
337
  -resourceGroup "resourcegroup"
86
338
  -name "gatewayname"
87
339
  ```
@@ -103,16 +355,35 @@
103
355
  -p "primaryname"
104
356
  -s "secondaryname"
105
357
 
106
- check-azurerm-virtual-network-gateway-failover-connected.rb
358
+ ./check-azurerm-virtual-network-gateway-failover-connected.rb
107
359
  -tenant "00000000-0000-0000-0000-000000000000"
108
360
  -client "00000000-0000-0000-0000-000000000000"
109
361
  -clientSecret "00000000-0000-0000-0000-000000000000"
110
- -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
362
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
111
363
  -resourceGroup "resourcegroup"
112
364
  -primaryName "gatewayname"
113
365
  -secondaryName "gatewayname"
114
366
  ```
115
367
 
368
+ **check-azurerm-virtual-networks-usage.rb**
369
+ ```
370
+ ./check-azurerm-virtual-networks-usage.rb -l "westeurope" -w 80 -c 90
371
+
372
+ ./check-azurerm-virtual-networks-usage.rb -t "00000000-0000-0000-0000-000000000000"
373
+ -c "00000000-0000-0000-0000-000000000000"
374
+ -S "00000000-0000-0000-0000-000000000000"
375
+ -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
376
+ -l "eastus2" -w 80 -c 90
377
+
378
+ ./check-azurerm-virtual-networks-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
379
+ -client_id "00000000-0000-0000-0000-000000000000"
380
+ -client_secret "00000000-0000-0000-0000-000000000000"
381
+ -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
382
+ -location "westeurope"
383
+ -warning_percentage 80
384
+ -critical_percentage 90
385
+ ```
386
+
116
387
  **metric-azurerm-service-bus-subscription-message-count.rb**
117
388
  ```
118
389
  ./metric-azurerm-service-bus-subscription-message-count.rb
@@ -135,7 +406,7 @@ check-azurerm-virtual-network-gateway-failover-connected.rb
135
406
  --tenant "00000000-0000-0000-0000-000000000000"
136
407
  --client "00000000-0000-0000-0000-000000000000"
137
408
  --clientSecret "00000000-0000-0000-0000-000000000000"
138
- --subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
409
+ --subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
139
410
  --resourceGroup "resourcegroup"
140
411
  --namespaceName "namespace"
141
412
  --topicName "topic"
@@ -158,7 +429,7 @@ check-azurerm-virtual-network-gateway-failover-connected.rb
158
429
  --tenant "00000000-0000-0000-0000-000000000000"
159
430
  --client "00000000-0000-0000-0000-000000000000"
160
431
  --clientSecret "00000000-0000-0000-0000-000000000000"
161
- --subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
432
+ --subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
162
433
  --resourceGroup "resourcegroup"
163
434
  --name "gatewayname"
164
435
  --customScheme "foo"
@@ -28,7 +28,7 @@
28
28
  # ./check-azurerm-core-usage.rb -tenant "00000000-0000-0000-0000-000000000000"
29
29
  # -client_id "00000000-0000-0000-0000-000000000000"
30
30
  # -client_secret "00000000-0000-0000-0000-000000000000"
31
- # -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
31
+ # -subscription "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
32
32
  # -location "westeurope"
33
33
  # -warning_percentage 80
34
34
  # -critical_percentage 90
@@ -41,76 +41,74 @@
41
41
  # for details.
42
42
  #
43
43
 
44
+ require 'azure_mgmt_compute'
44
45
  require 'sensu-plugin/check/cli'
45
46
  require 'sensu-plugins-azurerm'
46
- require 'azure_mgmt_compute'
47
47
 
48
48
  class CheckAzureRMCoreUsage < Sensu::Plugin::Check::CLI
49
49
  include SensuPluginsAzureRM
50
50
 
51
51
  option :tenant_id,
52
- description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
53
- short: '-t ID',
54
- long: '--tenant ID',
55
- default: ENV['ARM_TENANT_ID'] # TODO: can we pull these out from the Check too?
52
+ description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
53
+ short: '-t ID',
54
+ long: '--tenant ID',
55
+ default: ENV['ARM_TENANT_ID'] # TODO: can we pull these out from the Check too?
56
56
 
57
57
  option :client_id,
58
- description: 'ARM Client ID. Either set ENV[\'ARM_CLIENT_ID\'] or provide it as an option',
59
- short: '-c ID',
60
- long: '--client ID',
61
- default: ENV['ARM_CLIENT_ID']
58
+ description: 'ARM Client ID. Either set ENV[\'ARM_CLIENT_ID\'] or provide it as an option',
59
+ short: '-c ID',
60
+ long: '--client ID',
61
+ default: ENV['ARM_CLIENT_ID']
62
62
 
63
63
  option :client_secret,
64
- description: 'ARM Client Secret. Either set ENV[\'ARM_CLIENT_SECRET\'] or provide it as an option',
65
- short: '-s SECRET',
66
- long: '--clientSecret SECRET',
67
- default: ENV['ARM_CLIENT_SECRET']
64
+ description: 'ARM Client Secret. Either set ENV[\'ARM_CLIENT_SECRET\'] or provide it as an option',
65
+ short: '-s SECRET',
66
+ long: '--clientSecret SECRET',
67
+ default: ENV['ARM_CLIENT_SECRET']
68
68
 
69
69
  option :subscription_id,
70
- description: 'ARM Subscription ID',
71
- short: '-S ID',
72
- long: '--subscription ID',
73
- default: ENV['ARM_SUBSCRIPTION_ID']
70
+ description: 'ARM Subscription ID',
71
+ short: '-S ID',
72
+ long: '--subscription ID',
73
+ default: ENV['ARM_SUBSCRIPTION_ID']
74
74
 
75
75
  option :location,
76
- description: 'Azure Location (e.g. westeurope/eastus2)',
77
- short: '-l LOCATION',
78
- long: '--location LOCATION'
76
+ description: 'Azure Location (e.g. westeurope/eastus2)',
77
+ short: '-l LOCATION',
78
+ long: '--location LOCATION'
79
79
 
80
80
  option :warning_percentage,
81
- description: 'Warning Percentage threshold for filter',
82
- short: '-w PERCENTAGE',
83
- long: '--warning PERCENTAGE'
81
+ description: 'Warning Percentage threshold for filter',
82
+ short: '-w PERCENTAGE',
83
+ long: '--warning PERCENTAGE'
84
84
 
85
85
  option :critical_percentage,
86
- description: 'Critical Percentage threshold for filter',
87
- short: '-c PERCENTAGE',
88
- long: '--critical PERCENTAGE'
86
+ description: 'Critical Percentage threshold for filter',
87
+ short: '-c PERCENTAGE',
88
+ long: '--critical PERCENTAGE'
89
89
 
90
90
  def run
91
- tenantId = config[:tenant_id]
92
- clientId = config[:client_id]
93
- clientSecret = config[:client_secret]
94
- subscriptionId = config[:subscription_id]
91
+ tenant_id = config[:tenant_id]
92
+ client_id = config[:client_id]
93
+ client_secret = config[:client_secret]
94
+ subscription_id = config[:subscription_id]
95
95
  location = config[:location]
96
96
 
97
- common = ComputeUsage.new()
98
-
99
- usageClient = common.buildUsageOperationClient(tenantId, clientId, clientSecret, subscriptionId)
100
- result = common.retrieveUsageStats(usageClient, location, 'cores')
97
+ usage_client = ComputeUsage.new.build_usage_operation_client(tenant_id, client_id, client_secret, subscription_id)
98
+ result = Common.new.retrieve_usage_stats(usage_client, location, 'cores')
101
99
 
102
100
  current_usage = result.current_value
103
101
  allowance = result.limit
104
- criticalPercentage = config[:critical_percentage].to_f
105
- warningPercentage = config[:warning_percentage].to_f
102
+ critical_percentage = config[:critical_percentage].to_f
103
+ warning_percentage = config[:warning_percentage].to_f
106
104
 
107
105
  message = "Current usage: #{current_usage} of #{allowance} Cores"
108
106
 
109
107
  percentage_used = (current_usage.to_f / allowance.to_f) * 100
110
108
 
111
- if percentage_used >= criticalPercentage
109
+ if percentage_used >= critical_percentage
112
110
  critical message
113
- elsif percentage_used >= warningPercentage
111
+ elsif percentage_used >= warning_percentage
114
112
  warning message
115
113
  else
116
114
  ok message
@@ -120,5 +118,4 @@ class CheckAzureRMCoreUsage < Sensu::Plugin::Check::CLI
120
118
  puts "Error: exception: #{e}"
121
119
  critical
122
120
  end
123
-
124
121
  end