Skip to content

Commit

Permalink
Graphite integration fixes. Bumped version to 0.0.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
luckymike committed Nov 11, 2011
1 parent 1baeb33 commit 97cdbee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ganglia/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs/Configures ganglia"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.0.8"
version "0.0.9"

%w{ debian ubuntu redhat centos fedora }.each do |os|
supports os
Expand Down
7 changes: 6 additions & 1 deletion ganglia/recipes/graphite.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
include_recipe "graphite"
graphite_host = search(:node, "role:#{node['ganglia']['server_role']} AND chef_environment:#{node.chef_environment}").map {|node| node.ipaddress}
if graphite_host.empty?
graphite_host = "localhost"
end

template "/usr/local/sbin/ganglia_graphite.rb" do
source "ganglia_graphite.rb.erb"
mode "744"
variables :graphite_host => graphite_host
end

cron "ganglia_graphite" do
Expand Down
6 changes: 3 additions & 3 deletions ganglia/templates/default/ganglia_graphite.rb.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/ruby
#!/usr/bin/env ruby

#################################################################################
# Parse Ganglia XML stream and send metrics to Graphite
Expand All @@ -12,14 +12,14 @@ require 'socket'
# Adjust to the appropriate values
ganglia_hostname = 'localhost'
ganglia_port = 8649
graphite_host = 'localhost'
graphite_host = '<%= @graphite_host %>'
graphite_port = 2003
Debug = false

begin
# Open up a socket to gmond
file = TCPSocket.open(ganglia_hostname, ganglia_port)
# Open up a socke to graphite
# Open up a socket to graphite
graphite = TCPSocket.open(graphite_host, graphite_port)
# We need current time stamp in UNIX time
now = Time.now.to_i
Expand Down

0 comments on commit 97cdbee

Please sign in to comment.