sensu-plugins-ubiquiti 0.0.1 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +20 -2
- data/README.md +2 -3
- data/bin/metrics-unifi.rb +26 -13
- data/lib/sensu-plugins-ubiquiti/version.rb +2 -2
- metadata +27 -36
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/bin/unifi-get-stats.py +0 -35
- metadata.gz.sig +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 055416821c4ca116d381c700af7491647c443524
|
4
|
+
data.tar.gz: 2112252bfdc21a0b006c4d68369cf47925322202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32889c62501ac21086e2c60b37475f1b67f5469352a04444825c379f6ec011d05dc69b8f0b3ef6c9b34d3ab952a6ea61db0cf62136c0857d653d9035d95e75af
|
7
|
+
data.tar.gz: 7081a3acf99e062d8c6c649b05b21b7bbb434f1b05f81edb6ae9140a2f7fb8d9ab4a7ad70908f7315ae12278e7e8ecdaebd633da539195a9b2f9ec57d8b2bf2c
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,26 @@ 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
|
-
## Unreleased
|
6
|
+
## [Unreleased]
|
7
|
+
|
8
|
+
## [1.0.0] - 2016-10-21
|
9
|
+
|
10
|
+
Note: this release changes the check parameters due to removing the shell out to `unifi-get-stats.py`.
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Use `unifi-api` gem instead of shelling out to unifi-get-stats.py script
|
14
|
+
- Update to Rubocop 0.40 and cleanup
|
7
15
|
|
8
|
-
|
16
|
+
### Added
|
17
|
+
- Add Ruby 2.3.0 support
|
18
|
+
|
19
|
+
### Removed
|
20
|
+
- Remove Ruby 1.9.3 support
|
21
|
+
- Remove unused unifi-get-stats.py script
|
22
|
+
|
23
|
+
## [0.0.1] - 2015-08-24
|
9
24
|
### Added
|
10
25
|
- initial release of this sensu plugin repo
|
26
|
+
|
27
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-ubiquiti/compare/1.0.0...HEAD
|
28
|
+
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-ubiquiti/compare/0.0.1...1.0.0
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
## Sensu-Plugins-ubiquiti
|
2
|
-
[
|
2
|
+
[](https://travis-ci.org/sensu-plugins/sensu-plugins-ubiquiti)
|
3
3
|
[](http://badge.fury.io/rb/sensu-plugins-ubiquiti)
|
4
4
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ubiquiti)
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ubiquiti)
|
6
6
|
[](https://gemnasium.com/sensu-plugins/sensu-plugins-ubiquiti)
|
7
|
-
|
7
|
+
|
8
8
|
## Functionality
|
9
9
|
|
10
10
|
**metrics-unifi.rb**
|
@@ -13,7 +13,6 @@ Polls metrics from Ubiquiti Networks Unifi wireless controllers
|
|
13
13
|
|
14
14
|
## Files
|
15
15
|
* bin/metrics-unifi.rb
|
16
|
-
* bin/unifi-get-stats.py
|
17
16
|
|
18
17
|
## Installation
|
19
18
|
|
data/bin/metrics-unifi.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# gem: sensu-plugin
|
16
16
|
#
|
17
17
|
# USAGE:
|
18
|
-
# metrics-unifi.rb -c unifi.int.mycompany.co -
|
18
|
+
# metrics-unifi.rb -c unifi.int.mycompany.co -u admin -p unifipassword
|
19
19
|
#
|
20
20
|
# NOTES:
|
21
21
|
#
|
@@ -27,9 +27,8 @@
|
|
27
27
|
#
|
28
28
|
|
29
29
|
require 'sensu-plugin/metric/cli'
|
30
|
-
require 'open3'
|
31
30
|
require 'socket'
|
32
|
-
require '
|
31
|
+
require 'unifi/api'
|
33
32
|
|
34
33
|
# Collect unifi metrics
|
35
34
|
class UnifiMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
@@ -57,21 +56,35 @@ class UnifiMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
57
56
|
long: '--password PASSWORD',
|
58
57
|
required: true
|
59
58
|
|
60
|
-
option :
|
61
|
-
description: '
|
62
|
-
short: '-
|
63
|
-
|
59
|
+
option :port,
|
60
|
+
description: 'Port',
|
61
|
+
short: '-P PORT',
|
62
|
+
long: '--port PORT',
|
63
|
+
default: 8443
|
64
|
+
|
65
|
+
option :unifi_version,
|
66
|
+
description: 'Unifi API version',
|
67
|
+
short: '-V VERSION',
|
68
|
+
long: '--unifi-version VERSION',
|
69
|
+
default: 'v4'
|
64
70
|
|
65
71
|
def unifi_stats
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
unifi = Unifi::Api::Controller.new(config[:controller], config[:username], config[:password], config[:port], config[:unifi_version])
|
73
|
+
aps = unifi.get_aps
|
74
|
+
|
75
|
+
metrics = Hash.new(0)
|
76
|
+
|
77
|
+
aps.each do |ap|
|
78
|
+
metrics['total'] += ap['num_sta']
|
79
|
+
metrics['guests'] += ap['guest-num_sta']
|
80
|
+
metrics['users'] += ap['user-num_sta']
|
81
|
+
end
|
82
|
+
|
83
|
+
metrics
|
70
84
|
end
|
71
85
|
|
72
86
|
def run
|
73
|
-
|
74
|
-
stats.each do |metric, value|
|
87
|
+
unifi_stats.each do |metric, value|
|
75
88
|
output "#{config[:scheme]}.#{metric}", value
|
76
89
|
end
|
77
90
|
ok
|
metadata
CHANGED
@@ -1,51 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-ubiquiti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
|
14
|
-
am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
|
15
|
-
A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
|
16
|
-
CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
|
17
|
-
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
|
18
|
-
CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
|
19
|
-
zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
|
20
|
-
qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
|
21
|
-
k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
|
22
|
-
oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
|
23
|
-
0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
24
|
-
HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
|
25
|
-
QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
|
26
|
-
MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
|
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-08-27 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
34
12
|
dependencies:
|
35
13
|
- !ruby/object:Gem::Dependency
|
36
14
|
name: sensu-plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: unifi-api
|
37
29
|
requirement: !ruby/object:Gem::Requirement
|
38
30
|
requirements:
|
39
31
|
- - '='
|
40
32
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
33
|
+
version: 0.1.1
|
42
34
|
type: :runtime
|
43
35
|
prerelease: false
|
44
36
|
version_requirements: !ruby/object:Gem::Requirement
|
45
37
|
requirements:
|
46
38
|
- - '='
|
47
39
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
40
|
+
version: 0.1.1
|
49
41
|
- !ruby/object:Gem::Dependency
|
50
42
|
name: bundler
|
51
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,16 +140,16 @@ dependencies:
|
|
148
140
|
name: rubocop
|
149
141
|
requirement: !ruby/object:Gem::Requirement
|
150
142
|
requirements:
|
151
|
-
- -
|
143
|
+
- - "~>"
|
152
144
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.
|
145
|
+
version: 0.40.0
|
154
146
|
type: :development
|
155
147
|
prerelease: false
|
156
148
|
version_requirements: !ruby/object:Gem::Requirement
|
157
149
|
requirements:
|
158
|
-
- -
|
150
|
+
- - "~>"
|
159
151
|
- !ruby/object:Gem::Version
|
160
|
-
version: 0.
|
152
|
+
version: 0.40.0
|
161
153
|
- !ruby/object:Gem::Dependency
|
162
154
|
name: yard
|
163
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +165,7 @@ dependencies:
|
|
173
165
|
- !ruby/object:Gem::Version
|
174
166
|
version: '0.8'
|
175
167
|
description: Sensu plugins for Ubiquiti network equipment
|
176
|
-
email: "<sensu-users@
|
168
|
+
email: "<sensu-users@googlegroups.com>"
|
177
169
|
executables:
|
178
170
|
- metrics-unifi.rb
|
179
171
|
extensions: []
|
@@ -183,14 +175,13 @@ files:
|
|
183
175
|
- LICENSE
|
184
176
|
- README.md
|
185
177
|
- bin/metrics-unifi.rb
|
186
|
-
- bin/unifi-get-stats.py
|
187
178
|
- lib/sensu-plugins-ubiquiti.rb
|
188
179
|
- lib/sensu-plugins-ubiquiti/version.rb
|
189
180
|
homepage: https://github.com/sensu-plugins/sensu-plugins-ubiquiti
|
190
181
|
licenses:
|
191
182
|
- MIT
|
192
183
|
metadata:
|
193
|
-
maintainer:
|
184
|
+
maintainer: sensu-plugin
|
194
185
|
development_status: active
|
195
186
|
production_status: unstable - testing recommended
|
196
187
|
release_draft: 'false'
|
@@ -204,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
195
|
requirements:
|
205
196
|
- - ">="
|
206
197
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
198
|
+
version: 2.0.0
|
208
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
200
|
requirements:
|
210
201
|
- - ">="
|
@@ -212,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
203
|
version: '0'
|
213
204
|
requirements: []
|
214
205
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.5.1
|
216
207
|
signing_key:
|
217
208
|
specification_version: 4
|
218
209
|
summary: Sensu plugins for Ubiquiti network equipment
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
Binary file
|
data/bin/unifi-get-stats.py
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
#
|
3
|
-
# Get stats from a Unifi AP controller using the API
|
4
|
-
#
|
5
|
-
# Requires the unifi python module
|
6
|
-
#
|
7
|
-
|
8
|
-
import argparse
|
9
|
-
import json
|
10
|
-
|
11
|
-
from unifi.controller import Controller
|
12
|
-
|
13
|
-
parser = argparse.ArgumentParser()
|
14
|
-
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")')
|
15
|
-
parser.add_argument('-u', '--username', default='admin', help='the controller username (default("admin")')
|
16
|
-
parser.add_argument('-p', '--password', default='', help='the controller password')
|
17
|
-
parser.add_argument('-b', '--port', default='8443', help='the controller port (default "8443")')
|
18
|
-
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")')
|
19
|
-
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")')
|
20
|
-
args = parser.parse_args()
|
21
|
-
|
22
|
-
c = Controller(args.controller, args.username, args.password, args.port, args.version, args.siteid)
|
23
|
-
|
24
|
-
aps = c.get_aps()
|
25
|
-
|
26
|
-
total = guests = users = 0
|
27
|
-
|
28
|
-
for ap in aps:
|
29
|
-
total += ap['num_sta']
|
30
|
-
guests += ap['guest-num_sta']
|
31
|
-
users += ap['user-num_sta']
|
32
|
-
|
33
|
-
stats = {'total': total, 'guests': guests, 'users': users}
|
34
|
-
|
35
|
-
print json.dumps(stats)
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
jd�m�so�ҥK�t"F�1�� 7n#��<�7y�ֿ�HtG����2W4�n �. J�m7Ě��3>�P�+�������T��ϛ(?`�xp�Ũ����6G+�Ū��M0��%�뭢f�a�T���"��!���tCQ���'Y���EL�T}�ˑۮ赙!*ɞ�uTO+��pDi�E�H��C��"-�w�����)-\9���(6��F�����~P�`�`�٩ޅ:]"�Y���d@Y�,_/�U|���C�
|