logstash-input-remote_proc 0.1.5 → 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: 80014c6e1cda441511aac73c775940faff81c73e
4
- data.tar.gz: cc4b70a529900f8e028fef6fdeb9f0ef1987f963
3
+ metadata.gz: 4b2eabf983c6658e05c49e86955d1933b7650cec
4
+ data.tar.gz: ef9053b1f456c10cb5bdfaf188577b32456fd5bd
5
5
  SHA512:
6
- metadata.gz: d5f7847aa949254171d09411c3e3990227e7327500f71542822c796503efea712439453ad373c51dfa7d2fdfa575ad947ad4b70cc92a50a7866e9cccf6f34e9a
7
- data.tar.gz: 989081ac4ee05e0bad36bfa4aa00e70333c9c6e0bdd716ce502c3a21ec2e344a0a0d7d6c1bb7892914829ef41e0af053d993203cd3e04fb700954c751a052d7c
6
+ metadata.gz: 13615f9d28c1b8c7061025e40b09fc01cd6d519c7b37b29e56570ed4b36ba2b0b026b07629c39f0a27266cd219428a1b8e0d118b2caee3554ca159b93a376907
7
+ data.tar.gz: 4f6832667a2afe2c350f5ef18eff733da178b07feec1d31cd85784e1b5878852fc9c288f7ef550ee88bdb3e3c91a4e46c24b1dc4bc6e49f5c024d5c457649421
@@ -10,6 +10,7 @@ module LogStash
10
10
  #
11
11
  # Supported endpoints :
12
12
  # * /proc/cpuinfo
13
+ # * /proc/stat
13
14
  # * /proc/meminfo
14
15
  # * /proc/loadavg
15
16
  # * /proc/vmstat
@@ -31,6 +32,21 @@ module LogStash
31
32
  # { host => "remote.server.com" username => "medium" },
32
33
  # { host => "h2.net" username => "poc" gateway_host => "h.gw.net" gateway_username => "user" }
33
34
  # ]
35
+ # proc_list => ["cpuinfo", "stat", "meminfo", "diskstats"]
36
+ # }
37
+ # }
38
+ # -------------------------------------------------------------------------
39
+ #
40
+ # Example with `proc_list => ["_all"]` which is default.
41
+ # [source,ruby]
42
+ # -------------------------------------------------------------------------
43
+ # input {
44
+ # remote_proc {
45
+ # servers => [
46
+ # { host => "remote.server.com" username => "medium" },
47
+ # { host => "h2.net" username => "poc" gateway_host => "h.gw.net" gateway_username => "user" }
48
+ # ]
49
+ # proc_list => ["_all"]
34
50
  # }
35
51
  # }
36
52
  # -------------------------------------------------------------------------
@@ -53,6 +69,7 @@ module LogStash
53
69
  # Liste of commands for each `/proc` endpoints.
54
70
  COMMANDS = {
55
71
  cpuinfo: 'cat /proc/cpuinfo',
72
+ stat: 'cat /proc/stat',
56
73
  meminfo: 'cat /proc/meminfo',
57
74
  loadavg: 'cat /proc/loadavg',
58
75
  vmstat: 'cat /proc/vmstat',
@@ -81,7 +98,7 @@ module LogStash
81
98
  # [source,ruby]
82
99
  # ------------------------------------------------------------------------
83
100
  # %w(
84
- # cpuinfo meminfo loadavg vmstat diskstats
101
+ # cpuinfo stat meminfo loadavg vmstat diskstats
85
102
  # netdev netwireless mounts crypto sysvipcshm
86
103
  # )
87
104
  # ------------------------------------------------------------------------
@@ -405,6 +422,44 @@ module LogStash
405
422
  meminfo
406
423
  end
407
424
 
425
+ # Process STAT data.
426
+ # http://lxr.free-electrons.com/source/Documentation/filesystems/proc.txt#L1294
427
+ def proc_stat(data)
428
+ return {} unless data
429
+ stat = {}
430
+ data.split(/$/).each do |line|
431
+ m = /^(cpu[0-9]*|intr|ctxt|btime|processes|procs_running|procs_blocked|softirq)\s+(.*)/i.match(line)
432
+ next unless m
433
+ if m[1] =~ /^cpu[0-9]*$/i
434
+ m_sub = m[2].split(/\s+/)
435
+ if m_sub && m_sub.length >= 10
436
+ m_sub.map!(&:to_i)
437
+ stat[m[1]] = {
438
+ user: m_sub[0],
439
+ nice: m_sub[1],
440
+ system: m_sub[2],
441
+ idle: m_sub[3],
442
+ iowait: m_sub[4],
443
+ irq: m_sub[5],
444
+ softirq: m_sub[6],
445
+ steal: m_sub[7],
446
+ guest: m_sub[8],
447
+ guest_nice: m_sub[9]
448
+ }
449
+ end
450
+ elsif m[1] =~ /^ctxt|btime|processes|procs_running|procs_blocked$/i
451
+ stat[m[1]] = m[2].to_i
452
+ elsif m[1] =~ /^intr|softirq$/i
453
+ m_sub = m[2].split(/\s+/)
454
+ next if m_sub.empty?
455
+ total = m_sub.shift.to_i
456
+ stat[m[1]] = { total: total }
457
+ stat[m[1]][:subsequents] = m_sub.map!(&:to_i)
458
+ end
459
+ end
460
+ stat
461
+ end
462
+
408
463
  # Process CPUINFO data.
409
464
  def proc_cpuinfo(data)
410
465
  return {} unless data
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-remote_proc'
3
- s.version = '0.1.5'
3
+ s.version = '0.1.6'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'This Logstash plugin collects PROCFS metrics through remote SSH servers.'
6
6
  s.description = 'This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-remote_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kakesa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2016-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement