newrelic_ia 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ #uncomment the lines below and specify host and port
2
+
3
+ localhost:11211
4
+ #localhost:11211
@@ -0,0 +1,58 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+ require 'new_relic/ia/memcached_sampler'
3
+ # http://rspec.info/
4
+ describe NewRelic::IA::MemcachedSampler do
5
+
6
+ before do
7
+ #NewRelic::Agent.instance.log.level = Logger::DEBUG
8
+ NewRelic::Agent.reset_stats
9
+ @sampler = NewRelic::IA::MemcachedSampler.new
10
+ logger = Logger.new(STDOUT)
11
+ logger.level = Logger::INFO
12
+ @sampler.stubs(:logger).returns(logger)
13
+
14
+ # @statsengine = stub(:get_stats => @stats)
15
+ @statsengine = NewRelic::Agent::StatsEngine.new
16
+ @sampler.stats_engine = @statsengine
17
+ @sampler.stubs(:memcached_nodes).returns(["localhost:11211"])
18
+ @statsengine.clear_stats
19
+ end
20
+
21
+ it "should parse stats" do
22
+ file = File.open(File.join(File.dirname(__FILE__),"memcached-1.out"), "r")
23
+ stats_text = file.read
24
+ @sampler.stubs(:issue_stats).returns(stats_text)
25
+
26
+ @sampler.poll
27
+ @statsengine.metrics.each do |m|
28
+ stats = @statsengine.lookup_stat m
29
+ stats.call_count.should == 1
30
+ m.should match(/System\/Memcached.*/)
31
+ end
32
+ end
33
+ it "should parse nil stats" do
34
+ @sampler.stubs(:issue_stats).returns(nil)
35
+ @sampler.poll
36
+ @statsengine.metrics.each do |m|
37
+ stats = @statsengine.lookup_stat m
38
+ stats.call_count.should == 0
39
+ end
40
+
41
+ @sampler.stubs(:issue_stats).returns("")
42
+ @sampler.poll
43
+
44
+ @statsengine.metrics.each do |m|
45
+ stats = @statsengine.lookup_stat m
46
+ puts "#{m}: #{stats}"
47
+ stats.call_count.should == 0
48
+ end
49
+ end
50
+ # it "should poll on demand" do
51
+ # 2.times { @sampler.poll }
52
+ # @statsengine.metrics.each do |m|
53
+ # stats = @statsengine.lookup_stat m
54
+ # stats.call_count.should == 2
55
+ # m.should match(/System\/Filesystem\/.*percent/)
56
+ # end
57
+ # end
58
+ end
@@ -1,14 +1,16 @@
1
1
  begin
2
2
  require 'spec'
3
+ require 'newrelic_ia'
4
+ require 'newrelic_rpm'
3
5
  rescue LoadError
4
6
  require 'rubygems' unless ENV['NO_RUBYGEMS']
5
7
  gem 'rspec'
6
8
  require 'spec'
9
+ require 'newrelic_ia'
10
+ require 'newrelic_rpm'
7
11
  end
8
12
 
9
13
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
- require 'newrelic_ia'
11
- require 'newrelic_rpm'
12
14
  require 'new_relic/ia/cli'
13
15
  module NewRelic; TEST = true; end unless defined? NewRelic::TEST
14
16
  NewRelic::IA::CLI.level = Logger::ERROR
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_ia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Bill Kayser
@@ -9,74 +14,80 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-06-24 00:00:00 -07:00
13
- default_executable:
17
+ date: 2010-04-12 00:00:00 -07:00
18
+ default_executable: newrelic_ia
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: newrelic_rpm
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
23
- version: 2.9.2
24
- version:
25
- description: The New Relic Infrastructure Agent (IA) collects system metrics and transmits them to the RPM server where they can be viewed with custom dashboards.
27
+ segments:
28
+ - 2
29
+ - 10
30
+ - 6
31
+ version: 2.10.6
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: |
35
+ The New Relic Infrastructure Agent (IA) collects system metrics and transmits
36
+ them to the RPM server where they can be viewed with custom dashboards.
37
+
26
38
  email: bkayser@newrelic.com
27
39
  executables:
28
40
  - newrelic_ia
29
41
  extensions: []
30
42
 
31
43
  extra_rdoc_files:
32
- - bin/newrelic_ia
33
44
  - CHANGELOG
34
- - lib/new_relic/ia/cli.rb
35
- - lib/new_relic/ia/disk_sampler.rb
36
- - lib/new_relic/ia/iostat_reader/linux.rb
37
- - lib/new_relic/ia/iostat_reader/osx.rb
38
- - lib/new_relic/ia/iostat_reader.rb
39
- - lib/new_relic/ia/metric_names.rb
40
- - lib/new_relic/ia/newrelic.yml
41
- - lib/newrelic_ia.rb
45
+ - LICENSE
42
46
  - README.rdoc
43
- - tasks/rspec.rake
44
- files:
45
47
  - bin/newrelic_ia
48
+ files:
46
49
  - CHANGELOG
50
+ - README.rdoc
51
+ - Rakefile
47
52
  - lib/new_relic/ia/cli.rb
48
53
  - lib/new_relic/ia/disk_sampler.rb
54
+ - lib/new_relic/ia/iostat_reader.rb
49
55
  - lib/new_relic/ia/iostat_reader/linux.rb
50
56
  - lib/new_relic/ia/iostat_reader/osx.rb
51
- - lib/new_relic/ia/iostat_reader.rb
57
+ - lib/new_relic/ia/memcached_sampler.rb
52
58
  - lib/new_relic/ia/metric_names.rb
53
59
  - lib/new_relic/ia/newrelic.yml
60
+ - lib/new_relic/ia/version.rb
54
61
  - lib/newrelic_ia.rb
55
- - Manifest
56
- - Rakefile
57
- - README.rdoc
58
62
  - spec/cli_spec.rb
59
63
  - spec/disk_sampler_spec.rb
60
64
  - spec/iostat-linux.out
61
65
  - spec/iostat-osx.out
62
66
  - spec/iostat_reader_spec.rb
67
+ - spec/memcached-1.out
68
+ - spec/memcached-nodes.txt
69
+ - spec/memcached_sampler_spec.rb
63
70
  - spec/spec.opts
64
71
  - spec/spec_helper.rb
65
72
  - tasks/rspec.rake
66
- - newrelic_ia.gemspec
73
+ - LICENSE
74
+ - bin/newrelic_ia
67
75
  has_rdoc: true
68
76
  homepage: http://www.newrelic.com
69
- post_install_message: |
77
+ licenses: []
78
+
79
+ post_install_message: |+
70
80
 
71
81
  For more information refer to http://support.newrelic.com or
72
82
  say 'newrelic' at #newrelic on freenode IRC.
73
-
83
+
74
84
  rdoc_options:
85
+ - --charset=UTF-8
75
86
  - --line-numbers
76
87
  - --inline-source
77
88
  - --title
78
- - Newrelic_ia
79
- - --main
89
+ - New Relic Gem for gathering system metrics
90
+ - -m
80
91
  - README.rdoc
81
92
  require_paths:
82
93
  - lib
@@ -84,23 +95,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
95
  requirements:
85
96
  - - ">="
86
97
  - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
87
100
  version: "0"
88
- version:
89
101
  required_rubygems_version: !ruby/object:Gem::Requirement
90
102
  requirements:
91
103
  - - ">="
92
104
  - !ruby/object:Gem::Version
93
- version: "1.2"
94
- version:
105
+ segments:
106
+ - 0
107
+ version: "0"
95
108
  requirements: []
96
109
 
97
- rubyforge_project: newrelic
98
- rubygems_version: 1.3.1
110
+ rubyforge_project:
111
+ rubygems_version: 1.3.6
99
112
  signing_key:
100
- specification_version: 2
113
+ specification_version: 3
101
114
  summary: New Relic Gem for gathering system metrics
102
115
  test_files:
103
116
  - spec/cli_spec.rb
104
117
  - spec/disk_sampler_spec.rb
105
118
  - spec/iostat_reader_spec.rb
119
+ - spec/memcached_sampler_spec.rb
106
120
  - spec/spec_helper.rb
data/Manifest DELETED
@@ -1,21 +0,0 @@
1
- bin/newrelic_ia
2
- CHANGELOG
3
- lib/new_relic/ia/cli.rb
4
- lib/new_relic/ia/disk_sampler.rb
5
- lib/new_relic/ia/iostat_reader/linux.rb
6
- lib/new_relic/ia/iostat_reader/osx.rb
7
- lib/new_relic/ia/iostat_reader.rb
8
- lib/new_relic/ia/metric_names.rb
9
- lib/new_relic/ia/newrelic.yml
10
- lib/newrelic_ia.rb
11
- Manifest
12
- Rakefile
13
- README.rdoc
14
- spec/cli_spec.rb
15
- spec/disk_sampler_spec.rb
16
- spec/iostat-linux.out
17
- spec/iostat-osx.out
18
- spec/iostat_reader_spec.rb
19
- spec/spec.opts
20
- spec/spec_helper.rb
21
- tasks/rspec.rake
@@ -1,41 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{newrelic_ia}
5
- s.version = "0.1.0"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Bill Kayser"]
9
- s.date = %q{2009-06-24}
10
- s.default_executable = %q{newrelic_ia}
11
- s.description = %q{The New Relic Infrastructure Agent (IA) collects system metrics and transmits them to the RPM server where they can be viewed with custom dashboards.}
12
- s.email = %q{bkayser@newrelic.com}
13
- s.executables = ["newrelic_ia"]
14
- s.extra_rdoc_files = ["bin/newrelic_ia", "CHANGELOG", "lib/new_relic/ia/cli.rb", "lib/new_relic/ia/disk_sampler.rb", "lib/new_relic/ia/iostat_reader/linux.rb", "lib/new_relic/ia/iostat_reader/osx.rb", "lib/new_relic/ia/iostat_reader.rb", "lib/new_relic/ia/metric_names.rb", "lib/new_relic/ia/newrelic.yml", "lib/newrelic_ia.rb", "README.rdoc", "tasks/rspec.rake"]
15
- s.files = ["bin/newrelic_ia", "CHANGELOG", "lib/new_relic/ia/cli.rb", "lib/new_relic/ia/disk_sampler.rb", "lib/new_relic/ia/iostat_reader/linux.rb", "lib/new_relic/ia/iostat_reader/osx.rb", "lib/new_relic/ia/iostat_reader.rb", "lib/new_relic/ia/metric_names.rb", "lib/new_relic/ia/newrelic.yml", "lib/newrelic_ia.rb", "Manifest", "Rakefile", "README.rdoc", "spec/cli_spec.rb", "spec/disk_sampler_spec.rb", "spec/iostat-linux.out", "spec/iostat-osx.out", "spec/iostat_reader_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "newrelic_ia.gemspec"]
16
- s.has_rdoc = true
17
- s.homepage = %q{http://www.newrelic.com}
18
- s.post_install_message = %q{
19
- For more information refer to http://support.newrelic.com or
20
- say 'newrelic' at #newrelic on freenode IRC.
21
- }
22
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Newrelic_ia", "--main", "README.rdoc"]
23
- s.require_paths = ["lib"]
24
- s.rubyforge_project = %q{newrelic}
25
- s.rubygems_version = %q{1.3.1}
26
- s.summary = %q{New Relic Gem for gathering system metrics}
27
- s.test_files = ["spec/cli_spec.rb", "spec/disk_sampler_spec.rb", "spec/iostat_reader_spec.rb", "spec/spec_helper.rb"]
28
-
29
- if s.respond_to? :specification_version then
30
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
31
- s.specification_version = 2
32
-
33
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
34
- s.add_runtime_dependency(%q<newrelic_rpm>, [">= 2.9.2"])
35
- else
36
- s.add_dependency(%q<newrelic_rpm>, [">= 2.9.2"])
37
- end
38
- else
39
- s.add_dependency(%q<newrelic_rpm>, [">= 2.9.2"])
40
- end
41
- end