logstash-input-attunity-metrics 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: af5f41d4162c9811784e04adfe1c5be9e7e3d75c5e858682f5fa24669e7787f6
4
- data.tar.gz: 984f367a111a074fda1f55d9a9041a5a45f918501ebd74911cad7da1db51b318
3
+ metadata.gz: 921b36c6e48d0e28feb55d4745f9b7a010da58ee3485dc8a31ba9420875459b7
4
+ data.tar.gz: 14f4088a4ff7b8a238343e17cc458c2016e60f3617b7e33eb026f7b989a28fe4
5
5
  SHA512:
6
- metadata.gz: ab516179cab19abcf995df0112417586712cd51a32ea5f2d2c67e6cf70610defda3fb895ae9b8e8d1d5290fc0a28e4510d32c36baf47af8fe4821a124847ae43
7
- data.tar.gz: 9170977a41607550a4a200b3e783f60748d0266b0e312976eb83e73304a5766b80e57c014baebb4a6a3532c97225e2f7a4fff0fe65264e788c2426d3232aaead
6
+ metadata.gz: f4b91328928a2745d1313a9c855d2136f164c0be580ae14ff01de84fe96deb05c43bf6dc5effcb81b38db79f3d1a6511df3a7f9df4253e96b0a231a96660e37c
7
+ data.tar.gz: 79720ae65f80531392bf1d0dec68a138b89a8602d41e07ea474c2cbb414ffd21017478f906a955a5b315c480641eb1e013828ee90d111979ce465f0ed70b1890
@@ -22,17 +22,8 @@ class LogStash::Inputs::Attunity_Metrics < LogStash::Inputs::Base
22
22
 
23
23
  config: verify_ssl, :validate => :bool, :default => true
24
24
 
25
- # The message string to use in the event.
26
- config :message, :validate => :string, :default => "Hello World!"
27
-
28
- # Set how frequently messages should be sent.
29
- #
30
- # The default, `1`, means send a message every second.
31
- config :interval, :validate => :number, :default => 1
32
-
33
25
  public
34
26
  def register
35
- @host = Socket.gethostname
36
27
 
37
28
  @header = {
38
29
  :content_type => "application/json",
@@ -40,21 +31,26 @@ class LogStash::Inputs::Attunity_Metrics < LogStash::Inputs::Base
40
31
  :password => @password
41
32
  }
42
33
 
43
- @client = resource = RestClient::Resource.new 'http://example.com/resource'
44
- end # def register
34
+ @client = resource = RestClient::Resource.new(
35
+ @url,
36
+ :verify_ssl => OpenSSL::SSL::VERIFY_NONE
37
+ )
38
+
39
+ @logger.info("Registering attunity_metrics", :url => @url, :user => @username, :password => @password, :verify_ssl => @verify_ssl)
40
+ end
45
41
 
46
42
  def run(queue)
47
43
  # we can abort the loop if stop? becomes true
48
- while !stop?
49
- event = LogStash::Event.new("message" => @message, "host" => @host)
50
- decorate(event)
51
- queue << event
52
- # because the sleep interval can be big, when shutdown happens
53
- # we want to be able to abort the sleep
54
- # Stud.stoppable_sleep will frequently evaluate the given block
55
- # and abort the sleep(@interval) if the return value is true
56
- Stud.stoppable_sleep(@interval) { stop? }
57
- end # loop
44
+ # while !stop?
45
+ # event = LogStash::Event.new("message" => @message, "host" => @host)
46
+ # decorate(event)
47
+ # queue << event
48
+ # # because the sleep interval can be big, when shutdown happens
49
+ # # we want to be able to abort the sleep
50
+ # # Stud.stoppable_sleep will frequently evaluate the given block
51
+ # # and abort the sleep(@interval) if the return value is true
52
+ # Stud.stoppable_sleep(@interval) { stop? }
53
+ # end # loop
58
54
 
59
55
  login()
60
56
 
@@ -86,51 +82,51 @@ class LogStash::Inputs::Attunity_Metrics < LogStash::Inputs::Base
86
82
 
87
83
  private
88
84
  def login()
89
- response = RestClient.get(
90
- "https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/login",
91
- :header => @header)
85
+ response = @client["api/v1/login"].get(
86
+ :header => @header
87
+ )
92
88
 
93
89
  @header[:'EnterpriseManager.APISessionID'] = response.header[:'EnterpriseManager.APISessionID']
94
90
  end
95
91
 
96
92
  private
97
93
  def logout()
98
- response = RestClient.get(
99
- "https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/login",
100
- :header => @header)
94
+ response = @client["api/v1/logout"].get(
95
+ :header => @header
96
+ )
101
97
 
102
98
  @header[:'EnterpriseManager.APISessionID'] = ""
103
99
  end
104
100
 
105
101
  private
106
102
  def get_servers()
107
- response = RestClient.get(
108
- 'https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/servers',
109
- :header => @header)
103
+ response = @client["api/v1/servers"].get(
104
+ :header => @header
105
+ )
110
106
  return response.body.serverList
111
107
  end
112
108
 
113
109
  private
114
110
  def get_server_details(server)
115
- response = RestClient.get(
116
- "https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/servers/#{server}",
117
- :header => @header)
111
+ response = @client["api/v1/servers/#{server}"].get(
112
+ :header => @header
113
+ )
118
114
  return response.body.server_details
119
115
  end
120
116
 
121
117
  private
122
118
  def get_tasks(server)
123
- response = RestClient.get(
124
- "https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/servers/#{server}/tasks",
125
- :header => @header)
119
+ response = @client["api/v1/servers/#{server}/tasks"].get(
120
+ :header => @header
121
+ )
126
122
  return response.body.taskList
127
123
  end
128
124
 
129
125
  private
130
126
  def get_task_details(server, task)
131
- response = RestClient.get(
132
- "https://carsf4maem01.car.michelin.com/attunityenterprisemanager/api/v1/servers/#{server}/tasks/#{task}",
133
- :header => @header)
127
+ response = @client["api/v1/servers/#{server}/tasks/#{task}"].get(
128
+ :header => @header
129
+ )
134
130
  return response.body
135
131
  end
136
132
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-attunity-metrics'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This example input streams a string at a definable interval."
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-attunity-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-13 00:00:00.000000000 Z
11
+ date: 2020-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement