This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Puppet::Parser::Functions | |
newfunction(:gradual_deploy, :type => :rvalue, :arity => 4, :doc => "\ | |
Gradually deploy something | |
Arguments are from, to, start and finish. Will gradually move from returning <from> | |
to returning <to> over the duration between <start> and <finish>. | |
start and finish are specified as ruby datetime strings, supports all formats that ruby | |
can parse. | |
") do |args| | |
from, to, start, finish = *args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Puppet::Parser::Functions.newfunction(:query_nodes, :type => :rvalue, :arity => -2, :doc => <<-EOT | |
accepts two arguments, a query used to discover nodes, and a optional | |
fact that should be returned. | |
The query specified should conform to the following format: | |
(Type[title] and fact_name<operator>fact_value) or ... | |
Package["mysql-server"] and cluster_id=my_first_cluster | |
The second argument should be single fact (this argument is optional) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Determines which role a machine has. | |
# For example for lon2-pl4cassandra-a1 this will return 'pl4cassandra' | |
Facter.add('role') do | |
setcode do | |
if (Facter.fqdn =~ /[[:alpha:]]+\d*-([a-z0-9]+)-[[:alpha:]]+\d+/) == 0 then | |
next $1 | |
end | |
nil | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rather this: | |
# Sets up NTP client | |
class ntp ( | |
$server # Server address | |
) { | |
... | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puppetdb=# select * from pg_statio_all_tables where schemaname='public'; | |
relid | schemaname | relname | heap_blks_read | heap_blks_hit | idx_blks_read | idx_blks_hit | toast_blks_read | toast_blks_hit | tidx_blks_read | tidx_blks_hit | |
-------+------------+-------------------------+----------------+---------------+---------------+--------------+-----------------+----------------+----------------+--------------- | |
16455 | public | catalog_resources | 3342606866 | 9262119774 | 979685526 | 668733437342 | 0 | 0 | 0 | 0 | |
16489 | public | schema_migrations | 7 | 31 | 14 | 41 | | | | | |
16552 | public | resource_events | 62059176 | 728183445 | 257889288 | 7405931285 | 47214 | 91996 | 983 | 215746 | |
16539 | public | reports | 4749413 | 247689 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puppetdb=# select * from pg_stat_all_tables where schemaname='public'; | |
relid | schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | last_vacuum | last_autovacuum | last_analyze | last_autoanalyze | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count | |
-------+------------+-------------------------+----------+--------------+------------+---------------+------------+-----------+------------+---------------+------------+------------+-------------+-------------------------------+--------------+-------------------------------+--------------+------------------+---------------+------------------- | |
16455 | public | catalog_resources | 9122 | 39959606875 | 35291772 | 7313691435 | 809557259 | 0 | 802674911 | 0 | 5781907 | 1013101 | | 2013-07-08 22:33:51.260409+00 | | 2013-07-09 10:17:11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puppetdb=# select * from pg_stat_database where datname='puppetdb'; | |
datid | datname | numbackends | xact_commit | xact_rollback | blks_read | blks_hit | tup_returned | tup_fetched | tup_inserted | tup_updated | tup_deleted | conflicts | stats_reset | |
-------+----------+-------------+-------------+---------------+------------+--------------+--------------+-------------+--------------+-------------+-------------+-----------+------------------------------- | |
16389 | puppetdb | 67 | 19350645 | 7158 | 5203673932 | 730840051209 | 296150976554 | 39856410308 | 3042400442 | 19151545 | 2915288790 | 0 | 2013-05-03 15:27:17.030942+00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -H "Accept: application/json" 'http://localhost:8080/v2/metrics/mbean/com.puppetlabs.puppetdb.http.server:type=v2,name=service-time' | |
{ | |
"75thPercentile" : 316.5253225, | |
"OneMinuteRate" : 5.468794013251904, | |
"Max" : 385878.543307, | |
"StdDev" : 1153.933689578002, | |
"FifteenMinuteRate" : 5.882720806763954, | |
"Mean" : 454.27047779070443, | |
"Min" : 0.204288, | |
"MeanRate" : 5.717926515448163, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class postgresql ( | |
$version = '9.2', | |
$datadir = "/var/lib/postgresql/${version}/main", | |
) { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class foo ( | |
$package_name = $osfamily ? { | |
Debian => libfoo-ruby, | |
Redhat => ruby-foo, | |
}, | |
$param2, | |
$param3, | |
) { | |
.... | |
} |