Thanks Ygor and R.I. Pienaar.
that's exactly what i was looking for!

Regards,
David


On Tuesday, November 26, 2013 8:27:20 PM UTC+1, Ygor wrote:
>
> Reference: 
> http://docs.puppetlabs.com/puppet/3/reference/format_report.html 
>
> Start with this: 
> ----------------------------------------------------------------------------------------
>  
>
> #!/usr/bin/ruby 
>
> require 'puppet' 
> if defined?(ARGV) 
>     filename = ARGV.first 
>
>     if defined?(filename) 
>         report = YAML.load_file(filename) 
>         print "Report for : " 
>         puts report.host 
>         print "Started : " 
>         puts report.time 
>         print "Log count: " 
>         puts report.logs.size 
>         print "Metrics count: " 
>         puts report.metrics.size 
>         print "Resource Status count: " 
>         puts report.resource_statuses.size 
>         print "Status: " 
>         puts report.status 
>
>         report.logs.each do |logg| 
>             puts "LOG ---------------------------------------------" 
>             if logg.file 
>                 print "File: " 
>                 puts logg.file 
>             end 
>
>             if logg.line 
>                 print "Line: " 
>                 puts logg.line 
>             end 
>
>             print "Level: " 
>             puts logg.level 
>             print "Message: " 
>             puts logg.message 
>             print "Source: " 
>             puts logg.source 
>             print "Tags: " 
>             puts logg.tags.join(" ") 
>             print "Time: " 
>             puts logg.time 
>         end 
>
>         report.resource_statuses.keys.each do |kk| 
>             if report.resource_statuses["#{kk}"].change_count > 0 
>                 puts "RESOURCE STATUS 
> ====================================" 
>                 puts "#{kk} " 
>                 report.resource_statuses["#{kk}"].events.each do |line| 
>                     print "property: " 
>                     puts line.property 
>                     print "message: " 
>                     puts line.message 
>                     print "name: " 
>                     puts line.name 
>                     print "status: " 
>                     puts line.status 
>                     print "when: " 
>                     puts line.time 
>                 end 
>             end 
>         end 
>         puts "-------------------------------------------------" 
>     end 
> end 
> ------------------------------------------------------------------------------------------
>  
>
>
> Good luck. 
>
>
> “Sometimes I think the surest sign that intelligent life exists elsewhere 
> in the universe is that none of it has tried to contact us.” 
> Bill Waterson (Calvin & Hobbes) 
>
> ----- Original Message ----- 
> From: "Stuart Cracraft" <[email protected] <javascript:>> 
> To: [email protected] <javascript:> 
> Sent: Tuesday, November 26, 2013 2:10:53 PM 
> Subject: Re: [Puppet Users] get a *structured* version of the puppet agent 
> output 
>
> Who will share a report generator for the yaml reports generated by puppet 
> so that we do not have to reinvent wheel after wheel after wheel!!!!!! 
>
> > On Nov 26, 2013, at 11:08 AM, "R.I.Pienaar" <[email protected]<javascript:>> 
> wrote: 
> > 
> > 
> > 
> > ----- Original Message ----- 
> >> From: "Stuart Cracraft" <[email protected] <javascript:>> 
> >> To: [email protected] <javascript:> 
> >> Sent: Tuesday, November 26, 2013 7:02:42 PM 
> >> Subject: Re: [Puppet Users] get a *structured* version of the puppet 
> agent output 
> >> 
> >> What we want is not more complexity, but more simplicity! 
> >> 
> >> I could go into 
> >> 
> >>  puppet config print reportdir 
> >> 
> >> and then to its 
> >> 
> >>  /var/lib/puppet/reports 
> >> 
> >> then to the host directories of interest and grep out message. 
> >> 
> >> But that seems a very sorry state of affairs. 
> >> 
> >> Puppetmasters speak UP! 
> > 
> > you do not need to grep out anything, as I showed you there is a ruby 
> API 
> > for accessing this data. 
> > 
> > If you use PuppetDB it will also be able to store this information and 
> it has 
> > APIs for extracting these logs in a structured manner. 
> > 
> > API access is about as much as you can hope for I think.  Your 
> alternatives are 
> > to write a logger plugin for Puppet that outputs JSON, I've done this 
> and it 
> > was not clear sailing. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> Google Groups "Puppet Users" group. 
> > To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/puppet-users/cHpZlKkPmr4/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an email to 
> [email protected] <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/1024951816.609.1385492893475.JavaMail.zimbra%40devco.net.
>  
>
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group. 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>. 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/6E1AA223-0401-485C-8E4C-AABF12FB2291%40me.com.
>  
>
> For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ed0eb173-36d8-4771-b253-79593b4dacb6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to