logstash-input-remote_proc 0.1.1 → 0.1.2

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: 035fc8bc3778dcb99b27079eaf0d718d6046d52b
4
- data.tar.gz: d33a58ba22ca37ac4de7e80d48714b99278e9b27
3
+ metadata.gz: 191511d2b37eb1608ff5c138f9fe22fa79c52291
4
+ data.tar.gz: beaf4d403fdbae4446f33015a6f0ae1e2b50cf4b
5
5
  SHA512:
6
- metadata.gz: 83b1d89283ba50881e416746011b712bf63926c2397745f6233434f9808d61b5f62b5240921436c251c4d0cf51f6e520d36bb0bf5b4f8c6cd71a11233c0eb4ad
7
- data.tar.gz: ec2b4d2a344848df5f17c3880970933e1084b435750c6a6253f2931c2c5aa6baf9ffe53e5fbd87a0eae28da572b7a1d9fe25d5a1b4ebe31c5c45c5ddacedc504
6
+ metadata.gz: 1a4d2f1d84fe9f45c2ac390089cc5c08f6e1fc332982c1dafaa19029ef09583cbd951be795d79eb83fc1cfb82c2bac153a2a63faa7a8c0c0426ccb1fa5c555ae
7
+ data.tar.gz: 51d29b71a54673362353ec1bcff7d9f3aa5f9adb39ca11515e97186dc03f292a3c46554cbf865835428a8be4adad88bb9db0fed5dadf44cc4dce885bc38c83af
data/USAGE.md CHANGED
@@ -3,25 +3,35 @@ This plugin retrieves `/proc/*` metrics remotely via SSH connections.
3
3
 
4
4
  ## How to use
5
5
 
6
- **Default values**
6
+ **Default values for `servers`**
7
7
 
8
- ```ruby
9
- SERVER_OPTIONS = {
10
- 'host' => 'localhost', # :string
11
- 'port' => 22, # :number
12
- 'ssh_private_key' => nil, # :path (needed if no 'password')
13
- 'username' => ENV['USER'] || ENV['USERNAME'] || 'nobody', # :string (default to unix $USER)
14
- 'password' => nil, # :string (needed if no 'ssh_private_key')
15
- 'gateway_host' => nil, # :string
16
- 'gateway_port' => 22, # :number
17
- 'gateway_username' => ENV['USER'] || ENV['USERNAME'] || 'nobody', # :string (default to unix $USER)
18
- 'gateway_password' => nil, # :string
19
- 'gateway_ssh_private_key' => nil # :string
20
- }.freeze
8
+ ```logstash
9
+ servers => [
10
+ {
11
+ host => "localhost" # :string
12
+ port => 22 # :number
13
+ ssh_private_key => ... # :path (needed if no 'password'), empty by default
14
+ username => ${USER} || ${USERNAME} || 'nobody' # :string (default to unix $USER)
15
+ password => ... # :string (needed if no 'ssh_private_key'), empty by default
16
+ gateway_host => ... # :string (if set, gateway is used), empty by default
17
+ gateway_port => 22 # :number
18
+ gateway_username => ${USER} || ${USERNAME} || 'nobody' # :string (default to unix $USER)
19
+ gateway_password => ... # :string (needed if gateway_host is set and no 'ssh_private_key' is given), empty by default
20
+ gateway_ssh_private_key => ... # :path (needed if no 'gateway_password'), empty by default
21
+ }
22
+ ]
21
23
  ```
22
24
 
23
25
  When no password is given, the private key path for both `host` and `gateway_host` are : `$HOME/.ssh/id_dsa`, `$HOME/.ssh2/id_dsa`, `$HOME/.ssh/id_rsa`, and `$HOME/.ssh2/id_rsa`.
24
26
 
27
+ **Default values for `proc_list`**
28
+
29
+ ```logstash
30
+ proc_list => ["cpuinfo", "meminfo", "loadavg", "vmstat", "diskstats", "netdev", "netwireless", "mounts", "crypto", "sysvipcshm"]
31
+ ```
32
+
33
+ If `proc_list` is not declared all of them are processed. An equivalent declaration is `proc_file => ["_all"]`.
34
+
25
35
  ### SSH server with default values and authenticate by private key
26
36
 
27
37
  ```javascript
@@ -78,6 +78,23 @@ module LogStash
78
78
  # The default values are specified in `#{SERVER_OPTIONS}` hash.
79
79
  config :servers, validate: :hash, list: true, required: true
80
80
 
81
+ # List of PROFS information to retrieve
82
+ #
83
+ # Valid values are:
84
+ #
85
+ # [source,ruby]
86
+ # ------------------------------------------------------------------------
87
+ # %w(
88
+ # cpuinfo meminfo loadavg vmstat diskstats
89
+ # netdev netwireless mounts crypto sysvipcshm
90
+ # )
91
+ # ------------------------------------------------------------------------
92
+ #
93
+ # By default all metrics are retrieved.
94
+ config :proc_list,
95
+ validate: :array,
96
+ default: ['_all']
97
+
81
98
  # Set how frequently messages should be sent.
82
99
  #
83
100
  # The default, `60`, means send a message every second.
@@ -88,20 +105,19 @@ module LogStash
88
105
 
89
106
  require 'net/ssh'
90
107
  require 'net/ssh/gateway'
91
- @ssh_sessions = []
92
108
 
93
- # Don't forget to close all gateways manually in `stop` method.
109
+ @ssh_sessions = []
94
110
  @ssh_gateways = []
111
+ @commands = ['_all']
95
112
 
96
- # Handle server configuration
97
- configure_servers
113
+ configure!
98
114
  end # def register
99
115
 
100
116
  def run(queue)
101
117
  # we can abort the loop if stop? becomes true
102
118
  until stop?
103
119
  @ssh_sessions.each do |ssh|
104
- COMMANDS.each do |method, command|
120
+ @commands.each do |method, command|
105
121
  result_data = String.new('')
106
122
  error_data = String.new('')
107
123
  channel = ssh.open_channel do |chan|
@@ -158,7 +174,7 @@ module LogStash
158
174
  end
159
175
 
160
176
  # Prepare all server configuration
161
- def configure_servers
177
+ def configure!
162
178
  @servers.each do |s|
163
179
  prepare_servers!(s)
164
180
 
@@ -189,6 +205,11 @@ module LogStash
189
205
  session_options)
190
206
  end
191
207
  end
208
+ @commands = if (@proc_list - ['_all']).empty?
209
+ COMMANDS
210
+ else
211
+ COMMANDS.select { |k, _| @proc_list.include?(k.to_s) }
212
+ end
192
213
  end
193
214
 
194
215
  # Process SYSVIPCSHM 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.1'
3
+ s.version = '0.1.2'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-remote_proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kakesa