summaryrefslogtreecommitdiffstats
path: root/lib/puppet/reports/rrdgraph.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-05 21:22:22 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-05 21:22:22 +0000
commit8f058a0b1bef40edb7a077e370cd3bb5db241e65 (patch)
tree30bd57658a61fa8ff526dfc1223629f2cfc223b0 /lib/puppet/reports/rrdgraph.rb
parentb8920939ade4d9956a7f3b2ba3a2c77a3f788c58 (diff)
downloadpuppet-8f058a0b1bef40edb7a077e370cd3bb5db241e65.tar.gz
puppet-8f058a0b1bef40edb7a077e370cd3bb5db241e65.tar.xz
puppet-8f058a0b1bef40edb7a077e370cd3bb5db241e65.zip
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
Diffstat (limited to 'lib/puppet/reports/rrdgraph.rb')
-rw-r--r--lib/puppet/reports/rrdgraph.rb16
1 files changed, 15 insertions, 1 deletions
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 "<html><body>"
report.metrics.each do |name, metric|
+ metric.basedir = hostdir
metric.store(time)
metric.graph