diff options
author | Rein Henrichs <rein@puppetlabs.com> | 2010-05-20 14:41:22 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | c00285c395647bc19237ec6c60099d11997592bb (patch) | |
tree | e30bcff922d76c087774a9ba47629940091b2543 /lib/puppet | |
parent | 1d49defe9b2a5f7725d74d2d73880ed342399d83 (diff) | |
download | puppet-c00285c395647bc19237ec6c60099d11997592bb.tar.gz puppet-c00285c395647bc19237ec6c60099d11997592bb.tar.xz puppet-c00285c395647bc19237ec6c60099d11997592bb.zip |
[#3810] Add http reports processor and `reporturl` setting
Example puppet.conf:
[puppetmasterd]
reports = store, http
reporturl = http://localhost:3000/reports
* Group reporturl and reportdir in new reports section of
Puppet::Settings
* Add specs for both
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/defaults.rb | 18 | ||||
-rw-r--r-- | lib/puppet/reports/http.rb | 22 |
2 files changed, 33 insertions, 7 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 775e26ad9..1e1fc1556 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -436,13 +436,6 @@ module Puppet in puppet/reports/<name>.rb, and multiple report names should be comma-separated (whitespace is okay)." ], - :reportdir => {:default => "$vardir/reports", - :mode => 0750, - :owner => "service", - :group => "service", - :desc => "The directory in which to store reports - received from the client. Each client gets a separate - subdirectory."}, :fileserverconfig => ["$confdir/fileserver.conf", "Where the fileserver configuration is stored."], :rrddir => {:default => "$vardir/rrd", @@ -630,6 +623,17 @@ module Puppet "What files to ignore when pulling down facts."] ) + setdefaults :reports, + :reportdir => {:default => "$vardir/reports", + :mode => 0750, + :owner => "service", + :group => "service", + :desc => "The directory in which to store reports + received from the client. Each client gets a separate + subdirectory."}, + :reporturl => ["http://localhost:3000/reports", + "The URL used by the http reports processor to send reports"] + setdefaults(:tagmail, :tagmap => ["$confdir/tagmail.conf", "The mapping between reporting tags and email addresses."], diff --git a/lib/puppet/reports/http.rb b/lib/puppet/reports/http.rb new file mode 100644 index 000000000..d74782cf8 --- /dev/null +++ b/lib/puppet/reports/http.rb @@ -0,0 +1,22 @@ +require 'puppet' +require 'net/http' +require 'uri' + +Puppet::Reports.register_report(:http) do + + desc <<-DESC + Send report information via HTTP to the ``reporturl``. Each host sends + its report as a YAML dump and this sends this YAML to a client via HTTP POST. + The YAML is the `report` parameter of the request." + DESC + + def process + url = URI.parse(Puppet[:reporturl]) + req = Net::HTTP::Post.new(url.path) + req.body = self.to_yaml + req.content_type = "application/x-yaml" + Net::HTTP.new(url.host, url.port).start {|http| + http.request(req) + } + end +end |