bipbip 0.6.26 → 0.7.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/README.md +21 -3
- data/lib/bipbip/plugin/systemd_unit.rb +33 -0
- data/lib/bipbip/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436bc1ec392848211e79aba9a156284d903be547
|
4
|
+
data.tar.gz: 1bfa5a196a6a99ad48ad4479ca314bd3d0be2cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c4bbad7fa06b9596f13455041cf72715aa132387da035a52f365861df1e6f4e45ac2bf8dfd27edf2f210711cf951fc1cc1509bb34dced357a045b2429ea3ae4
|
7
|
+
data.tar.gz: a5da06cb2af26c0e09ee4decec9ac45bf15d4bdb89565e5205d95584eb9414877a9906a1af37de755f2867e99cb813da4a80c7e1cba0cec564cbb1b765c57906
|
data/README.md
CHANGED
@@ -109,6 +109,7 @@ These service plugins ship with bipbip:
|
|
109
109
|
- command
|
110
110
|
- socket-redis
|
111
111
|
- coturn
|
112
|
+
- systemd-unit
|
112
113
|
|
113
114
|
Please refer to [/docu/services.md](/docu/services.md) for information about the individual plugins and their configuration options.
|
114
115
|
|
@@ -122,13 +123,30 @@ For a complete example see [cargomedia/bipbip-random-example](https://github.com
|
|
122
123
|
|
123
124
|
Development
|
124
125
|
-----------
|
125
|
-
|
126
|
+
|
127
|
+
Install dependencies:
|
128
|
+
```
|
129
|
+
bundle install
|
130
|
+
```
|
131
|
+
|
132
|
+
Run tests:
|
133
|
+
```
|
134
|
+
bundle exec spec
|
135
|
+
```
|
136
|
+
|
137
|
+
There's also a **Vagrant environment** available with necessary dependencies pre-installed.
|
138
|
+
To use it, launch a box:
|
126
139
|
```
|
127
140
|
vagrant up
|
128
141
|
vagrant ssh
|
129
142
|
```
|
130
|
-
|
131
|
-
You can then run `bipbip` from within the mounted projected root directory:
|
143
|
+
Then run the `bipbip` binary inside:
|
132
144
|
```
|
133
145
|
/vagrant/bin/bipbip
|
134
146
|
```
|
147
|
+
|
148
|
+
Release a new version:
|
149
|
+
|
150
|
+
1. Bump the version in `lib/bipbip/version.rb`, merge to master.
|
151
|
+
2. Push a new tag to master.
|
152
|
+
3. Release to RubyGems with `bundle exec rake release`.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'komenda'
|
4
|
+
|
5
|
+
module Bipbip
|
6
|
+
class Plugin::SystemdUnit < Plugin
|
7
|
+
def metrics_schema
|
8
|
+
[
|
9
|
+
{ name: 'all_units_running', type: 'gauge', unit: 'Boolean' }
|
10
|
+
]
|
11
|
+
end
|
12
|
+
|
13
|
+
def monitor
|
14
|
+
main_unit = config['unit_name']
|
15
|
+
{ 'all_units_running' => unit_dependencies(main_unit).all? { |unit| unit_is_active(unit) } ? 1 : 0 }
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param [String] main_unit
|
19
|
+
# @return [Array<String>]
|
20
|
+
def unit_dependencies(main_unit)
|
21
|
+
result = Komenda.run(['systemctl', 'list-dependencies', '--plain', '--full', main_unit], fail_on_fail: true)
|
22
|
+
result.stdout.lines.map do |line|
|
23
|
+
line.strip.gsub(/^● /, '')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] unit
|
28
|
+
# @return [TrueClass, FalseClass]
|
29
|
+
def unit_is_active(unit)
|
30
|
+
Komenda.run(['systemctl', 'is-active', unit]).success?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/bipbip/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bipbip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cargo Media
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-08-
|
13
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: copperegg-revealmetrics
|
@@ -208,6 +208,20 @@ dependencies:
|
|
208
208
|
- - "~>"
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: 1.0.8
|
211
|
+
- !ruby/object:Gem::Dependency
|
212
|
+
name: komenda
|
213
|
+
requirement: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - "~>"
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: 0.1.6
|
218
|
+
type: :runtime
|
219
|
+
prerelease: false
|
220
|
+
version_requirements: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - "~>"
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: 0.1.6
|
211
225
|
- !ruby/object:Gem::Dependency
|
212
226
|
name: rake
|
213
227
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,6 +318,7 @@ files:
|
|
304
318
|
- lib/bipbip/plugin/redis.rb
|
305
319
|
- lib/bipbip/plugin/resque.rb
|
306
320
|
- lib/bipbip/plugin/socket_redis.rb
|
321
|
+
- lib/bipbip/plugin/systemd_unit.rb
|
307
322
|
- lib/bipbip/storage.rb
|
308
323
|
- lib/bipbip/storage/copperegg.rb
|
309
324
|
- lib/bipbip/version.rb
|
@@ -328,7 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
343
|
version: '0'
|
329
344
|
requirements: []
|
330
345
|
rubyforge_project:
|
331
|
-
rubygems_version: 2.
|
346
|
+
rubygems_version: 2.5.0
|
332
347
|
signing_key:
|
333
348
|
specification_version: 4
|
334
349
|
summary: Gather services data and store in CopperEgg
|