puppetboard icon indicating copy to clipboard operation
puppetboard copied to clipboard

csv export

Open KlavsKlavsen opened this issue 12 years ago • 7 comments

Just got a question to deliver a list for a boss, who wanted to "play with the results" in a spreadsheet.

Found myself missing puppet-dashboard's CSV export feature :)

It would be great, if one could export all lists (complete list of nodenames, and also resultsets under facts) as csv.

KlavsKlavsen avatar Nov 06 '13 09:11 KlavsKlavsen

You're going to have to be a bit more specific here. I never used the CSV export so I have no idea what data it exported and how that was structured.

daenney avatar Nov 06 '13 10:11 daenney

the idea was to merely get the resultset in a csv export format. f.ex. a fact search on physicalprocessorcount - which shows a list of nodenames and a number, would simply have a ilnk to "csv export", which would return a list with: name, physicalprocessorcount node1.example.net,2 node2.example.net,1

KlavsKlavsen avatar Nov 06 '13 11:11 KlavsKlavsen

Hi, i'm maybe little late, but here a simple way to do it: #!/usr/bin/python import sys reload(sys) sys.setdefaultencoding("utf-8") from pypuppetdb import connect db = connect()

facts = db.facts() for fact in facts: print fact.node + ';', fact.name + ';', fact.value

And you can parse it to create your final csv file.

regards

dominiquearpin avatar Sep 10 '14 17:09 dominiquearpin

Are there any plans to add this as a feature? I too could use it in my organisation.

larsnaesbye avatar Jun 28 '17 09:06 larsnaesbye

@KlavsKlavsen Did you find a usable workaround that we can add as pull request, or should we work on it?

larsnaesbye avatar Sep 19 '17 09:09 larsnaesbye

@larsnaesbye I'm sorry I really have forgotten how I resolved this.. I think I just wrote some python - using pypuppetdb plugin - which can easily get a list hosts who has a certain fact and the facts contents. Thats what I'd do today anyways :)

KlavsKlavsen avatar Sep 19 '17 11:09 KlavsKlavsen

@KlavsKlavsen : okay, that sounds reasonable. I just think it would be better if we implemented a simple button/link that dumped the table to CSV or similar.

larsnaesbye avatar Sep 19 '17 12:09 larsnaesbye