fluent-plugin-appdynamics 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-appdynamics.gemspec +3 -2
- data/lib/fluent/plugin/in_appdynamics.rb +69 -10
- data/test/plugin/test_in_appdynamics.rb +9 -1
- metadata +22 -4
- data/create_fluentd_str +0 -300
- data/notes +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03e9cc43bf0181be4191625a815353dce055c22
|
4
|
+
data.tar.gz: 4d86c263c241fb277660a81cbb00053b99ba1a42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5028b8c8e6a9e1b80e2073452f900517afe3bde01e3fe4009fc8e781e49798d5f9b82f8218190110eca1f306131f62ef94422d6b966747f5fad02c581798f0dd
|
7
|
+
data.tar.gz: 1a8e8d5058f169d2f88956b9fd4bfcb14da35b7c02e1d128002785219bca30d63341998be4bf48312d314c6e37f6168483ab40a51350a56349d7b37c475e4981
|
@@ -3,13 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "fluent-plugin-appdynamics"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.2"
|
7
7
|
gem.date = '2015-03-02'
|
8
8
|
gem.authors = ["chandrashekar Tippur"]
|
9
9
|
gem.email = ["ctippur@gmail.com"]
|
10
10
|
gem.summary = %q{Fluentd input plugin for appdynamics alerts}
|
11
11
|
gem.description = %q{FLuentd plugin for appdynamics alerts... WIP}
|
12
|
-
gem.homepage = 'https://github.com/
|
12
|
+
gem.homepage = 'https://github.com/ctippur/fluent-plugin-appdynamics'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($\)
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_runtime_dependency "fluentd", '~> 0.10', '>= 0.10.52'
|
22
22
|
gem.add_runtime_dependency "json", '~> 1.1', '>= 1.8.2'
|
23
23
|
gem.add_runtime_dependency "rest-client", '~> 1.7', '>= 1.7.3'
|
24
|
+
gem.add_development_dependency "rake", '~> 0.9', '>= 0.9.6'
|
24
25
|
end
|
@@ -7,11 +7,12 @@ module Fluent
|
|
7
7
|
# Define default configurations
|
8
8
|
# Example: config_param :tag, :string, :default => "alert.newrelic"
|
9
9
|
config_param :tag, :string, :default => "alert.appdynamics"
|
10
|
-
config_param :endpoint, :string, :default => "
|
10
|
+
config_param :endpoint, :string, :default => "" # Optional
|
11
11
|
config_param :interval, :integer, :default => '300' #Default 5 minutes
|
12
|
-
config_param :user, :string, :default => "
|
13
|
-
config_param :pass, :string, :default => "
|
14
|
-
config_param :
|
12
|
+
config_param :user, :string, :default => ""
|
13
|
+
config_param :pass, :string, :default => ""
|
14
|
+
config_param :account, :string, :default => ""
|
15
|
+
config_param :include_raw, :string, :default => "true" #Include original object as raw
|
15
16
|
config_param :attributes, :string, :default => "ALL" # fields to include, ALL for... well, ALL.
|
16
17
|
|
17
18
|
# function to UTF8 encode
|
@@ -26,6 +27,7 @@ module Fluent
|
|
26
27
|
super
|
27
28
|
require 'json'
|
28
29
|
require 'rest-client'
|
30
|
+
require 'pp'
|
29
31
|
# Add any other dependencies
|
30
32
|
end # def initialize
|
31
33
|
|
@@ -35,8 +37,17 @@ module Fluent
|
|
35
37
|
@conf = conf
|
36
38
|
def appdynamicsEnd(startTime,endTime)
|
37
39
|
# Setup URL Resource
|
38
|
-
|
39
|
-
|
40
|
+
# Sample https://ep/controller/rest/applications/Prod/problems/healthrule-violations?time-range-type=BETWEEN_TIMES&output=JSON&start-time=1426270552990&end-time=1426270553000
|
41
|
+
@url = @endpoint.to_s + "problems/healthrule-violations?time-range-type=BETWEEN_TIMES&output=JSON" + "&start-time=" + startTime.to_s + "&end-time=" + endTime.to_s
|
42
|
+
$log.info @url
|
43
|
+
RestClient::Resource.new(@url,@user+"@"+@account,@pass)
|
44
|
+
end
|
45
|
+
def appdynamicsEntEnd(entityId)
|
46
|
+
# Setup URL Resource
|
47
|
+
# Sample https://ep/controller/rest/applications/Prod/nodes/81376?output=JSON
|
48
|
+
@urlEntity = @endpoint.to_s + "nodes/" + entityId.to_s + "?output=JSON"
|
49
|
+
$log.info @urlEntity
|
50
|
+
RestClient::Resource.new(@urlEntity,@user+"@"+@account,@pass)
|
40
51
|
end
|
41
52
|
# TO DO Add code to choke if config parameters are not there
|
42
53
|
end # def configure
|
@@ -65,12 +76,60 @@ module Fluent
|
|
65
76
|
# Start appdynamics Trap listener
|
66
77
|
# Add the code to run this
|
67
78
|
def input
|
68
|
-
alertStartTime = Engine.now.to_i - @interval.to_i
|
69
|
-
$log.info "appdynamics :: Polling alerts for time period: #{alertStartTime.to_i} - #{Engine.now.to_i}"
|
79
|
+
alertStartTime = (Engine.now.to_f * 1000).to_i - @interval.to_i
|
80
|
+
$log.info "appdynamics :: Polling alerts for time period: #{alertStartTime.to_i} - #{(Engine.now.to_f * 1000).to_i}"
|
70
81
|
# Post to Appdynamics and parse results
|
71
|
-
|
82
|
+
|
83
|
+
begin
|
84
|
+
responsePost=appdynamicsEnd(alertStartTime,(Engine.now.to_f * 1000).to_i).get
|
85
|
+
rescue Exception => e
|
86
|
+
$log.info e.message
|
87
|
+
$log.info e.backtrace.inspect
|
88
|
+
end
|
89
|
+
# body is an array of hashes
|
72
90
|
body = JSON.parse(responsePost.body)
|
73
|
-
|
91
|
+
body.each_with_index {|val, index|
|
92
|
+
#pp val
|
93
|
+
$log.debug val
|
94
|
+
if @include_raw.to_s == "true"
|
95
|
+
# Deep copy
|
96
|
+
rawObj=val.clone
|
97
|
+
#val << { "raw" => "#rawObj" }
|
98
|
+
val["raw"]=rawObj
|
99
|
+
end
|
100
|
+
# Need to do another call to get the hostname
|
101
|
+
if ((val["affectedEntityDefinition"] || {})["entityId"] != nil) then
|
102
|
+
begin
|
103
|
+
responsePostAffEnt=appdynamicsEntEnd(val["affectedEntityDefinition"]["entityId"]).get
|
104
|
+
bodyAffEntity = JSON.parse(responsePostAffEnt.body)
|
105
|
+
val["AffectedEntityName"]=bodyAffEntity[0]["name"]
|
106
|
+
|
107
|
+
rescue Exception => e
|
108
|
+
$log.info e.message
|
109
|
+
$log.info e.backtrace.inspect
|
110
|
+
val["TrigerredEntityName"]=""
|
111
|
+
end
|
112
|
+
#pp bodyAffEntity["name"]
|
113
|
+
#val["AffectedEntityName"]=bodyAffEntity["name"]
|
114
|
+
|
115
|
+
end
|
116
|
+
if ((val["triggeredEntityDefinition"] || {})["entityId"] != nil) then
|
117
|
+
begin
|
118
|
+
responsePostTrigEnt=appdynamicsEntEnd(val["triggeredEntityDefinition"]["entityId"]).get
|
119
|
+
bodyTrigEnt = JSON.parse(responsePostTrigEnt.body)
|
120
|
+
val["TrigerredEntityName"]=bodyTrigEnt[0]["name"]
|
121
|
+
rescue Exception => e
|
122
|
+
$log.info e.message
|
123
|
+
$log.info e.backtrace.inspect
|
124
|
+
val["TrigerredEntityName"]=""
|
125
|
+
end
|
126
|
+
#val["TrigerredEntityName"]=bodyTrigEnt["name"]
|
127
|
+
end
|
128
|
+
#puts "#{val} => #{index}"
|
129
|
+
$log.info val
|
130
|
+
Engine.emit(@tag, val['startTimeInMillis'].to_i,val)
|
131
|
+
}
|
132
|
+
#pp body.class
|
74
133
|
end # def Input
|
75
134
|
|
76
135
|
end # End Input class
|
@@ -10,15 +10,23 @@ class appdynamicsTrapInputTest < Test::Unit::TestCase
|
|
10
10
|
# Example hostt 0
|
11
11
|
# Example port 1062
|
12
12
|
# Example tag alert.snmptrap
|
13
|
+
tag alert.appdynamics.raw
|
13
14
|
]
|
14
15
|
|
15
16
|
def create_driver(conf=CONFIG)
|
16
|
-
Fluent::Test::InputTestDriver.new(Fluent::appdynamicsTrapInput).configure(conf)
|
17
|
+
Fluent::Test::InputTestDriver.new(Fluent::appdynamicsTrapInput, tag='test_tag').configure(conf)
|
17
18
|
end
|
18
19
|
|
19
20
|
# Configure the test
|
20
21
|
def test_configure
|
21
22
|
d = create_driver('')
|
23
|
+
assert_equal "pleasechangeme.com", d.instance.endpoint
|
24
|
+
assert_equal "username", d.instance.user
|
25
|
+
assert_equal "password", d.instance.pass
|
26
|
+
assert_equal "account", d.instance.account
|
27
|
+
assert_equal "300".to_i, d.instance.interval
|
28
|
+
assert_equal "false", d.instance.include_raw
|
29
|
+
assert_equal 'alert.appdynamics.raw', d.instance.tag
|
22
30
|
# Example assert_equal "0".to_i, d.instance.host
|
23
31
|
# Example assert_equal "1062".to_i, d.instance.port
|
24
32
|
# Example assert_equal 'alert.snmptrap', d.instance.tag
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-appdynamics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chandrashekar Tippur
|
@@ -70,6 +70,26 @@ dependencies:
|
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 1.7.3
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: rake
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.9'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.6
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.9.6
|
73
93
|
description: FLuentd plugin for appdynamics alerts... WIP
|
74
94
|
email:
|
75
95
|
- ctippur@gmail.com
|
@@ -80,15 +100,13 @@ files:
|
|
80
100
|
- Gemfile
|
81
101
|
- README
|
82
102
|
- README.md
|
83
|
-
- create_fluentd_str
|
84
103
|
- fluent-plugin-appdynamics.gemspec
|
85
104
|
- lib/fluent/plugin/controller.rb
|
86
105
|
- lib/fluent/plugin/in_appdynamics.rb
|
87
|
-
- notes
|
88
106
|
- sample/snmp.conf.sample
|
89
107
|
- test/helper.rb
|
90
108
|
- test/plugin/test_in_appdynamics.rb
|
91
|
-
homepage: https://github.com/
|
109
|
+
homepage: https://github.com/ctippur/fluent-plugin-appdynamics
|
92
110
|
licenses:
|
93
111
|
- MIT
|
94
112
|
metadata: {}
|
data/create_fluentd_str
DELETED
@@ -1,300 +0,0 @@
|
|
1
|
-
|
2
|
-
plugin=$1
|
3
|
-
USAGE="USAGE: $0 plugin"
|
4
|
-
if [ -z "$plugin" ]; then
|
5
|
-
echo $USAGE
|
6
|
-
exit
|
7
|
-
fi
|
8
|
-
|
9
|
-
mkdir -p lib/fluent/plugin sample test/plugin
|
10
|
-
|
11
|
-
currdate=`date +"%Y-%m-%d"`
|
12
|
-
|
13
|
-
cat >README <<EOF
|
14
|
-
# Fluent::Plugin::$plugin
|
15
|
-
|
16
|
-
fluent-plugin-$plugin is an input plug-in for [Fluentd](http://fluentd.org)
|
17
|
-
|
18
|
-
## Installation
|
19
|
-
|
20
|
-
These instructions assume you already have fluentd installed.
|
21
|
-
If you don't, please run through [quick start for fluentd] (https://github.com/fluent/fluentd#quick-start)
|
22
|
-
|
23
|
-
Now after you have fluentd installed you can follow either of the steps below:
|
24
|
-
|
25
|
-
Add this line to your application's Gemfile:
|
26
|
-
|
27
|
-
gem 'fluent-plugin-$plugin'
|
28
|
-
|
29
|
-
Or install it yourself as:
|
30
|
-
|
31
|
-
$ gem install fluent-plugin-$plugin
|
32
|
-
|
33
|
-
## Usage
|
34
|
-
Add the following into your fluentd config.
|
35
|
-
|
36
|
-
<source>
|
37
|
-
type $plugin # required, chossing the input plugin.
|
38
|
-
endpoint # Optional.
|
39
|
-
projectId # Needed for Ironio
|
40
|
-
token # Needed for Ironio
|
41
|
-
endpointQueue # Needed for Ironio
|
42
|
-
endpointType # Example ironio, kinesis
|
43
|
-
oauthId # authorization key
|
44
|
-
interval # frequency to pull data
|
45
|
-
readOnly # True or false to control deletion of message after it is read
|
46
|
-
</source>
|
47
|
-
|
48
|
-
<match alert.$plugin>
|
49
|
-
type stdout
|
50
|
-
</match>
|
51
|
-
|
52
|
-
Now startup fluentd
|
53
|
-
|
54
|
-
$ sudo fluentd -c fluent.conf &
|
55
|
-
|
56
|
-
Send a test trap using net-snmp tools
|
57
|
-
|
58
|
-
$ cd test; rvmsudo ./ironmq.rb
|
59
|
-
|
60
|
-
## To Do
|
61
|
-
1. Change the logic to do a get all call so we process a bunch of alerts at a time.
|
62
|
-
2. Make delete configurable
|
63
|
-
EOF
|
64
|
-
|
65
|
-
cat >README.md <<EOF
|
66
|
-
# Fluent::Plugin::$plugin
|
67
|
-
|
68
|
-
fluent-plugin-$plugin is an input plug-in for [Fluentd](http://fluentd.org)
|
69
|
-
|
70
|
-
## Installation
|
71
|
-
|
72
|
-
These instructions assume you already have fluentd installed.
|
73
|
-
If you don't, please run through [quick start for fluentd] (https://github.com/fluent/fluentd#quick-start)
|
74
|
-
|
75
|
-
Now after you have fluentd installed you can follow either of the steps below:
|
76
|
-
|
77
|
-
Add this line to your application's Gemfile:
|
78
|
-
|
79
|
-
gem 'fluent-plugin-$plugin'
|
80
|
-
|
81
|
-
Or install it yourself as:
|
82
|
-
|
83
|
-
$ gem install fluent-plugin-$plugin
|
84
|
-
|
85
|
-
## Usage
|
86
|
-
Add the following into your fluentd config.
|
87
|
-
|
88
|
-
<source>
|
89
|
-
type $plugin # required, chossing the input plugin.
|
90
|
-
endpoint # Optional.
|
91
|
-
projectId # Needed for Ironio
|
92
|
-
token # Needed for Ironio
|
93
|
-
endpointQueue # Needed for Ironio
|
94
|
-
endpointType # Example ironio, kinesis
|
95
|
-
oauthId # authorization key
|
96
|
-
interval # frequency to pull data
|
97
|
-
readOnly # True or false to control deletion of message after it is read
|
98
|
-
</source>
|
99
|
-
|
100
|
-
<match alert.$plugin>
|
101
|
-
type stdout
|
102
|
-
</match>
|
103
|
-
|
104
|
-
Now startup fluentd
|
105
|
-
|
106
|
-
$ sudo fluentd -c fluent.conf &
|
107
|
-
|
108
|
-
Send a test trap using net-snmp tools
|
109
|
-
|
110
|
-
$ cd test; rvmsudo ./ironmq.rb
|
111
|
-
|
112
|
-
## To Do
|
113
|
-
1. Change the logic to do a get all call so we process a bunch of alerts at a time.
|
114
|
-
2. Make delete configurable
|
115
|
-
EOF
|
116
|
-
|
117
|
-
|
118
|
-
cat > fluent-plugin-$plugin.gemspec <<EOF
|
119
|
-
# -*- encoding: utf-8 -*-
|
120
|
-
$:.push File.expand_path("../lib", __FILE__)
|
121
|
-
|
122
|
-
Gem::Specification.new do |gem|
|
123
|
-
gem.name = "fluent-plugin-$plugin"
|
124
|
-
gem.version = "0.0.1"
|
125
|
-
gem.date = '$currdate'
|
126
|
-
gem.authors = ["chandrashekar Tippur"]
|
127
|
-
gem.email = ["ctippur@gmail.com"]
|
128
|
-
gem.summary = %q{Fluentd input plugin for $plugin alerts}
|
129
|
-
gem.description = %q{FLuentd plugin for $plugin alerts... WIP}
|
130
|
-
gem.homepage = 'https://github.com/Bigel0w/fluent-plugin-$plugin'
|
131
|
-
gem.license = 'MIT'
|
132
|
-
|
133
|
-
gem.files = `git ls-files`.split($\)
|
134
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
135
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
136
|
-
gem.require_paths = ["lib"]
|
137
|
-
# Add GEM dependencies below
|
138
|
-
# For Example: gem.add_development_dependency "rake", '~> 0.9', '>= 0.9.6'
|
139
|
-
end
|
140
|
-
EOF
|
141
|
-
|
142
|
-
cat >Gemfile <<EOF
|
143
|
-
source 'https://rubygems.org'
|
144
|
-
|
145
|
-
# Specify your gem's dependencies in fluent-plugin-snmp.gemspec
|
146
|
-
gemspec
|
147
|
-
EOF
|
148
|
-
|
149
|
-
|
150
|
-
# Create files
|
151
|
-
|
152
|
-
cat >lib/fluent/plugin/in_${plugin}.rb <<EOF
|
153
|
-
module Fluent
|
154
|
-
|
155
|
-
# Read trap messages as events in to fluentd
|
156
|
-
class NewRelicInput < Input
|
157
|
-
Fluent::Plugin.register_input('newrelic', self)
|
158
|
-
|
159
|
-
# Define default configurations
|
160
|
-
# Example: config_param :tag, :string, :default => "alert.newrelic"
|
161
|
-
config_param :interval, :string, :default => "5"
|
162
|
-
config_param :tag, :string, :default => "alert.$plugin"
|
163
|
-
config_param :endpoint, :string, :default => "" # Optional
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
# Initialize and bring in dependencies
|
168
|
-
def initialize
|
169
|
-
super
|
170
|
-
require 'json'
|
171
|
-
require 'daemons'
|
172
|
-
require 'pp'
|
173
|
-
# Add any other dependencies
|
174
|
-
end # def initialize
|
175
|
-
|
176
|
-
# Load internal and external configs
|
177
|
-
def configure(conf)
|
178
|
-
super
|
179
|
-
@conf = conf
|
180
|
-
# TO DO Add code to choke if config parameters are not there
|
181
|
-
end # def configure
|
182
|
-
|
183
|
-
def start
|
184
|
-
super
|
185
|
-
@loop = Coolio::Loop.new
|
186
|
-
timer_trigger = TimerWatcher.new(@interval, true, &method(:input))
|
187
|
-
timer_trigger.attach(@loop)
|
188
|
-
@thread = Thread.new(&method(:run))
|
189
|
-
$log.info "starting $plugin poller, interval #{@interval}"
|
190
|
-
end
|
191
|
-
|
192
|
-
# Stop Listener and cleanup any open connections.
|
193
|
-
def shutdown
|
194
|
-
super
|
195
|
-
@loop.stop
|
196
|
-
@thread.join
|
197
|
-
end
|
198
|
-
|
199
|
-
def run
|
200
|
-
@loop.run
|
201
|
-
$log.info "Running $plugin Input"
|
202
|
-
end
|
203
|
-
|
204
|
-
# Start $plugin Trap listener
|
205
|
-
# Add the code to run this
|
206
|
-
def input
|
207
|
-
end # def Input
|
208
|
-
|
209
|
-
end # End Input class
|
210
|
-
|
211
|
-
class TimerWatcher < Coolio::TimerWatcher
|
212
|
-
def initialize(interval, repeat, &callback)
|
213
|
-
@callback = callback
|
214
|
-
super(interval, repeat)
|
215
|
-
end
|
216
|
-
|
217
|
-
def on_timer
|
218
|
-
@callback.call
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
end # module Fluent
|
223
|
-
EOF
|
224
|
-
|
225
|
-
|
226
|
-
cat >sample/snmp.conf.sample <<EOF
|
227
|
-
<source>
|
228
|
-
type $plugin # required, chossing the input plugin.
|
229
|
-
endpoint # Optional.
|
230
|
-
interval # frequency to pull data
|
231
|
-
readOnly # True or false. This is to control the deletion of message after it is read
|
232
|
-
# Add any more parameters here
|
233
|
-
</source>
|
234
|
-
|
235
|
-
<match alert.$plugin>
|
236
|
-
type stdout
|
237
|
-
</match>
|
238
|
-
EOF
|
239
|
-
|
240
|
-
|
241
|
-
cat >test/helper.rb <<EOF
|
242
|
-
require 'rubygems'
|
243
|
-
require 'bundler'
|
244
|
-
begin
|
245
|
-
Bundler.setup(:default, :development)
|
246
|
-
rescue Bundler::BundlerError => e
|
247
|
-
$stderr.puts e.message
|
248
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
249
|
-
exit e.status_code
|
250
|
-
end
|
251
|
-
require 'test/unit'
|
252
|
-
|
253
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
254
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
255
|
-
require 'fluent/test'
|
256
|
-
unless ENV.has_key?('VERBOSE')
|
257
|
-
nulllogger = Object.new
|
258
|
-
nulllogger.instance_eval {|obj|
|
259
|
-
def method_missing(method, *args)
|
260
|
-
# pass
|
261
|
-
end
|
262
|
-
}
|
263
|
-
$log = nulllogger
|
264
|
-
end
|
265
|
-
|
266
|
-
require 'fluent/plugin/in_$plugin'
|
267
|
-
|
268
|
-
class Test::Unit::TestCase
|
269
|
-
end
|
270
|
-
EOF
|
271
|
-
|
272
|
-
|
273
|
-
cat >test/plugin/test_in_${plugin}.rb <<EOF
|
274
|
-
require 'helper'
|
275
|
-
|
276
|
-
class ${plugin}TrapInputTest < Test::Unit::TestCase
|
277
|
-
def setup
|
278
|
-
Fluent::Test.setup
|
279
|
-
end
|
280
|
-
|
281
|
-
# Add config here
|
282
|
-
CONFIG = %[
|
283
|
-
# Example hostt 0
|
284
|
-
# Example port 1062
|
285
|
-
# Example tag alert.snmptrap
|
286
|
-
]
|
287
|
-
|
288
|
-
def create_driver(conf=CONFIG)
|
289
|
-
Fluent::Test::InputTestDriver.new(Fluent::${plugin}TrapInput).configure(conf)
|
290
|
-
end
|
291
|
-
|
292
|
-
# Configure the test
|
293
|
-
def test_configure
|
294
|
-
d = create_driver('')
|
295
|
-
# Example assert_equal "0".to_i, d.instance.host
|
296
|
-
# Example assert_equal "1062".to_i, d.instance.port
|
297
|
-
# Example assert_equal 'alert.snmptrap', d.instance.tag
|
298
|
-
end
|
299
|
-
end
|
300
|
-
EOF
|
data/notes
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
git config --global user.name "Chandrashekar Tippur"
|
2
|
-
git config --global user.email "chandrashekar_tippur@intuit.com"
|
3
|
-
|
4
|
-
cd fluent-plugin-appdynamics
|
5
|
-
git init
|
6
|
-
touch README
|
7
|
-
git add README
|
8
|
-
git commit -m 'first commit'
|
9
|
-
git remote add origin git@gitlab.corp.intuit.net:ioc-tools/fluent-plugin-appdynamics.git
|
10
|
-
git push -u origin master
|
11
|
-
|
12
|
-
cd existing_git_repo
|
13
|
-
git remote add origin git@gitlab.corp.intuit.net:ioc-tools/fluent-plugin-appdynamics.git
|
14
|
-
git push -u origin master
|