Ce n'est pas secure de load en http en le formulaire et de le submit en https.
curl -s -G http://localhost:8080/pdb/query/v4/reports --data-urlencode 'query=["=","latest_report?","true"]'| jq '.[] | {certname: .certname, receive_time: .receive_time}'
retrieve last_report older than 30 minutes :
curl -s -G http://localhost:8080/pdb/query/v4/reports --data-urlencode "query=[\"and\",[\"<\",\"receive_time\",\"$(date --utc +%Y-%m-%dT%H:%M -d '30 min ago')\"],[\"=\",\"latest_report?\",\"true\"]]"|jq '.[]| {certname: .certname, receive_time: .receive_time}'
Il faut récupérer le ca.pem du puppetmaster, et les certificats du puppetdb en question
sudo scp $(puppet master --configprint ssldir)/ca/ca_crt.pem puppetdb.example.com:/etc/puppetdb/ssl/ca.pem
$ sudo scp $(puppet master --configprint ssldir)/private_keys/puppetdb.example.com.pem puppetdb.example.com:/etc/puppetdb/ssl/private.pem
$ sudo scp $(puppet master --configprint ssldir)/certs/puppetdb.example.com.pem puppetdb.example.com:/etc/puppetdb/ssl/public.pem
/etc/puppetdb/conf.d/jetty.ini
ssl-host = 0.0.0.0
ssl-port = 8081
ssl-key = /etc/puppetdb/ssl/private.pem
ssl-cert = /etc/puppetdb/ssl/public.pem
ssl-ca-cert = /etc/puppetdb/ssl/ca.pem
With SSL:
curl -X GET https://puppetdb.example.com:8081/pdb/query/v4/resources \
--tlsv1 \
--cacert /etc/puppet/ssl/certs/ca.pem \
--cert /etc/puppet/ssl/certs/thisnode.pem \
--key /etc/puppet/ssl/private_keys/thisnode.pem \
--data-urlencode query@<filename>
This requires that you specify a certificate (issued by the same CA PuppetDB trusts), a private key, and a CA certificate.
In both examples, <filename> should be a file that contains the query to execute.
ngrep -itq -W byline -d any '' port 8125|egrep -v '(^U|^$)'|logtop -s 500000
Nouvel alias :)
cleanq = "/foreach query /unquery";
Pour penser à se bouger/s'étirer un peu toutes les heures