Klavs Klavsen
2013-Sep-02 13:26 UTC
[Puppet Users] puppetdb - getting a list of specific facts for specific hosts?
I''m trying to query puppetdb for a list of hosts maching a certain regex (on hostname) and only returns 2 facts (ipaddress and hostname) I''m trying to follow: http://docs.puppetlabs.com/puppetdb/latest/api/query/tutorial.html and I''m not even quite sure, wether or not, I should use a facts or a nodes, or a resources query ? I get some of the queries to return just fine.. f.ex. I can query on nodes: curl -X GET -H ''Accept: application/json'' http://localhost:8080/v2/nodes --data-urlencode ''query=["~", ["fact", "hostname"], "webserver"]'' But I can''t figure out how I can make that query, return 1 extra fact (ipaddress).. ? -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Klavs Klavsen
2013-Sep-02 13:41 UTC
[Puppet Users] Re: puppetdb - getting a list of specific facts for specific hosts?
I also tried https://github.com/dalen/puppet-puppetdbquery - but that didn''t really get me any closer :( -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Klavs Klavsen
2013-Sep-02 14:00 UTC
[Puppet Users] Re: puppetdb - getting a list of specific facts for specific hosts?
This gives me the ipaddress (and hostname).. now to figure out how to filter on hostname regex.. ''query=["=", "name", "ipaddress"]'' -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Ken Barber
2013-Sep-03 18:09 UTC
Re: [Puppet Users] Re: puppetdb - getting a list of specific facts for specific hosts?
Is it acceptable to do the search based on ''certname''? ie: curl -G ''http://localhost:8080/v2/facts'' --data-urlencode ''query=["and",["~","certname","puppetdb?"],["or",["=","name","ipaddress"],["=","name","hostname"]]]'' ken. On Mon, Sep 2, 2013 at 7:00 AM, Klavs Klavsen <klavs@enableit.dk> wrote:> This gives me the ipaddress (and hostname).. now to figure out how to filter > on hostname regex.. > > ''query=["=", "name", "ipaddress"]'' > > -- > 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 post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users. > 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Klavs Klavsen
2013-Sep-04 12:35 UTC
Re: [Puppet Users] Re: puppetdb - getting a list of specific facts for specific hosts?
Den tirsdag den 3. september 2013 20.09.19 UTC+2 skrev Ken Barber:> > Is it acceptable to do the search based on ''certname''? ie: > > curl -G ''http://localhost:8080/v2/facts'' --data-urlencode > ''query=["and",["~","certname","puppetdb?"],["or",["=","name","ipaddress"],["=","name","hostname"]]]'' > > >Thank you - that worked beautifully :) Only "detail" - is that it shows 2 results for each host - one for each fact being retrieved. -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Reasonably Related Threads
- PuppetDb Query Help/Problems
- is there any way to see what are the resources exported by a node?
- Confusion with puppetdb (storeconfig) and query database
- Installing puppet master and puppetdb on the same host.
- puppetdb indicated only facts were replaced, no sign of catalog