sensu-plugins-azurerm 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +68 -7
- data/bin/check-azurerm-virtual-machines-usage.rb +3 -3
- data/bin/check-azurerm-virtual-network-gateway-failure-connected.rb +136 -0
- data/bin/metric-azurerm-service-bus-subscription-message-count.rb +137 -0
- data/bin/metric-azurerm-virtual-network-gateway-usage.rb +16 -10
- data/lib/sensu-plugins-azurerm.rb +1 -0
- data/lib/sensu-plugins-azurerm/servicebus_usage.rb +16 -0
- data/lib/sensu-plugins-azurerm/version.rb +1 -1
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb55a621b355424cc965fb60bfbd7a8eb18efb34
|
4
|
+
data.tar.gz: 85f6319fd7de0a5bce89a71a5d5ffd4bf1f9f2b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901c1808a79b961d78247e4c00189bad6d787b111fc11721702b2bcd201ed7c2ad40f1beed1febef744e0f8e7a292a4ade8c927464f1ac6f9e69c8587617fa4c
|
7
|
+
data.tar.gz: f82fc17d7f9ab3328b9f5716b059ce544fcf80685d165968f111f0e0bcd7acbb5945baeb98229ccc76bce84948a365f1397696cf6a41ffd345477ba6aa96819f
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@ 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.3 - 2016-11-24
|
7
|
+
### Added
|
8
|
+
- Virtual Network Gateways:
|
9
|
+
- Added functionality to check Failover connections
|
10
|
+
- Made it possible to specify a custom Scheme for Metrics
|
11
|
+
- Service Bus:
|
12
|
+
- Added a Metric to expose the the Message Count for a Service Bus Topic
|
13
|
+
|
6
14
|
## 0.0.2 - 2016-11-23
|
7
15
|
### Added
|
8
16
|
- Virtual Network Gateways:
|
data/README.md
CHANGED
@@ -11,14 +11,17 @@
|
|
11
11
|
- check-azurerm-core-usage.rb
|
12
12
|
- check-azurerm-virtual-machines-usage.rb
|
13
13
|
- check-azurerm-virtual-network-gateway-connected.rb
|
14
|
+
- check-azurerm-virtual-network-gateway-failover-connected.rb
|
15
|
+
- metric-azurerm-service-bus-subscription-message-count.rb
|
14
16
|
- metric-azurerm-virtual-network-gateway-usage.rb
|
15
17
|
|
16
|
-
|
17
18
|
## Files
|
18
19
|
|
19
20
|
* /bin/check-azurerm-core-usage.rb
|
20
21
|
* /bin/check-azurerm-virtual-machines-usage.rb
|
21
22
|
* /bin/check-azurerm-virtual-network-gateway-connected.rb
|
23
|
+
* /bin/check-azurerm-virtual-network-gateway-failover-connected.rb
|
24
|
+
* /bin/metric-azurerm-service-bus-subscription-message-count.rb
|
22
25
|
* /bin/metric-azurerm-virtual-network-gateway-usage.rb
|
23
26
|
|
24
27
|
|
@@ -83,6 +86,63 @@
|
|
83
86
|
-name "gatewayname"
|
84
87
|
```
|
85
88
|
|
89
|
+
**check-azurerm-virtual-network-gateway-failover-connected.rb**
|
90
|
+
|
91
|
+
```
|
92
|
+
./check-azurerm-virtual-network-gateway-failover-connected.rb
|
93
|
+
-r "resourcegroup"
|
94
|
+
-p "primaryname"
|
95
|
+
-s "secondaryname"
|
96
|
+
|
97
|
+
./check-azurerm-virtual-network-gateway-failover-connected.rb
|
98
|
+
-t "00000000-0000-0000-0000-000000000000"
|
99
|
+
-c "00000000-0000-0000-0000-000000000000"
|
100
|
+
-S "00000000-0000-0000-0000-000000000000"
|
101
|
+
-s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
102
|
+
-r "resourcegroup"
|
103
|
+
-p "primaryname"
|
104
|
+
-s "secondaryname"
|
105
|
+
|
106
|
+
check-azurerm-virtual-network-gateway-failover-connected.rb
|
107
|
+
-tenant "00000000-0000-0000-0000-000000000000"
|
108
|
+
-client "00000000-0000-0000-0000-000000000000"
|
109
|
+
-clientSecret "00000000-0000-0000-0000-000000000000"
|
110
|
+
-subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
111
|
+
-resourceGroup "resourcegroup"
|
112
|
+
-primaryName "gatewayname"
|
113
|
+
-secondaryName "gatewayname"
|
114
|
+
```
|
115
|
+
|
116
|
+
**metric-azurerm-service-bus-subscription-message-count.rb**
|
117
|
+
```
|
118
|
+
./metric-azurerm-service-bus-subscription-message-count.rb
|
119
|
+
--resourceGroup "resourcegroup"
|
120
|
+
--namespace "namespace"
|
121
|
+
--topic "topic"
|
122
|
+
--subscriptionName "subscriptionName"
|
123
|
+
|
124
|
+
./metric-azurerm-service-bus-subscription-message-count.rb
|
125
|
+
-t "00000000-0000-0000-0000-000000000000"
|
126
|
+
-c "00000000-0000-0000-0000-000000000000"
|
127
|
+
-S "00000000-0000-0000-0000-000000000000"
|
128
|
+
-s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
129
|
+
--resourceGroup "resourcegroup"
|
130
|
+
--namespace "namespace"
|
131
|
+
--topic "topic"
|
132
|
+
--subscriptionName "subscriptionName"
|
133
|
+
|
134
|
+
./metric-azurerm-service-bus-subscription-message-count.rb
|
135
|
+
--tenant "00000000-0000-0000-0000-000000000000"
|
136
|
+
--client "00000000-0000-0000-0000-000000000000"
|
137
|
+
--clientSecret "00000000-0000-0000-0000-000000000000"
|
138
|
+
--subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
139
|
+
--resourceGroup "resourcegroup"
|
140
|
+
--namespaceName "namespace"
|
141
|
+
--topicName "topic"
|
142
|
+
--subscriptionName "subscriptionName"
|
143
|
+
--customScheme "foo"
|
144
|
+
```
|
145
|
+
|
86
146
|
**metric-azurerm-virtual-network-gateway-usagerb**
|
87
147
|
```
|
88
148
|
./metric-azurerm-virtual-network-gateway-usage.rb -r "resourcegroup" -n "gatewayname"
|
@@ -95,12 +155,13 @@
|
|
95
155
|
-r "resourcegroup" -n "gatewayname"
|
96
156
|
|
97
157
|
./metric-azurerm-virtual-network-gateway-usage.rb
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
158
|
+
--tenant "00000000-0000-0000-0000-000000000000"
|
159
|
+
--client "00000000-0000-0000-0000-000000000000"
|
160
|
+
--clientSecret "00000000-0000-0000-0000-000000000000"
|
161
|
+
--subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
162
|
+
--resourceGroup "resourcegroup"
|
163
|
+
--name "gatewayname"
|
164
|
+
--customScheme "foo"
|
104
165
|
```
|
105
166
|
|
106
167
|
## Installation
|
@@ -0,0 +1,136 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-azurerm-virtual-network-gateway-failover-connected
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks that at least one of the specified Virtual Network Gateways is connected.
|
7
|
+
# Firing a Critical alert if both are not in the Connected state.
|
8
|
+
#
|
9
|
+
# OUTPUT:
|
10
|
+
# plain-text
|
11
|
+
#
|
12
|
+
# PLATFORMS:
|
13
|
+
# Linux
|
14
|
+
#
|
15
|
+
# DEPENDENCIES:
|
16
|
+
# gem: azure_mgmt_network
|
17
|
+
# gem: sensu-plugin
|
18
|
+
#
|
19
|
+
# USAGE:
|
20
|
+
# ./check-azurerm-virtual-network-gateway-failover-connected.rb
|
21
|
+
# -r "resourcegroup"
|
22
|
+
# -p "primaryname"
|
23
|
+
# -s "secondaryname"
|
24
|
+
#
|
25
|
+
# ./check-azurerm-virtual-network-gateway-failover-connected.rb
|
26
|
+
# -t "00000000-0000-0000-0000-000000000000"
|
27
|
+
# -c "00000000-0000-0000-0000-000000000000"
|
28
|
+
# -S "00000000-0000-0000-0000-000000000000"
|
29
|
+
# -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
30
|
+
# -r "resourcegroup"
|
31
|
+
# -p "primaryname"
|
32
|
+
# -s "secondaryname"
|
33
|
+
#
|
34
|
+
# ./check-azurerm-virtual-network-gateway-failover-connected.rb
|
35
|
+
# -tenant "00000000-0000-0000-0000-000000000000"
|
36
|
+
# -client "00000000-0000-0000-0000-000000000000"
|
37
|
+
# -clientSecret "00000000-0000-0000-0000-000000000000"
|
38
|
+
# -subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
39
|
+
# -resourceGroup "resourcegroup"
|
40
|
+
# -primaryName "gatewayname"
|
41
|
+
# -secondaryName "gatewayname"
|
42
|
+
#
|
43
|
+
# NOTES:
|
44
|
+
#
|
45
|
+
# LICENSE:
|
46
|
+
# Tom Harvey
|
47
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
48
|
+
# for details.
|
49
|
+
#
|
50
|
+
|
51
|
+
require 'sensu-plugin/check/cli'
|
52
|
+
require 'sensu-plugins-azurerm'
|
53
|
+
require 'azure_mgmt_network'
|
54
|
+
|
55
|
+
class CheckAzureRMVirtualNetworkGatewayConnected < Sensu::Plugin::Check::CLI
|
56
|
+
include SensuPluginsAzureRM
|
57
|
+
|
58
|
+
option :tenant_id,
|
59
|
+
description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
|
60
|
+
short: '-t ID',
|
61
|
+
long: '--tenant ID',
|
62
|
+
default: ENV['ARM_TENANT_ID'] # TODO: can we pull these out from the Check too?
|
63
|
+
|
64
|
+
option :client_id,
|
65
|
+
description: 'ARM Client ID. Either set ENV[\'ARM_CLIENT_ID\'] or provide it as an option',
|
66
|
+
short: '-c ID',
|
67
|
+
long: '--client ID',
|
68
|
+
default: ENV['ARM_CLIENT_ID']
|
69
|
+
|
70
|
+
option :client_secret,
|
71
|
+
description: 'ARM Client Secret. Either set ENV[\'ARM_CLIENT_SECRET\'] or provide it as an option',
|
72
|
+
short: '-s SECRET',
|
73
|
+
long: '--clientSecret SECRET',
|
74
|
+
default: ENV['ARM_CLIENT_SECRET']
|
75
|
+
|
76
|
+
option :subscription_id,
|
77
|
+
description: 'ARM Subscription ID',
|
78
|
+
short: '-S ID',
|
79
|
+
long: '--subscription ID',
|
80
|
+
default: ENV['ARM_SUBSCRIPTION_ID']
|
81
|
+
|
82
|
+
option :resource_group_name,
|
83
|
+
description: 'Azure Resource Group Name',
|
84
|
+
short: '-r RESOURCEGROUP',
|
85
|
+
long: '--resourceGroup RESOURCEGROUP'
|
86
|
+
|
87
|
+
option :primary_name,
|
88
|
+
description: 'Azure Virtual Network Connection Gateway Primary Name',
|
89
|
+
short: '-p NAME',
|
90
|
+
long: '--primaryName NAME'
|
91
|
+
|
92
|
+
option :secondary_name,
|
93
|
+
description: 'Azure Virtual Network Connection Gateway Secondary Name',
|
94
|
+
short: '-s NAME',
|
95
|
+
long: '--secondaryName NAME'
|
96
|
+
|
97
|
+
def run
|
98
|
+
tenantId = config[:tenant_id]
|
99
|
+
clientId = config[:client_id]
|
100
|
+
clientSecret = config[:client_secret]
|
101
|
+
subscriptionId = config[:subscription_id]
|
102
|
+
|
103
|
+
resource_group_name = config[:resource_group_name]
|
104
|
+
|
105
|
+
primaryName = config[:primary_name]
|
106
|
+
secondaryName = config[:secondary_name]
|
107
|
+
|
108
|
+
usage = NetworkUsage.new()
|
109
|
+
|
110
|
+
networkClient = usage.buildVirtualNetworkClient(tenantId, clientId, clientSecret, subscriptionId)
|
111
|
+
|
112
|
+
primaryResult = networkClient.get(resource_group_name, primaryName)
|
113
|
+
primary_connection_state = primaryResult.connection_status
|
114
|
+
primary_inbound = primaryResult.ingress_bytes_transferred
|
115
|
+
primary_outbound = primaryResult.egress_bytes_transferred
|
116
|
+
|
117
|
+
secondaryResult = networkClient.get(resource_group_name, secondaryName)
|
118
|
+
secondary_connection_state = secondaryResult.connection_status
|
119
|
+
secondary_inbound = secondaryResult.ingress_bytes_transferred
|
120
|
+
secondary_outbound = secondaryResult.egress_bytes_transferred
|
121
|
+
message = "Primary: State is '#{primary_connection_state}'. Usage is #{primary_inbound} in / #{primary_outbound} out.\n"
|
122
|
+
message += "Secondary: State is '#{secondary_connection_state}'. Usage is #{secondary_inbound} in / #{secondary_outbound} out."
|
123
|
+
|
124
|
+
if primaryResult.connection_status.casecmp("connected") == 0 ||
|
125
|
+
secondaryResult.connection_status.casecmp("connected") == 0
|
126
|
+
ok message
|
127
|
+
else
|
128
|
+
critical message
|
129
|
+
end
|
130
|
+
|
131
|
+
rescue => e
|
132
|
+
puts "Error: exception: #{e}"
|
133
|
+
critical
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# metric-azurerm-service-bus-subscription-message-count
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin exposes the Service Bus Subscription Message Counts as a Metric
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain-text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: azure_mgmt_service_bus
|
16
|
+
# gem: sensu-plugin
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
#
|
20
|
+
# ./metric-azurerm-service-bus-subscription-message-count.rb
|
21
|
+
# --resourceGroup "resourcegroup"
|
22
|
+
# --namespace "namespace"
|
23
|
+
# --topic "topic"
|
24
|
+
# --subscriptionName "subscriptionName"
|
25
|
+
#
|
26
|
+
# ./metric-azurerm-service-bus-subscription-message-count.rb
|
27
|
+
# -t "00000000-0000-0000-0000-000000000000"
|
28
|
+
# -c "00000000-0000-0000-0000-000000000000"
|
29
|
+
# -S "00000000-0000-0000-0000-000000000000"
|
30
|
+
# -s "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
31
|
+
# --resourceGroup "resourcegroup"
|
32
|
+
# --namespace "namespace"
|
33
|
+
# --topic "topic"
|
34
|
+
# --subscriptionName "subscriptionName"
|
35
|
+
#
|
36
|
+
# ./metric-azurerm-service-bus-subscription-message-count.rb
|
37
|
+
# --tenant "00000000-0000-0000-0000-000000000000"
|
38
|
+
# --client "00000000-0000-0000-0000-000000000000"
|
39
|
+
# --clientSecret "00000000-0000-0000-0000-000000000000"
|
40
|
+
# --subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
41
|
+
# --resourceGroup "resourcegroup"
|
42
|
+
# --namespaceName "namespace"
|
43
|
+
# --topicName "topic"
|
44
|
+
# --subscriptionName "subscriptionName"
|
45
|
+
# --customScheme "foo"
|
46
|
+
#
|
47
|
+
# NOTES:
|
48
|
+
#
|
49
|
+
# LICENSE:
|
50
|
+
# Tom Harvey
|
51
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
52
|
+
# for details.
|
53
|
+
#
|
54
|
+
|
55
|
+
require 'sensu-plugin/metric/cli'
|
56
|
+
require 'sensu-plugins-azurerm'
|
57
|
+
require 'azure_mgmt_service_bus'
|
58
|
+
|
59
|
+
class MetricAzureRMServiceBusSubscriptionMessageCount < Sensu::Plugin::Metric::CLI::Statsd
|
60
|
+
include SensuPluginsAzureRM
|
61
|
+
|
62
|
+
option :tenant_id,
|
63
|
+
description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
|
64
|
+
short: '-t ID',
|
65
|
+
long: '--tenant ID',
|
66
|
+
default: ENV['ARM_TENANT_ID'] # TODO: can we pull these out from the Check too?
|
67
|
+
|
68
|
+
option :client_id,
|
69
|
+
description: 'ARM Client ID. Either set ENV[\'ARM_CLIENT_ID\'] or provide it as an option',
|
70
|
+
short: '-c ID',
|
71
|
+
long: '--client ID',
|
72
|
+
default: ENV['ARM_CLIENT_ID']
|
73
|
+
|
74
|
+
option :client_secret,
|
75
|
+
description: 'ARM Client Secret. Either set ENV[\'ARM_CLIENT_SECRET\'] or provide it as an option',
|
76
|
+
short: '-s SECRET',
|
77
|
+
long: '--clientSecret SECRET',
|
78
|
+
default: ENV['ARM_CLIENT_SECRET']
|
79
|
+
|
80
|
+
option :subscription_id,
|
81
|
+
description: 'ARM Subscription ID',
|
82
|
+
short: '-S ID',
|
83
|
+
long: '--subscription ID',
|
84
|
+
default: ENV['ARM_SUBSCRIPTION_ID']
|
85
|
+
|
86
|
+
option :resource_group_name,
|
87
|
+
description: 'Azure Resource Group Name',
|
88
|
+
long: '--resourceGroup RESOURCEGROUP'
|
89
|
+
|
90
|
+
option :namespace_name,
|
91
|
+
description: 'Azure Service Bus Namespace Name',
|
92
|
+
long: '--namespaceName NAMESPACE'
|
93
|
+
|
94
|
+
option :topic_name,
|
95
|
+
description: 'Azure Service Bus Topic Name',
|
96
|
+
long: '--topicName TOPIC'
|
97
|
+
|
98
|
+
option :subscription_name,
|
99
|
+
description: 'Azure Service Bus Topic Name',
|
100
|
+
long: '--subscriptionName TOPIC'
|
101
|
+
|
102
|
+
option :customScheme,
|
103
|
+
description: 'Metric naming scheme, text to prepend to .$parent.$child',
|
104
|
+
long: '--customScheme SCHEME',
|
105
|
+
default: "azurerm.servicebus"
|
106
|
+
|
107
|
+
def run
|
108
|
+
tenantId = config[:tenant_id]
|
109
|
+
clientId = config[:client_id]
|
110
|
+
clientSecret = config[:client_secret]
|
111
|
+
subscriptionId = config[:subscription_id]
|
112
|
+
|
113
|
+
resource_group_name = config[:resource_group_name]
|
114
|
+
namespace_name = config[:namespace_name]
|
115
|
+
topic_name = config[:topic_name]
|
116
|
+
subscription_name = config[:subscription_name]
|
117
|
+
|
118
|
+
usage = ServiceBusUsage.new()
|
119
|
+
|
120
|
+
serviceBusClient = usage.buildServiceBusClient(tenantId, clientId, clientSecret, subscriptionId)
|
121
|
+
result = serviceBusClient.get(resource_group_name, namespace_name, topic_name, subscription_name)
|
122
|
+
|
123
|
+
count = result.message_count
|
124
|
+
|
125
|
+
timestamp = Time.now.utc.to_i
|
126
|
+
scheme = config[:customScheme]
|
127
|
+
name = [scheme, resource_group_name, namespace_name, topic_name, subscription_name].join('.').tr(' ', '_').tr('{}', '').tr('[]', '')
|
128
|
+
metricName = [name, "message_count"].join('.')
|
129
|
+
|
130
|
+
output metricName, count, timestamp
|
131
|
+
ok
|
132
|
+
rescue => e
|
133
|
+
puts "Error: exception: #{e}"
|
134
|
+
critical
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -26,12 +26,13 @@
|
|
26
26
|
# -r "resourcegroup" -n "gatewayname"
|
27
27
|
#
|
28
28
|
# ./metric-azurerm-virtual-network-gateway-usage.rb
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
29
|
+
# --tenant "00000000-0000-0000-0000-000000000000"
|
30
|
+
# --client "00000000-0000-0000-0000-000000000000"
|
31
|
+
# --clientSecret "00000000-0000-0000-0000-000000000000"
|
32
|
+
# --subscription_id "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234"
|
33
|
+
# --resourceGroup "resourcegroup"
|
34
|
+
# --name "gatewayname"
|
35
|
+
# --customScheme "foo"
|
35
36
|
#
|
36
37
|
# NOTES:
|
37
38
|
#
|
@@ -41,11 +42,11 @@
|
|
41
42
|
# for details.
|
42
43
|
#
|
43
44
|
|
44
|
-
require 'sensu-plugin/
|
45
|
+
require 'sensu-plugin/metric/cli'
|
45
46
|
require 'sensu-plugins-azurerm'
|
46
47
|
require 'azure_mgmt_network'
|
47
48
|
|
48
|
-
class MetricAzureRMVirtualNetworkGatewayUsage < Sensu::Plugin::
|
49
|
+
class MetricAzureRMVirtualNetworkGatewayUsage < Sensu::Plugin::Metric::CLI::Statsd
|
49
50
|
include SensuPluginsAzureRM
|
50
51
|
|
51
52
|
option :tenant_id,
|
@@ -82,6 +83,11 @@ class MetricAzureRMVirtualNetworkGatewayUsage < Sensu::Plugin::Check::CLI
|
|
82
83
|
short: '-n NAME',
|
83
84
|
long: '--name NAME'
|
84
85
|
|
86
|
+
option :customScheme,
|
87
|
+
description: 'Metric naming scheme, text to prepend to .$parent.$child',
|
88
|
+
long: '--customScheme SCHEME',
|
89
|
+
default: "azurerm.virtualnetworkgateway"
|
90
|
+
|
85
91
|
def run
|
86
92
|
tenantId = config[:tenant_id]
|
87
93
|
clientId = config[:client_id]
|
@@ -100,14 +106,14 @@ class MetricAzureRMVirtualNetworkGatewayUsage < Sensu::Plugin::Check::CLI
|
|
100
106
|
outbound = result.egress_bytes_transferred
|
101
107
|
|
102
108
|
timestamp = Time.now.utc.to_i
|
103
|
-
scheme = config[:
|
109
|
+
scheme = config[:customScheme]
|
104
110
|
name = [scheme, resource_group_name, name].join('.').tr(' ', '_').tr('{}', '').tr('[]', '')
|
105
111
|
inboundName = [name, "inbound"].join('.')
|
106
112
|
outboundName = [name, "outbound"].join('.')
|
107
113
|
|
108
114
|
output inboundName, inbound, timestamp
|
109
115
|
output outboundName, outbound, timestamp
|
110
|
-
|
116
|
+
ok
|
111
117
|
rescue => e
|
112
118
|
puts "Error: exception: #{e}"
|
113
119
|
critical
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SensuPluginsAzureRM
|
2
|
+
|
3
|
+
class ServiceBusUsage
|
4
|
+
|
5
|
+
def buildServiceBusClient(tenant_id, client_id, secret, subscription_id)
|
6
|
+
token_provider = MsRestAzure::ApplicationTokenProvider.new(tenant_id, client_id, secret)
|
7
|
+
credentials = MsRest::TokenCredentials.new(token_provider)
|
8
|
+
client = Azure::ARM::ServiceBus::ServiceBusManagementClient.new(credentials)
|
9
|
+
client.subscription_id = subscription_id
|
10
|
+
|
11
|
+
usageClient = Azure::ARM::ServiceBus::Subscriptions.new(client)
|
12
|
+
usageClient
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-azurerm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: azure_mgmt_compute
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: azure_mgmt_service_bus
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.8.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: ms_rest_azure
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +212,8 @@ executables:
|
|
198
212
|
- check-azurerm-core-usage.rb
|
199
213
|
- check-azurerm-virtual-machines-usage.rb
|
200
214
|
- check-azurerm-virtual-network-gateway-connected.rb
|
215
|
+
- check-azurerm-virtual-network-gateway-failure-connected.rb
|
216
|
+
- metric-azurerm-service-bus-subscription-message-count.rb
|
201
217
|
- metric-azurerm-virtual-network-gateway-usage.rb
|
202
218
|
extensions: []
|
203
219
|
extra_rdoc_files: []
|
@@ -205,9 +221,12 @@ files:
|
|
205
221
|
- bin/check-azurerm-core-usage.rb
|
206
222
|
- bin/check-azurerm-virtual-machines-usage.rb
|
207
223
|
- bin/check-azurerm-virtual-network-gateway-connected.rb
|
224
|
+
- bin/check-azurerm-virtual-network-gateway-failure-connected.rb
|
225
|
+
- bin/metric-azurerm-service-bus-subscription-message-count.rb
|
208
226
|
- bin/metric-azurerm-virtual-network-gateway-usage.rb
|
209
227
|
- lib/sensu-plugins-azurerm/compute_usage.rb
|
210
228
|
- lib/sensu-plugins-azurerm/network_usage.rb
|
229
|
+
- lib/sensu-plugins-azurerm/servicebus_usage.rb
|
211
230
|
- lib/sensu-plugins-azurerm/version.rb
|
212
231
|
- lib/sensu-plugins-azurerm.rb
|
213
232
|
- LICENSE
|