bipbip 0.6.21 → 0.6.22

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: 174da8347786e9ab567f19333462144d97633d37
4
- data.tar.gz: 3685e0304414384b269df248643fc8c644eb0487
3
+ metadata.gz: f33e545c81e128bad9a19a2700b5a7b91ff6183e
4
+ data.tar.gz: d5a950064107b491a79d897599a396c7582a0b8e
5
5
  SHA512:
6
- metadata.gz: 62c40d66098b521c5ef5f5611cd961c0cc200c732215d111ef995784814814093a921ba73075fc57e5e79a6926d1a0adb9605b9ab9320c61074261a1224c00df
7
- data.tar.gz: 730e023dcd9bf1aa872682053d94e262a9ac140f4360fbc6728e9b5159f303a17c392db2f606d4b73f11ed20f89432eeadc1a7a1f0ad942514fd0f3520f2b6bf
6
+ metadata.gz: f4bde45b9595343c0686575a0f0de40cd7312093fa72f46b95dfc6824435fe87645d55bf9e8d458ea0d3930355ff421d9d5b48b28f40bac7971e7b89e1921177
7
+ data.tar.gz: 1598338e7a03fb49300eb8ed33f846f6f39d591581052c2c70c93dd0261c6d5d94aea5b9e1930e92edc7566f181c87ee82bc3ad1b9799c5892f5ae6625940a48
@@ -2,7 +2,11 @@ module Bipbip
2
2
  class Plugin::Network < Plugin
3
3
  def metrics_schema
4
4
  [
5
- { name: 'connections_total', type: 'gauge', unit: 'Connections' }
5
+ { name: 'connections_total', type: 'gauge', unit: 'Connections' },
6
+ { name: 'rx_errors', type: 'counter', unit: 'Errors' },
7
+ { name: 'rx_dropped', type: 'counter', unit: 'Packets' },
8
+ { name: 'tx_errors', type: 'counter', unit: 'Errors' },
9
+ { name: 'tx_dropped', type: 'counter', unit: 'Packets' }
6
10
  ]
7
11
  end
8
12
 
@@ -10,8 +14,30 @@ module Bipbip
10
14
  tcp_summary = `ss -s | grep '^TCP:'`
11
15
  tcp_counters = /^TCP:\s+(\d+) \(estab (\d+), closed (\d+), orphaned (\d+), synrecv (\d+), timewait (\d+)\/(\d+)\), ports (\d+)$/.match(tcp_summary)
12
16
  raise "Cannot match ss-output `#{tcp_summary}`" unless tcp_counters
17
+ {
18
+ 'connections_total' => tcp_counters[1].to_i,
19
+ 'rx_errors' => _statistics_sum('rx_errors'),
20
+ 'rx_dropped' => _statistics_sum('rx_dropped'),
21
+ 'tx_errors' => _statistics_sum('tx_errors'),
22
+ 'tx_dropped' => _statistics_sum('tx_dropped')
23
+ }
24
+ end
25
+
26
+ private
27
+
28
+ # @param [String] check
29
+ # @return [Integer] Sum of readings for all interfaces
30
+ def _statistics_sum(check)
31
+ _interfaces.reduce(0) do |memo, interface|
32
+ memo + File.read("/sys/class/net/#{interface}/statistics/#{check}".chomp).to_i
33
+ end
34
+ end
13
35
 
14
- { connections_total: tcp_counters[1].to_i }
36
+ # @return [Array] List of all network interfaces to monitor
37
+ def _interfaces
38
+ interfaces_excluded = config['exclude_interfaces'] || [/lo/, /bond/, /vboxnet/]
39
+ interfaces_found = `ls /sys/class/net/`.split(/\n/)
40
+ interfaces_found.reject { |i| i.match(Regexp.union(interfaces_excluded)) }
15
41
  end
16
42
  end
17
43
  end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.6.21'.freeze
2
+ VERSION = '0.6.22'
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.6.21
4
+ version: 0.6.22
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-06-01 00:00:00.000000000 Z
13
+ date: 2016-07-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg-revealmetrics
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  version: '0'
315
315
  requirements: []
316
316
  rubyforge_project:
317
- rubygems_version: 2.5.0
317
+ rubygems_version: 2.4.8
318
318
  signing_key:
319
319
  specification_version: 4
320
320
  summary: Gather services data and store in CopperEgg