Weitere ähnliche Inhalte Ähnlich wie PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY (20) Kürzlich hochgeladen (20) PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY8. Lots of Data
Small
environment:
~100
nodes
~800KiB
catalog
30
minute
interval
>3GiB/day
8
9. Lots of Data
Large
environment:
Start
adding
zeros.
Some
users
generate
over
750GiB/day
9
11. Facts
• Collected
with
*every*
puppet
run
• Contain
lots
of
data
about
your
systems
• Available
from
the
inventory
service
11
architecture
=>
i386
augeasversion
=>
0.9.0
boardmanufacturer
=>
Intel
CorporaBon
boardproductname
=>
440BX
Desktop
Reference
Plaeorm
boardserialnumber
=>
None
domain
=>
localdomain
facterversion
=>
1.6.7
fqdn
=>
pe-‐centos6.localdomain
hardwareisa
=>
i686
hardwaremodel
=>
i686
hostname
=>
pe-‐centos6
id
=>
root
interfaces
=>
eth1,lo
ipaddress
=>
172.16.199.144
ipaddress_eth1
=>
172.16.199.144
ipaddress_lo
=>
127.0.0.1
is_virtual
=>
true
kernel
=>
Linux
kernelmajversion
=>
2.6
kernelrelease
=>
2.6.32-‐220.13.1.el6.i686
kernelversion
=>
2.6.32
macaddress
=>
00:0C:
29:19:A2:33
macaddress_eth1
=>
00:0C:
29:19:A2:33
manufacturer
=>
VMware,
Inc.
memoryfree
=>
382.88
MB
memorysize
=>
499.15
MB
memorytotal
=>
499.15
MB
netmask
=>
255.255.255.0
netmask_eth1
=>
255.255.255.0
netmask_lo
=>
255.0.0.0
network_eth1
=>
172.16.199.0
network_lo
=>
127.0.0.0
operaBngsystem
=>
CentOS
operaBngsystemrelease
=>
6.2
osfamily
=>
RedHat
physicalprocessorcount
=>
1
processor0
=>
Intel(R)
Core(TM)
i7-‐2620M
CPU
@
2.70GHz
processorcount
=>
1
13. Exported Resources
# Export the host file entry
@@host { $::fqdn:
host_aliases => $::hostname,
ip => $::ipaddress,
}
# Collect and apply all the host file entries
Host <<| |>>
13
15. Exported Resources
@@nagios_host { $::fqdn:
ensure => present,
alias => $::hostname,
address => $::ipaddress,
use => ‘generic-host’,
}
@@nagios_service { “check_ping_${::hostname}”:
check_command => “check_ping!100.0,20%!500.0,60%”,
use => ‘generic-service’,
notification_period => ‘24x7’,
service_description => “${hostname}_check_ping”,
}
15
58. Scaling
1.Move
HSQLDB
to
Postgres
(at
>
100
nodes)
2.Separate
Postgres
3.MulBple
PuppetDB
servers
4.Clustered
Postgres
5.HTTP(s)
proxy
58
60. REST Interface
• By
default
listens
on
localhost:8080
• Can
easily
set
public
listener
class { ‘puppetdb’:
ssl_listen_address => $::ipaddress_eth0,
ssl_listen_port => ‘8081’,
}
60
65. Querying Facts
[ {
"certname" : "my_host.example.com",
"name" : "architecture",
"value" : "x86_64"
}, {
"certname" : "my_host.example.com",
"name" : "augeasversion",
"value" : "0.10.0"
}, ...
]
65
66. Querying Resources
• Query
all
resources
in
your
infrastructure
• /v2/resources/
• /v2/resources/<type>
• /v2/resources/<type>/<9tle>
66
67. Querying Resources
[ {
"parameters" : {
"ensure" : "running",
"enable" : true
},
"sourceline" : 139,
"sourcefile" : "/etc/puppetlabs/puppet/modules/puppetdb/
manifests/server.pp",
...
"title" : "pe-puppetdb",
"type" : "Service",
"certname" : "puppetdb"
}, ... ]
67
68. Querying Nodes
• Query
all
or
specific
nodes
for
facts
and
resources
• /v2/nodes
• /v2/nodes/<node
name>
• /v2/nodes/<node
name>/resources
• /v2/nodes/<node
name>/facts
68
72. Query Operators
• Binary
Operators
•
=
(equality)
•
>
(greater
than)
•
<
(less
than)
•
>=
(less
than
or
equal
to)
•
<=
(greater
than
or
equal
to)
•
~
(regexp
match)
• Boolean
Operators
•
and
•
or
•
not
72
73. Query Example
curl -G
-H ‘Accept: application/json’
http://localhost:8080/v2/resources
--data-urlencode
‘query=[“=”,“sourcefile”,“/etc/puppet/manifests/site.pp”]’
73
74. Helpful Curl Switches
-G
-H ‘Accept: application/json’
--data-urlencode <data>
--cacert /etc/puppet/ssl/certs/ca.pem
--cert /etc/puppet/ssl/certs/<node>.pem
--key /etc/puppet/ssl/private_keys/<node>.pem
74