sensu-plugins-network-checks 0.0.1.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +2 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE +22 -0
- data/README.md +71 -0
- data/bin/check-banner.rb +88 -0
- data/bin/check-multicast-groups.rb +77 -0
- data/bin/check-netstat-tcp.rb +128 -0
- data/bin/check-ping.rb +105 -0
- data/bin/check-ports.rb +91 -0
- data/bin/check-rbl.rb +102 -0
- data/bin/metrics-interface.rb +83 -0
- data/bin/metrics-net.rb +92 -0
- data/bin/metrics-netif.rb +55 -0
- data/bin/metrics-netstat-tcp.rb +110 -0
- data/bin/metrics-sockstat.rb +75 -0
- data/lib/sensu-plugins-network-checks.rb +7 -0
- metadata +287 -0
- metadata.gz.sig +2 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# metrics-sockstat
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This metric check parses /proc/net/sockstat and outputs all fields as metrics
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# graphite metric data
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# None
|
16
|
+
#
|
17
|
+
# USAGE:
|
18
|
+
# Specify [-s|--scheme] SCHEME to change the text appended to the metric paths.
|
19
|
+
#
|
20
|
+
# NOTES:
|
21
|
+
# It outputs the value in the first line ("sockets used") as SCHEME.total_used.
|
22
|
+
# All other fields are output as SCHEME.type.field, i.e., SCHEME.TCP.inuse, SCHEME.UDP.mem
|
23
|
+
#
|
24
|
+
# LICENSE:
|
25
|
+
# Copyright 2015 Contegix, LLC.
|
26
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE for details.
|
27
|
+
#
|
28
|
+
require 'sensu-plugin/metric/cli'
|
29
|
+
|
30
|
+
# MetricsSockstat
|
31
|
+
class MetricsSockstat < Sensu::Plugin::Metric::CLI::Graphite
|
32
|
+
option :scheme,
|
33
|
+
description: 'Metric naming scheme, text to prepend to $protocol.$field',
|
34
|
+
long: '--scheme SCHEME',
|
35
|
+
short: '-s SCHEME',
|
36
|
+
default: 'network.sockets'
|
37
|
+
|
38
|
+
def output_metric(name, value)
|
39
|
+
output "#{@config[:scheme]}.#{name} #{value} #{@timestamp}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def socket_metrics(fields)
|
43
|
+
name = 'total_used'
|
44
|
+
value = fields[2]
|
45
|
+
output_metric(name, value)
|
46
|
+
end
|
47
|
+
|
48
|
+
def generic_metrics(fields)
|
49
|
+
proto = fields[0].sub(':', '')
|
50
|
+
fields[1..-1].join(' ').scan(/([A-Za-z]+) (\d+)/).each do |tuple|
|
51
|
+
output_metric("#{proto}.#{tuple[0]}", tuple[1])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def read_sockstat
|
56
|
+
return IO.read('/proc/net/sockstat')
|
57
|
+
rescue => e
|
58
|
+
unknown "Failed to read /proc/net/sockstat: #{e}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def run
|
62
|
+
sockstat = read_sockstat
|
63
|
+
@config = config
|
64
|
+
@timestamp = Time.now.to_i
|
65
|
+
sockstat.split("\n").each do |line|
|
66
|
+
fields = line.split
|
67
|
+
if fields[0] == 'sockets:'
|
68
|
+
socket_metrics(fields)
|
69
|
+
elsif fields.length > 1
|
70
|
+
generic_metrics(fields)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
ok
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sensu-plugins-network-checks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yieldbot, Inc. and contributors
|
8
|
+
autorequire:
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YYoY1VHPNEcH5qPIApmHO8
|
27
|
+
rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
|
28
|
+
UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
|
29
|
+
JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
|
30
|
+
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
|
+
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: sensu-plugin
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
type: :runtime
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: dnsbl-client
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: timeout
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: json
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
type: :runtime
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: net
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
type: :runtime
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: codeclimate-test-reporter
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: rubocop
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.17.0
|
126
|
+
type: :development
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.17.0
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: rspec
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.1'
|
140
|
+
type: :development
|
141
|
+
prerelease: false
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '3.1'
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: bundler
|
149
|
+
requirement: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '1.7'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '1.7'
|
161
|
+
- !ruby/object:Gem::Dependency
|
162
|
+
name: rake
|
163
|
+
requirement: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '10.0'
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - "~>"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '10.0'
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: github-markup
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '1.3'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '1.3'
|
189
|
+
- !ruby/object:Gem::Dependency
|
190
|
+
name: redcarpet
|
191
|
+
requirement: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '3.2'
|
196
|
+
type: :development
|
197
|
+
prerelease: false
|
198
|
+
version_requirements: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - "~>"
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '3.2'
|
203
|
+
- !ruby/object:Gem::Dependency
|
204
|
+
name: yard
|
205
|
+
requirement: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0.8'
|
210
|
+
type: :development
|
211
|
+
prerelease: false
|
212
|
+
version_requirements: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - "~>"
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0.8'
|
217
|
+
- !ruby/object:Gem::Dependency
|
218
|
+
name: pry
|
219
|
+
requirement: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - "~>"
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0.10'
|
224
|
+
type: :development
|
225
|
+
prerelease: false
|
226
|
+
version_requirements: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - "~>"
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0.10'
|
231
|
+
description: ''
|
232
|
+
email: "<sensu-users@googlegroups.com>"
|
233
|
+
executables:
|
234
|
+
- check-banner.rb
|
235
|
+
- check-multicast-groups.rb
|
236
|
+
- check-netstat-tcp.rb
|
237
|
+
- check-ping.rb
|
238
|
+
- check-ports.rb
|
239
|
+
- check-rbl.rb
|
240
|
+
- metrics-interface.rb
|
241
|
+
- metrics-net.rb
|
242
|
+
- metrics-netif.rb
|
243
|
+
- metrics-netstat-tcp.rb
|
244
|
+
- metrics-sockstat.rb
|
245
|
+
extensions: []
|
246
|
+
extra_rdoc_files: []
|
247
|
+
files:
|
248
|
+
- CHANGELOG.md
|
249
|
+
- LICENSE
|
250
|
+
- README.md
|
251
|
+
- bin/check-banner.rb
|
252
|
+
- bin/check-multicast-groups.rb
|
253
|
+
- bin/check-netstat-tcp.rb
|
254
|
+
- bin/check-ping.rb
|
255
|
+
- bin/check-ports.rb
|
256
|
+
- bin/check-rbl.rb
|
257
|
+
- bin/metrics-interface.rb
|
258
|
+
- bin/metrics-net.rb
|
259
|
+
- bin/metrics-netif.rb
|
260
|
+
- bin/metrics-netstat-tcp.rb
|
261
|
+
- bin/metrics-sockstat.rb
|
262
|
+
- lib/sensu-plugins-network-checks.rb
|
263
|
+
homepage: https://github.com/sensu-plugins/sensu-plugins-network-checks
|
264
|
+
licenses:
|
265
|
+
- MIT
|
266
|
+
metadata: {}
|
267
|
+
post_install_message:
|
268
|
+
rdoc_options: []
|
269
|
+
require_paths:
|
270
|
+
- lib
|
271
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
272
|
+
requirements:
|
273
|
+
- - ">="
|
274
|
+
- !ruby/object:Gem::Version
|
275
|
+
version: 1.9.3
|
276
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - ">"
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: 1.3.1
|
281
|
+
requirements: []
|
282
|
+
rubyforge_project:
|
283
|
+
rubygems_version: 2.2.2
|
284
|
+
signing_key:
|
285
|
+
specification_version: 4
|
286
|
+
summary: ''
|
287
|
+
test_files: []
|
metadata.gz.sig
ADDED