bipbip 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 922affca778aa4d53f2fd5cdebdeb4ab2e1dc5a1
4
- data.tar.gz: 834ae255344d30bb0dc5787e5d08a42d38a9cecb
3
+ metadata.gz: ad4fe3a851921fecf24d890c040af2376a508c78
4
+ data.tar.gz: ac88266357b7de5fbbf9b3b10e7d16978c9d4344
5
5
  SHA512:
6
- metadata.gz: 08f62601629c3face8e76a0e0da151c94599d322d68e5d0ea011ba169409f8dad873c19b5e7c2cf4ffc5c6427d0a9ae8c446dd0008f0bbe2561936f4a5502bff
7
- data.tar.gz: 944e0e4d1707a0a85ecaf6689acb67e73d3641b522678e9b11f7bca30f87d5cdc755b87de21d771c1635a21064d5766dfacb284af18efff4fdb0554e372cfe01
6
+ metadata.gz: 888a6fe166a1510aff11d01dc07015c941e13e31ea7ee2f8eceecd8fc164541a7c9725142c65e405f67ab3121420bda120a66ad4939179e5d49566468037e13d
7
+ data.tar.gz: f1228a44a6b49d046c590bec5a79409b9e6fdcf3823b12a41d4b6cb1b88e01131288942b73be6fd9f3458b2bbdc455c03beb139241187a3ff13d4c62b50fbc47
data/README.md CHANGED
@@ -52,6 +52,11 @@ services:
52
52
  -
53
53
  plugin: nginx
54
54
  url: http://localhost:80/server-status
55
+ -
56
+ plugin: network
57
+ -
58
+ plugin: php-apc
59
+ url: http://localhost:80/apc-status
55
60
  ```
56
61
 
57
62
  Include configuration
@@ -68,3 +73,34 @@ plugin: memcached
68
73
  hostname: localhost
69
74
  port: 11211
70
75
  ```
76
+
77
+ Plugins
78
+ ----------------------------
79
+ #### php-apc
80
+ To collect `APC` stats of your apache process, please install the following script.
81
+
82
+ Create file `/usr/local/bin/apc-status.php` with content:
83
+ ```php
84
+ <?php
85
+
86
+ $infoOpcode = @apc_cache_info('opcode', true);
87
+ $infoUser = @apc_cache_info('user', true);
88
+
89
+ echo json_encode(array(
90
+ 'opcode_mem_size' => (int) $infoOpcode['mem_size'],
91
+ 'user_mem_size' => (int) $infoUser['mem_size'],
92
+ ));
93
+ ```
94
+
95
+ Create apache config `/etc/apache2/conf.d/apc-status` with content:
96
+ ```
97
+ Alias /apc-status /usr/local/bin/apc-status.php
98
+
99
+ <Files "/usr/local/bin/apc-status.php">
100
+ Order deny,allow
101
+ Deny from all
102
+ Allow from all
103
+ </Files>
104
+ ```
105
+
106
+ Then set the `url`-configuration for the plugin to where the script is being served, e.g. `http//localhost:80/apc-status`.
@@ -3,6 +3,7 @@ module Bipbip
3
3
 
4
4
  require 'copperegg'
5
5
  require 'yaml'
6
+ require 'json'
6
7
  require 'logger'
7
8
  require 'socket'
8
9
 
@@ -0,0 +1,16 @@
1
+ module Bipbip
2
+
3
+ class Plugin::Network < Plugin
4
+
5
+ def metrics_schema
6
+ [
7
+ {:name => 'connections_total', :type => 'ce_gauge', :unit => 'Connections'},
8
+ ]
9
+ end
10
+
11
+ def monitor(server)
12
+ connections = `netstat -tn | wc -l`
13
+ {:connections_total => connections.to_i}
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module Bipbip
2
+
3
+ class Plugin::PhpApc < Plugin
4
+
5
+ def metrics_schema
6
+ [
7
+ {:name => 'opcode_mem_size', :type => 'ce_gauge', :unit => 'b'},
8
+ {:name => 'user_mem_size', :type => 'ce_gauge', :unit => 'b'},
9
+ ]
10
+ end
11
+
12
+ def monitor(server)
13
+ uri = URI.parse(server['url'])
14
+ response = Net::HTTP.get_response(uri)
15
+
16
+ raise "Invalid response from server at #{server['url']}" unless response.code == '200'
17
+
18
+ stats = JSON.parse(response.body)
19
+
20
+ {:opcode_mem_size => stats['opcode_mem_size'].to_i, :user_mem_size => stats['user_mem_size'].to_i}
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.6'
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.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
@@ -93,11 +93,12 @@ files:
93
93
  - lib/bipbip/agent.rb
94
94
  - lib/bipbip/interruptible_sleep.rb
95
95
  - lib/bipbip/plugin/apache2.rb
96
- - lib/bipbip/plugin/foo_bar.rb
97
96
  - lib/bipbip/plugin/gearman.rb
98
97
  - lib/bipbip/plugin/memcached.rb
99
98
  - lib/bipbip/plugin/mysql.rb
99
+ - lib/bipbip/plugin/network.rb
100
100
  - lib/bipbip/plugin/nginx.rb
101
+ - lib/bipbip/plugin/php_apc.rb
101
102
  - lib/bipbip/plugin/redis.rb
102
103
  - lib/bipbip/plugin.rb
103
104
  - lib/bipbip/version.rb
@@ -1,30 +0,0 @@
1
- require 'memcached'
2
- class MemcachedClient < Memcached
3
- end
4
-
5
- module Bipbip
6
-
7
- class Plugin::FooBar < Plugin
8
-
9
- def metrics_schema
10
- [
11
- {:name => 'cmd_get', :type => 'ce_counter'},
12
- {:name => 'cmd_set', :type => 'ce_counter'},
13
- {:name => 'get_misses', :type => 'ce_counter'},
14
- {:name => 'limit_maxbytes', :type => 'ce_gauge', :unit => 'b'},
15
- {:name => 'bytes', :type => 'ce_gauge', :unit => 'b'},
16
- ]
17
- end
18
-
19
- def monitor(server)
20
- cache = MemcachedClient.new(server['hostname'] + ':' + server['port'].to_s)
21
- stats = cache.stats
22
-
23
- data = {}
24
- metrics_names.each do |key|
25
- data[key] = stats[key.to_sym].shift.to_i
26
- end
27
- data
28
- end
29
- end
30
- end