FAQ
Hi everybody,

Is there a command-line program which parses:

   puppetmasters*:/var/lib/puppet/reports/*/*.yaml

into simple a simple (though lengthy) report perhaps with
column/field/etc. selection based on a straightforward method.

Holler if you know of any. I know this was queried by me
on this list recently and all sorts of stuff was posted. If
I don't get it here, I'll need to go over to puppet-developers
and ask there.

Surely, someone has written something they're proud of and
will share it forward.

Stuart

--
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 puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/97ac73f0-f64a-4a09-b571-da222b3bdb1a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Dan White at Dec 13, 2013 at 12:59 am

    On Dec 12, 2013, at 6:20 PM, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart
    On Nov 26, 2013, at 2:27 PM, Dan White 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" <smcracraft@me.com>
    To: puppet-users@googlegroups.com
    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" wrote:


    ----- Original Message -----
    From: "Stuart Cracraft" <smcracraft@gmail.com>
    To: puppet-users@googlegroups.com
    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.

    “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)

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F5C8FE40-A9A0-4A8C-84B6-4BFDDD937ADD%40comcast.net.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 13, 2013 at 1:09 am
    Do you personally use something
    more comprehensive with all fields
    enabled?
    On Dec 12, 2013, at 4:59 PM, Dan White wrote:

    On Dec 12, 2013, at 6:20 PM, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart
    On Nov 26, 2013, at 2:27 PM, Dan White 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" <smcracraft@me.com>
    To: puppet-users@googlegroups.com
    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" wrote:


    ----- Original Message -----
    From: "Stuart Cracraft" <smcracraft@gmail.com>
    To: puppet-users@googlegroups.com
    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.

    “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)

    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F5C8FE40-A9A0-4A8C-84B6-4BFDDD937ADD%40comcast.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F00BCA03-423F-4381-AA78-01F2A75318C7%40me.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dan White at Dec 13, 2013 at 4:03 am
    No.
    I whipped that sample up in about 10 minutes.

    It provides a starting point for you to develop what you want.
    On Dec 12, 2013, at 8:09 PM, Stuart Cracraft wrote:

    Do you personally use something
    more comprehensive with all fields
    enabled?
    “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)

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/0D6FF77B-2D05-43A4-B42B-C1268179D221%40comcast.net.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 13, 2013 at 4:07 am
    Great.

    Okay - anyone additionally, how would you extend Dan's script to dump the entirety of a Puppet YAML
    to a plain text report.

    I know, I know. It sounds boring, painful even but the rationale is to know exactly
    what the YAML says even though it is voluminous.

    The reason?

    Our Security Group would like to have complete visibility to logs in simple formats they can parse
    and understand and socialize it to the C-suite with. Also, it can be used to analyze Puppet's proposed
    operations in noop mode prior to an eventual turnup in full 7x24x365 mode for selected subsets of
    our cloud.
    On Dec 12, 2013, at 8:03 PM, Dan White wrote:

    No.
    I whipped that sample up in about 10 minutes.

    It provides a starting point for you to develop what you want.
    On Dec 12, 2013, at 8:09 PM, Stuart Cracraft wrote:

    Do you personally use something
    more comprehensive with all fields
    enabled?
    “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)

    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/0D6FF77B-2D05-43A4-B42B-C1268179D221%40comcast.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3EFA4955-6A98-4246-BC72-E805A9830713%40me.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • John Warburton at Dec 13, 2013 at 4:32 am

    On 13 December 2013 15:07, Stuart Cracraft wrote:

    Our Security Group would like to have complete visibility to logs in
    simple formats they can parse
    and understand and socialize it to the C-suite with. Also, it can be used
    to analyze Puppet's proposed
    operations in noop mode prior to an eventual turnup in full 7x24x365 mode
    for selected subsets of
    our cloud.
    Are you using puppet dashboard? You can get the same information in CSV
    format from http://localhost:3000/nodes.csv. It has the same information as
    the yaml reports, but in "easier" (familiar) to manage CSV format, and
    always up to date when you suck it from the dashboard. Here's a line of an
    out of sync resource:

    hostname,pending,736,34,0,702,File,/etc/sudoers,0.483092,XXXX/modules/sudoers/manifests/init.pp,22,2013-12-11
    23:16 UTC,0,1,false,false

    You don't get everything (like a diff on the file),and it is a good idea to
    omit in sync resources (!~ /,0,0,[a-z]*,false/)

    And why hasn't someone written exactly what you want? Because probably
    no-one has the exact requirements of your organisation. So, at some stage
    you're going to have to do some custom work.

    Or even better, engage puppet labs to do what you want, and ensure it gets
    rolled back into the product for the community. That's where the totting up
    the # resources and states and the CSV dump of the dashboard came from...

    John

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAAJLFxVfb8A9TwsEng%2B2VK_eFarRa7a%3DkRMMGYu9hu%2BTvmBUGw%40mail.gmail.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 13, 2013 at 5:23 am
    John,

    I will look into this tomorrow.

    It sounds like the solution.

    Thanks very much.

    Stuart
    On Dec 12, 2013, at 8:32 PM, John Warburton wrote:

    On 13 December 2013 15:07, Stuart Cracraft wrote:
    Our Security Group would like to have complete visibility to logs in simple formats they can parse
    and understand and socialize it to the C-suite with. Also, it can be used to analyze Puppet's proposed
    operations in noop mode prior to an eventual turnup in full 7x24x365 mode for selected subsets of
    our cloud.

    Are you using puppet dashboard? You can get the same information in CSV format from http://localhost:3000/nodes.csv. It has the same information as the yaml reports, but in "easier" (familiar) to manage CSV format, and always up to date when you suck it from the dashboard. Here's a line of an out of sync resource:

    hostname,pending,736,34,0,702,File,/etc/sudoers,0.483092,XXXX/modules/sudoers/manifests/init.pp,22,2013-12-11 23:16 UTC,0,1,false,false

    You don't get everything (like a diff on the file),and it is a good idea to omit in sync resources (!~ /,0,0,[a-z]*,false/)

    And why hasn't someone written exactly what you want? Because probably no-one has the exact requirements of your organisation. So, at some stage you're going to have to do some custom work.

    Or even better, engage puppet labs to do what you want, and ensure it gets rolled back into the product for the community. That's where the totting up the # resources and states and the CSV dump of the dashboard came from...

    John



    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAAJLFxVfb8A9TwsEng%2B2VK_eFarRa7a%3DkRMMGYu9hu%2BTvmBUGw%40mail.gmail.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F1E84CBD-E759-46DD-8C6A-2051409C81A9%40me.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dan White at Dec 13, 2013 at 4:42 am
    Extending the script depends on what yaml files you plan to parse and what serialized objects are contained therein.

    http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/
    On Dec 12, 2013, at 11:07 PM, Stuart Cracraft wrote:

    Great.

    Okay - anyone additionally, how would you extend Dan's script to dump the entirety of a Puppet YAML
    to a plain text report.

    I know, I know. It sounds boring, painful even but the rationale is to know exactly
    what the YAML says even though it is voluminous.

    The reason?

    Our Security Group would like to have complete visibility to logs in simple formats they can parse
    and understand and socialize it to the C-suite with. Also, it can be used to analyze Puppet's proposed
    operations in noop mode prior to an eventual turnup in full 7x24x365 mode for selected subsets of
    our cloud.
    On Dec 12, 2013, at 8:03 PM, Dan White wrote:

    No.
    I whipped that sample up in about 10 minutes.

    It provides a starting point for you to develop what you want.
    “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)

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/A5133F3F-CAAC-45D3-BD84-8D8CA5A174DF%40comcast.net.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 13, 2013 at 5:23 am
    Thank-you Dan.

    Stuart
    On Dec 12, 2013, at 8:42 PM, Dan White wrote:

    Extending the script depends on what yaml files you plan to parse and what serialized objects are contained therein.

    http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/
    On Dec 12, 2013, at 11:07 PM, Stuart Cracraft wrote:

    Great.

    Okay - anyone additionally, how would you extend Dan's script to dump the entirety of a Puppet YAML
    to a plain text report.

    I know, I know. It sounds boring, painful even but the rationale is to know exactly
    what the YAML says even though it is voluminous.

    The reason?

    Our Security Group would like to have complete visibility to logs in simple formats they can parse
    and understand and socialize it to the C-suite with. Also, it can be used to analyze Puppet's proposed
    operations in noop mode prior to an eventual turnup in full 7x24x365 mode for selected subsets of
    our cloud.
    On Dec 12, 2013, at 8:03 PM, Dan White wrote:

    No.
    I whipped that sample up in about 10 minutes.

    It provides a starting point for you to develop what you want.
    “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)

    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/A5133F3F-CAAC-45D3-BD84-8D8CA5A174DF%40comcast.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F9F7B799-A94D-437C-9069-CFA1B65C8035%40me.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 16, 2013 at 8:29 pm
    Is the back-end piece of Puppet Dashboard which implements the
    CSV-capability
    of the YAML interpretation available as a standalone?
    On Thursday, December 12, 2013 3:20:41 PM UTC-8, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d333f68c-ad66-40bb-b969-9248114cd766%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jeff Bachtel at Dec 17, 2013 at 10:05 pm
    Have you tried a yaml to csv converter like
    https://github.com/tokland/yaml2csv ? Note that it seems to require the
    csv module syntax from ruby 1.9.3.

    Jeff
    On 12/16/2013 03:29 PM, Stuart Cracraft wrote:
    Is the back-end piece of Puppet Dashboard which implements the
    CSV-capability
    of the YAML interpretation available as a standalone?

    On Thursday, December 12, 2013 3:20:41 PM UTC-8, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/puppet-users/d333f68c-ad66-40bb-b969-9248114cd766%40googlegroups.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52B0CA5A.2010505%40bericotechnologies.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 17, 2013 at 10:26 pm
    This is very interesting Jeff.

    I will play with it.

    Thanks!
    On Dec 17, 2013, at 2:04 PM, Jeff Bachtel wrote:

    Have you tried a yaml to csv converter like https://github.com/tokland/yaml2csv ? Note that it seems to require the csv module syntax from ruby 1.9.3.

    Jeff
    On 12/16/2013 03:29 PM, Stuart Cracraft wrote:
    Is the back-end piece of Puppet Dashboard which implements the CSV-capability
    of the YAML interpretation available as a standalone?
    On Thursday, December 12, 2013 3:20:41 PM UTC-8, Stuart Cracraft wrote:

    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d333f68c-ad66-40bb-b969-9248114cd766%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52B0CA5A.2010505%40bericotechnologies.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/C3562BA3-489B-41ED-807E-1D877B595B07%40me.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 17, 2013 at 11:39 pm
    Alas, it was all for naught.

    Anyone know about the uninitialized constant Yaml2csv error?

    [root@ca-sna-pm01 bin]# /usr/local/bin/yaml2csv.rb foobar.yml

    ./yaml2csv.rb:43: uninitialized constant Yaml2csv (NameError)

             from
    /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in
    `gem_original_require'

             from
    /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in
    `require'

             from /usr/local/bin/yaml2csv.rb:7

    [root@ca-sna-pm01 bin]#


    Stuart
    On Tuesday, December 17, 2013 2:20:47 PM UTC-8, Stuart Cracraft wrote:

    This is very interesting Jeff.

    I will play with it.

    Thanks!

    On Dec 17, 2013, at 2:04 PM, Jeff Bachtel wrote:

    Have you tried a yaml to csv converter like
    https://github.com/tokland/yaml2csv ? Note that it seems to require the
    csv module syntax from ruby 1.9.3.

    Jeff

    On 12/16/2013 03:29 PM, Stuart Cracraft wrote:

    Is the back-end piece of Puppet Dashboard which implements the
    CSV-capability
    of the YAML interpretation available as a standalone?
    On Thursday, December 12, 2013 3:20:41 PM UTC-8, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/puppet-users/d333f68c-ad66-40bb-b969-9248114cd766%40googlegroups.com
    .
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    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/GxeE-URziu8/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/puppet-users/52B0CA5A.2010505%40bericotechnologies.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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fb001798-f3a4-41fd-8de3-1145ac304fa3%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Stuart Cracraft at Dec 20, 2013 at 10:45 pm
    Not just placing all trust in Puppet. That's the point of this tiny program
    now named

       yaml2csv.rb

    If you revise/improve, you must post back your improved version.

    And remember, by ensuring you noop your Puppet cloud and review it first
    before actions,
    you will keep the human in the loop before you un-noop and puppet agent -t
    from a far,
    rerun on all the YAML's, and see what you did in an actual human-readable
    format.

    Imagine that?

    The fear, of course, is that some kind of whacko code gets into Puppet (I
    know, open
    source and all that), but, frankly, I can't take that chance so verifying
    and proofing
    mass-cloud changers is what I'm into.

    Happy Hacking,

    Stuart

    #!/usr/bin/ruby

    require 'puppet'



    output = ""



    # Are there args?

    if defined?(ARGV)



        # First argument needs to be the yaml file

        filename = ARGV.first



        # Has to be defined

        if defined?(filename)



          # Make a real version we can work on that is not frozen

          fileName = filename.dup



          # Get the report object

          report = YAML.load_file(filename)



          # Get the base name of the file to the far right

          fileName = File.basename(filename)



          # Formulate the timestamp

          dateStamp = fileName.split /\./



          # Loop through the logs and print appropriately

          report.logs.each do |logg|

           if logg.line or logg.line == 0 then

             output = sprintf("%s, %s, %s, %s, (line %s), %s, %s, %s",

                      report.host,

                      dateStamp[0],

                      logg.time,

                      logg.file,

                      logg.line,

                      logg.source,

                      logg.level,

                      logg.message

                       )

             searchResult = output.grep(/changed|noop/)

             if searchResult.any? then

               printf("%s\n",output)

             end

           else

             output = sprintf("%s, %s, %s, %s, (line %s), %s, %s, %s",

                      report.host,

                      dateStamp[0],

                      logg.time,

                      logg.file,

                      "none",

                      logg.source,

                      logg.level,

                      logg.message

                       )

             searchResult = output.grep(/changed|noop/)

             if searchResult.any? then

               printf("%s\n",output)

             end

           end

         end

       end

    end

    # Bless Ygor. Merry Christmas everybody!!!!
    On Thursday, December 12, 2013 3:20:41 PM UTC-8, Stuart Cracraft wrote:


    Hi everybody,

    Is there a command-line program which parses:

    puppetmasters*:/var/lib/puppet/reports/*/*.yaml

    into simple a simple (though lengthy) report perhaps with
    column/field/etc. selection based on a straightforward method.

    Holler if you know of any. I know this was queried by me
    on this list recently and all sorts of stuff was posted. If
    I don't get it here, I'll need to go over to puppet-developers
    and ask there.

    Surely, someone has written something they're proud of and
    will share it forward.

    Stuart
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e5d8be43-cd80-4b79-bf4c-4a52f2c408bb%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedDec 12, '13 at 11:20p
activeDec 20, '13 at 10:45p
posts14
users5
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase