bipbip 0.5.8 → 0.5.9

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: e26b21a257b3d7ef3f83082a9246712761ee2718
4
- data.tar.gz: 5f08b5b27ee6a5bde3667f28558ec8d950c9e398
3
+ metadata.gz: 940f0155867f0e16e1c4a7c0b7ba8b710b0a0191
4
+ data.tar.gz: ffa66de8788189c9774081d1e8a2fe63d085b071
5
5
  SHA512:
6
- metadata.gz: 793d41812612faab00f69b869154ebec729be96026d29f1e4d3f0e5df0e70d891a1f71bd764f57b216a732fdd57c5f030f4721df6ea0c4a91d645bd6b507d5f9
7
- data.tar.gz: 2e4617cd5412566ce2df94dacf6ca0669973caadb54a2ddf4dcaa07d8e6ff0a07908871c8867e6aaaa23bf2bbae11dc8b67bbf9244e443a53dcad4bb7f60497a
6
+ metadata.gz: 897fd316611fdd5a84e41299381098b099edb3a1d531a92c950a8ee74aed2352dc3dc96017d127ab700ea75119610fb16e72f79e70ba080584bb8e27b601d10a
7
+ data.tar.gz: 3258dfbf44197e4d6c49a7094396a64b9d6a826a2e794c93c7954f5ae38c23a48ec727ca9bc460dffe912872012ce004f59050cdc5afd176eacc1804766e40a2
data/README.md CHANGED
@@ -2,7 +2,6 @@ bipbip [![Build Status](https://travis-ci.org/cargomedia/bipbip.png)](https://tr
2
2
  ======
3
3
  Agent to collect server metrics and send them to the [CopperEgg RevealMetrics](http://copperegg.com/) platform.
4
4
  Plugins for different metrics available.
5
- Will spawn a child process for every plugin and server you tell it to monitor.
6
5
 
7
6
  Installation
8
7
  ------------
@@ -10,14 +9,15 @@ Installation
10
9
  gem install bipbip
11
10
  ```
12
11
 
13
- Configuration
14
- -------------
12
+ There's a [puppet module for Debian](https://github.com/cargomedia/puppet-packages/tree/master/modules/bipbip) available to install *bipbip* as a system daemon.
13
+
14
+ ### Configuration
15
15
  Pass the path to your configuration file to `bipbip` using the `-c` command line argument.
16
16
  ```sh
17
17
  bipbip -c /etc/bipbip/config.yml
18
18
  ```
19
19
 
20
- The configuration file should list the services you want to collect data for:
20
+ Example with CopperEgg as a storage and service plugins for *memcached* and *mysql* configured:
21
21
  ```yml
22
22
  logfile: /var/log/bipbip.log
23
23
  loglevel: INFO
@@ -27,7 +27,7 @@ include: services.d/
27
27
  storages:
28
28
  -
29
29
  name: copperegg
30
- api_key: YOUR_APIKEY
30
+ api_key: <YOUR_APIKEY>
31
31
 
32
32
  services:
33
33
  -
@@ -38,132 +38,73 @@ services:
38
38
  plugin: mysql
39
39
  hostname: localhost
40
40
  port: 3306
41
- username: root
42
- password: root
43
- -
44
- plugin: mongodb
45
- hostname: localhost
46
- port: 27017
47
- username:
48
- password:
49
- -
50
- plugin: redis
51
- hostname: localhost
52
- port: 6379
53
- -
54
- plugin: resque
55
- hostname: localhost
56
- port: 6379
57
- database: 10
58
- namespace: resque-prefix
59
- frequency: 60
60
- -
61
- plugin: gearman
62
- hostname: localhost
63
- port: 4730
64
- -
65
- plugin: apache2
66
- url: http://localhost:80/server-status?auto
67
- -
68
- plugin: nginx
69
- url: http://localhost:80/server-status
70
- -
71
- plugin: network
72
- -
73
- plugin: monit
74
- hostname: localhost
75
- port: 2888
76
- ssl: true
77
- auth: true
78
- username: foo
79
- password: bar
80
- -
81
- plugin: php-apc
82
- url: http://localhost:80/apc-status
83
- -
84
- plugin: fastcgi-php-fpm
85
- host: localhost
86
- port: 9000
87
- path: /fpm-status
88
- -
89
- plugin: fastcgi-php-apc
90
- host: localhost
91
- port: 9000
92
- -
93
- plugin: fastcgi-php-opcache
94
- host: localhost
95
- port: 9000
96
- -
97
- plugin: log-parser
98
- path: /var/log/syslog
99
- matchers:
100
- -
101
- name: oom_killer
102
- regexp: 'invoked oom_killer'
103
- -
104
- name: segfault
105
- regexp: segfault
106
- -
107
- plugin: postfix
108
- -
109
- plugin: elasticsearch
110
- hostname: localhost
111
- port: 9200
112
- -
113
- plugin: puppet
114
41
  ```
115
42
 
116
- Optional configuration common to all plugins:
117
- - `frequency`: Override global frequency per plugin
118
- - `metric_group`: Use metric group name different from plugin name. Useful when using the same plugin twice.
43
+ Configuration options:
44
+ - **logfile** (optional): Path to log file. If not provided will log to `STDOUT`.
45
+ - **loglevel** (optional): One of [Logger's levels](http://www.ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html). Defaults to `INFO`.
46
+ - **frequency** (optional): How often to measure metrics (in seconds). Defaults to `60`.
47
+ - **include** (optional): Optional directory where to look for *service plugin configurations* (relative to config file).
48
+ - **storage**: List of storages to send data to.
49
+ - **services**: List of service plugins from which to gather metrics.
119
50
 
120
- Include configuration
121
- ---------------------
122
- In your configuration you can specify a directory to include service configurations from:
51
+ The `include` directive allows to set a directory from which to load additional *service plugin* configurations. The above example could also be structured with multiple files:
123
52
  ```
124
- include: services.d/
53
+ .
54
+ |-- config.yml
55
+ `-- services.d
56
+ |-- memcached.yml
57
+ `-- mysql.yml
125
58
  ```
126
- This will include files from `/etc/bipbip/services.d/` and load them into the `services` configuration.
127
-
128
- You could then add a file `/etc/bipbip/services.d/memcached.yml`:
59
+ Where `memcached.yml` would contain:
129
60
  ```yml
130
61
  plugin: memcached
131
62
  hostname: localhost
132
63
  port: 11211
133
64
  ```
134
65
 
135
- Plugins
136
- -------
137
- #### fastcgi-php-fpm
138
- Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
139
-
140
- #### fastcgi-php-apc
141
- Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
142
-
143
- #### fastcgi-php-opcache
144
- Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
145
-
146
- #### php-apc
147
- To collect `APC` stats of your apache process, please install the following script.
148
-
149
- Create file `/usr/local/bin/apc-status.php` with content of `data/apc-status.php`.
150
-
151
- Create apache config `/etc/apache2/conf.d/apc-status` with content:
152
- ```
153
- Alias /apc-status /usr/local/bin/apc-status.php
154
-
155
- <Files "/usr/local/bin/apc-status.php">
156
- Order deny,allow
157
- Deny from all
158
- Allow from 127.0.0.1
159
- </Files>
160
- ```
161
-
162
- Then set the `url`-configuration for the plugin to where the script is being served, e.g. `http//localhost:80/apc-status`.
163
-
164
- Custom external plugins
165
- -----------------------
166
- Additional plugins can be created as independent gems.
66
+ The configuration for each *service plugin* is described further down.
67
+ The following options are available for all plugins:
68
+ - `frequency`: Override the global measurement frequency.
69
+ - `metric_group`: Use a metric group name different from the plugin's name. Useful when using the same plugin twice.
70
+
71
+ Storages
72
+ --------
73
+ Currently *bipbip* has only one storage available, but more could be added.
74
+
75
+ ### copperegg
76
+ Send metrics to [CopperEgg](http://copperegg.com/)'s custom metrics API (*RevealMetrics*).
77
+
78
+ Configuration options:
79
+ - **api_key**: Your API key
80
+
81
+ Service Plugins
82
+ ---------------
83
+ These service plugins ship with bipbip:
84
+ - memcached
85
+ - mysql
86
+ - mongodb
87
+ - redis
88
+ - resque
89
+ - gearman
90
+ - apache2
91
+ - nginx
92
+ - network
93
+ - monit
94
+ - php-apc
95
+ - fastcgi-php-fpm
96
+ - fastcgi-php-apc
97
+ - fastcgi-php-opcache
98
+ - log-parser
99
+ - postfix
100
+ - elasticsearch
101
+ - puppet
102
+
103
+ Please refer to [/docu/services.md](/docu/services.md) for information about the individual plugins and their configuration options.
104
+
105
+ Custom Service Plugins
106
+ ----------------------
107
+ Additional service plugins can be created as independent gems.
167
108
  They should include a class `Plugin::MyPlugin` in the `BipBip` module extending `Plugin`.
168
109
  On that class the functions `metrics_schema` and `monitor` should be implemented.
169
110
 
@@ -7,11 +7,9 @@ module Bipbip
7
7
 
8
8
  def metrics_schema
9
9
  [
10
+ {:name => 'report_ok', :type => 'gauge', :unit => 'Boolean'},
10
11
  {:name => 'last_run_total_time', :type => 'gauge', :unit => 'Seconds'},
11
12
  {: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
13
  {:name => 'events_failure_count', :type => 'gauge', :unit => 'Events'},
16
14
  {:name => 'events_success_count', :type => 'gauge', :unit => 'Events'},
17
15
  {:name => 'events_total_count', :type => 'gauge', :unit => 'Events'},
@@ -29,20 +27,30 @@ module Bipbip
29
27
  has_events = puppet_report.has_key?('events')
30
28
  has_resources = puppet_report.has_key?('resources')
31
29
  has_changes = puppet_report.has_key?('changes')
32
- {
30
+
31
+ metrics = {
32
+ 'report_ok' => ((has_events and has_changes and has_resources) ? 1 : 0),
33
33
  'last_run_total_time' => puppet_report['time']['total'].to_i,
34
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
35
  }
36
+
37
+ if has_events
38
+ metrics['events_failure_count'] = puppet_report['events']['failure'].to_i
39
+ metrics['events_success_count'] = puppet_report['events']['success'].to_i
40
+ metrics['events_total_count'] = puppet_report['events']['total'].to_i
41
+ end
42
+
43
+ if has_resources
44
+ metrics['resources_failed_count'] = puppet_report['resources']['failed'].to_i
45
+ metrics['resources_skipped_count'] = puppet_report['resources']['skipped'].to_i
46
+ metrics['resources_total_count'] = puppet_report['resources']['total'].to_i
47
+ end
48
+
49
+ if has_changes
50
+ metrics['changes_total_count'] = puppet_report['changes']['total'].to_i
51
+ end
52
+
53
+ metrics
46
54
  end
47
55
 
48
56
  private
@@ -40,7 +40,10 @@ module Bipbip
40
40
  end
41
41
 
42
42
  def store_sample(plugin, time, data)
43
- CopperEgg::MetricSample.save(plugin.metric_group, plugin.source_identifier, time.to_i, data)
43
+ response = CopperEgg::MetricSample.save(plugin.metric_group, plugin.source_identifier, time.to_i, data)
44
+ if response.code != '200'
45
+ raise("Cannot store copperegg data `#{data}`. Response code `#{response.code}`, message `#{response.message}`, body `#{response.body}`")
46
+ end
44
47
  end
45
48
 
46
49
  def _load_metric_groups
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.5.8'
2
+ VERSION = '0.5.9'
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.8
4
+ version: 0.5.9
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: 2015-01-09 00:00:00.000000000 Z
13
+ date: 2015-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg