From 8f058a0b1bef40edb7a077e370cd3bb5db241e65 Mon Sep 17 00:00:00 2001 From: luke Date: Thu, 5 Oct 2006 21:22:22 +0000 Subject: Fixing the rrdgraph report so that it creates a separate rrd directory for each host git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1735 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/reports/rrdgraph.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/puppet/reports') diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb index 29eca4aeb..0fb7e2ea7 100644 --- a/lib/puppet/reports/rrdgraph.rb +++ b/lib/puppet/reports/rrdgraph.rb @@ -3,9 +3,23 @@ require 'puppet' Puppet::Server::Report.newreport(:rrdgraph) do |report| time = Time.now.to_i - File.open(File.join(Puppet[:rrddir],"index.html"),"w") { |of| + host = report.host + + hostdir = File.join(Puppet[:rrddir], host) + + unless File.directory?(hostdir) + # Some hackishness to create the dir + config = Puppet::Config.new + config.setdefaults(:reports, :hostdir => [hostdir, "eh"]) + + # This creates the dir. + config.use(:reports) + end + + File.open(File.join(hostdir, "index.html"),"w") { |of| of.puts "" report.metrics.each do |name, metric| + metric.basedir = hostdir metric.store(time) metric.graph -- cgit