Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

will read from /etc/node_name when possible.

  • Loading branch information...
commit 9c4b0eb9c5a5d125fd8711c2b39d94443f948e77 1 parent 8aad80d
@dhruvbansal dhruvbansal authored
View
29 .gitignore
@@ -1,21 +1,22 @@
-## MAC OS
-.DS_Store
-## TEXTMATE
-*.tmproj
-tmtags
-## EMACS
-*~
-\#*
-.\#*
-## VIM
-*.swp
+
+## EMACS
+## MAC OS
## PROJECT::GENERAL
+## PROJECT::SPECIFIC
+## TEXTMATE
+## VIM
+*.swp
+*.tmproj
+*~
+.DS_Store
+.\#*
+/TAGS
+\#*
coverage
-rdoc
pkg
-
-## PROJECT::SPECIFIC
+rdoc
+tmtags
View
2  examples/toy.rb
@@ -11,4 +11,4 @@ def get_metrics metrics, since
end
end
-ToyMonitor.new('toy').run!
+ToyMonitor.new('toy').run! if $0 == __FILE__
View
6 graphiterb.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{graphiterb}
- s.version = "0.2.5"
+ s.version = "0.2.11"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Philip (flip) Kromer (@mrflip)"]
- s.date = %q{2010-08-18}
+ s.date = %q{2010-09-22}
s.description = %q{Uses http://github.com/mrflip/configliere and http://graphite.wikidot.com}
s.email = %q{info@infochimps.org}
s.extra_rdoc_files = [
@@ -32,7 +32,9 @@ Gem::Specification.new do |s|
"examples/toy.rb",
"graphiterb.gemspec",
"lib/graphiterb.rb",
+ "lib/graphiterb/accumulator.rb",
"lib/graphiterb/monitors.rb",
+ "lib/graphiterb/monitors/accumulations_consumer.rb",
"lib/graphiterb/monitors/directory_tree.rb",
"lib/graphiterb/monitors/disk_space.rb",
"lib/graphiterb/monitors/system.rb",
View
3  lib/graphiterb.rb
@@ -13,5 +13,6 @@ module Graphiterb
Settings.define :carbon_port, :default => '2003', :description => "Port for carbon database server", :required => true
Settings.define :update_delay, :default => 30, :description => "How long to wait between updates. Must be faster than the value in the graphite/conf/storage-schemas", :required => true, :type => Integer
Settings.define :on_error_delay, :default => 0.1, :description => "How long to wait on connect errors", :required => true, :type => Float
-
+Settings.define :node_name_file, :default => '/etc/node_name', :description => "Path to a file which contains the name of this node", :type => String
Settings.read '/etc/graphiterb/graphiterb.yaml' if File.exist? '/etc/graphiterb/graphiterb.yaml'
+Settings.resolve!
View
11 lib/graphiterb/utils/system.rb
@@ -8,9 +8,16 @@ module Utils
module SystemInfo
def hostname
- @hostname ||= `hostname`.chomp.gsub(".","_")
+ @hostname ||= `hostname`.chomp.gsub(/\./,"_")
+ end
+
+ def node_name
+ @node_name ||= Settings[:node_name_file] && File.exist?(Settings[:node_name_file]) && File.read(Settings[:node_name_file]).chomp.strip.gsub(/\./, '_')
+ end
+
+ def graphite_identifier
+ node_name || hostname
end
-
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.