bipbip 0.5.7 → 0.5.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6df09181ec6c186c6ad5439fce1950ee22a1ceef
4
- data.tar.gz: 94c9bec470780f0528443c9161e64327d1a0d42c
3
+ metadata.gz: e26b21a257b3d7ef3f83082a9246712761ee2718
4
+ data.tar.gz: 5f08b5b27ee6a5bde3667f28558ec8d950c9e398
5
5
  SHA512:
6
- metadata.gz: abbbce685a4daa4dce6ac52220f2540c2fe9a129e0053e1df6294cdbeb2d92e0022ce26f727252880075aa06fb153a9c0d43ec6caad66e131d1d0dc611685fd9
7
- data.tar.gz: 0f71f71ef294a6724ad44dde82694d12e84c7e51c2e64d6c8e55f07b4a433b482e640bf2b458bf5b4441061bd4563bd21846a3bc67790905dfdacf6436312d65
6
+ metadata.gz: 793d41812612faab00f69b869154ebec729be96026d29f1e4d3f0e5df0e70d891a1f71bd764f57b216a732fdd57c5f030f4721df6ea0c4a91d645bd6b507d5f9
7
+ data.tar.gz: 2e4617cd5412566ce2df94dacf6ca0669973caadb54a2ddf4dcaa07d8e6ff0a07908871c8867e6aaaa23bf2bbae11dc8b67bbf9244e443a53dcad4bb7f60497a
data/README.md CHANGED
@@ -109,6 +109,8 @@ services:
109
109
  plugin: elasticsearch
110
110
  hostname: localhost
111
111
  port: 9200
112
+ -
113
+ plugin: puppet
112
114
  ```
113
115
 
114
116
  Optional configuration common to all plugins:
@@ -0,0 +1,54 @@
1
+ require 'pathname'
2
+ require 'yaml'
3
+
4
+ module Bipbip
5
+
6
+ class Plugin::Puppet < Plugin
7
+
8
+ def metrics_schema
9
+ [
10
+ {:name => 'last_run_total_time', :type => 'gauge', :unit => 'Seconds'},
11
+ {:name => 'last_run_age', :type => 'gauge', :unit => 'Seconds'},
12
+ {:name => 'has_event', :type => 'gauge', :unit => 'Boolean'},
13
+ {:name => 'has_resources', :type => 'gauge', :unit => 'Boolean'},
14
+ {:name => 'has_changes', :type => 'gauge', :unit => 'Boolean'},
15
+ {:name => 'events_failure_count', :type => 'gauge', :unit => 'Events'},
16
+ {:name => 'events_success_count', :type => 'gauge', :unit => 'Events'},
17
+ {:name => 'events_total_count', :type => 'gauge', :unit => 'Events'},
18
+ {:name => 'resources_failed_count', :type => 'gauge', :unit => 'Resources'},
19
+ {:name => 'resources_skipped_count', :type => 'gauge', :unit => 'Resources'},
20
+ {:name => 'resources_total_count', :type => 'gauge', :unit => 'Resources'},
21
+ {:name => 'changes_total_count', :type => 'gauge', :unit => 'Changes'},
22
+ ]
23
+ end
24
+
25
+ def monitor
26
+ puppet_report = last_run_summary
27
+
28
+ report_age = Time.new.to_i - puppet_report['time']['last_run'].to_i
29
+ has_events = puppet_report.has_key?('events')
30
+ has_resources = puppet_report.has_key?('resources')
31
+ has_changes = puppet_report.has_key?('changes')
32
+ {
33
+ 'last_run_total_time' => puppet_report['time']['total'].to_i,
34
+ 'last_run_age' => report_age,
35
+ 'has_events' => has_events,
36
+ 'has_resources' => has_resources,
37
+ 'has_changes' => has_resources,
38
+ 'events_failure_count' => (has_events ? puppet_report['events']['failure'].to_i : 0),
39
+ 'events_success_count' => (has_events ? puppet_report['events']['success'].to_i : 0),
40
+ 'events_total_count' => (has_events ? puppet_report['events']['total'].to_i : 0),
41
+ 'resources_failed_count' => (has_resources ? puppet_report['resources']['failed'].to_i : 0),
42
+ 'resources_skipped_count' => (has_resources ? puppet_report['resources']['skipped'].to_i : 0),
43
+ 'resources_total_count' => (has_resources ? puppet_report['resources']['total'].to_i : 0),
44
+ 'changes_total_count' => (has_changes ? puppet_report['changes']['total'].to_i : 0),
45
+ }
46
+ end
47
+
48
+ private
49
+
50
+ def last_run_summary
51
+ YAML.load_file(Pathname.new('/var/lib/puppet/state/last_run_summary.yaml'))
52
+ end
53
+ end
54
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.5.7'
2
+ VERSION = '0.5.8'
3
3
  end
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.5.7
4
+ version: 0.5.8
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: 2014-12-17 00:00:00.000000000 Z
13
+ date: 2015-01-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg
@@ -239,6 +239,7 @@ files:
239
239
  - lib/bipbip/plugin/nginx.rb
240
240
  - lib/bipbip/plugin/php_apc.rb
241
241
  - lib/bipbip/plugin/postfix.rb
242
+ - lib/bipbip/plugin/puppet.rb
242
243
  - lib/bipbip/plugin/redis.rb
243
244
  - lib/bipbip/plugin/resque.rb
244
245
  - lib/bipbip/storage.rb
@@ -265,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
266
  version: '0'
266
267
  requirements: []
267
268
  rubyforge_project:
268
- rubygems_version: 2.4.2
269
+ rubygems_version: 2.4.5
269
270
  signing_key:
270
271
  specification_version: 4
271
272
  summary: Gather services data and store in CopperEgg