Importing historical reports from Puppet into Foreman

Is this possible?

We've got foreman collecting reports from Puppet as they occur, but it
would be useful to have the information from runs prior to the installation
of Foreman available.

Thanks,
Simon

Possible, yes. Trivial, not so much.

Foreman has a well-defined API for accepting reports [1], and the
Puppet 'foreman' report processor [2] is responsible for mangling the
raw puppet report into the format Foreman wants. The main issue is
that the report processor expects to be run from within the
puppetmaster - it's calling a viariety of internal methods.

With a bit of hackery, you could probably get it to a standalone
script that takes an old on-disk puppet report and uploads it to
Foreman though - if you do, please consider submitting it upstream, as
that sounds pretty useful!

Cheers
Greg

[1] API documentation
[2] https://github.com/theforeman/puppet-foreman/blob/master/files/foreman-report_v2.rb

··· On 22 September 2015 at 13:36, Simon Hanmer wrote: > Is this possible? > > We've got foreman collecting reports from Puppet as they occur, but it would > be useful to have the information from runs prior to the installation of > Foreman available.

Greg,
thanks for the reply - I'd started looking at the existing foreman.rb
script as a basis for this.

If I do make any progress, I'll happily share it.

··· On Thursday, September 24, 2015 at 1:01:26 PM UTC+1, Greg Sutcliffe wrote: > > On 22 September 2015 at 13:36, Simon Hanmer > wrote: > > Is this possible? > > > > We've got foreman collecting reports from Puppet as they occur, but it > would > > be useful to have the information from runs prior to the installation of > > Foreman available. > > Possible, yes. Trivial, not so much. > > Foreman has a well-defined API for accepting reports [1], and the > Puppet 'foreman' report processor [2] is responsible for mangling the > raw puppet report into the format Foreman wants. The main issue is > that the report processor expects to be run from within the > puppetmaster - it's calling a viariety of internal methods. > > With a bit of hackery, you could probably get it to a standalone > script that takes an old on-disk puppet report and uploads it to > Foreman though - if you do, please consider submitting it upstream, as > that sounds pretty useful! > > Cheers > Greg > > [1] http://theforeman.org/api/1.9/apidoc/v2/reports.html > [2] > https://github.com/theforeman/puppet-foreman/blob/master/files/foreman-report_v2.rb >

I wrote a way to import puppet reports into katello/foreman a long while ago[1]. The code itself may need updating but I'd be glad to assist, if needed. You can find the sample report input here[2]. If you can massage your data into that json format for the Metrics column, then it should work.

If you're comfortable using docker, you can just run this:

docker run -it --rm thomasmckay/katello-hammer hammer --server https://$FOREMAN --username $USER --password $PASSWD csv reports --verbose --file $REPORTS_FILE

[1] https://github.com/Katello/hammer-cli-csv
[2] https://github.com/Katello/hammer-cli-csv/blob/master/test/data/reports.csv

··· ----- Original Message ----- > Greg, > thanks for the reply - I'd started looking at the existing foreman.rb > script as a basis for this. > > If I do make any progress, I'll happily share it. > > On Thursday, September 24, 2015 at 1:01:26 PM UTC+1, Greg Sutcliffe wrote: > > > > On 22 September 2015 at 13:36, Simon Hanmer > > wrote: > > > Is this possible? > > > > > > We've got foreman collecting reports from Puppet as they occur, but it > > would > > > be useful to have the information from runs prior to the installation of > > > Foreman available. > > > > Possible, yes. Trivial, not so much. > > > > Foreman has a well-defined API for accepting reports [1], and the > > Puppet 'foreman' report processor [2] is responsible for mangling the > > raw puppet report into the format Foreman wants. The main issue is > > that the report processor expects to be run from within the > > puppetmaster - it's calling a viariety of internal methods. > > > > With a bit of hackery, you could probably get it to a standalone > > script that takes an old on-disk puppet report and uploads it to > > Foreman though - if you do, please consider submitting it upstream, as > > that sounds pretty useful! > > > > Cheers > > Greg > > > > [1] http://theforeman.org/api/1.9/apidoc/v2/reports.html > > [2] > > https://github.com/theforeman/puppet-foreman/blob/master/files/foreman-report_v2.rb > > > > -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout. >