AgentPuppetd¶
Introduction¶
Simple agent to enable, disable or kick off a runonce of your puppet client daemons.
Note: There are design issues with how Puppet handles locking which means doing disable/enable while a Puppetd is busy doesn’t work reliably. Several bugs have been filed against Puppet about these issues see #3757, #5139, #5246 and #5153
You can now run the normal puppet daemon as well as cause runs via MCollective. This agent will send a HUP signal if it detects that the puppet daemon is running. This version of the agent will incorrectly report a puppet agent as Idling when it’s in fact stopped. This is due to a Puppet bug that has been fixed in releases 2.7.10 and 2.6.14.
Installation¶
- The source for the plugin is GitHub
- Follow the basic plugin install guide
Configuration¶
You can specify some paths, splay time etc in the mcollective server.cfg here’s a sample, by default it uses paths correct for RedHat systems
plugin.puppetd.puppetd = /usr/sbin/puppetd plugin.puppetd.lockfile = /var/lib/puppet/state/puppetdlock plugin.puppetd.statefile = /var/lib/puppet/state/state.yaml plugin.puppet.pidfile = /var/run/puppet/agent.pid plugin.puppetd.splaytime = 100 plugin.puppet.summary = /var/lib/puppet/state/last_run_summary.yaml
Most settings are obvious, if you set splaytime your puppetd will run with —splaylimit x —splay by default but you can still on demand insist on immediate runs, by default it will splay.
Usage¶
General Usage¶
The included mco puppetd application is a wrapper around the common usage:
% mco puppetd -W /dev_server/ status * [ ============================================================> ] 2 / 2 dev1.xx.net Enabled, not running, last run 805 seconds ago dev2.xx.net Enabled, not running, last run 3281 seconds ago
You can also use these instead of status: runonce, enable, disable, count and runall
Forcing runs¶
% mco puppetd -W customer=rip runonce * [ ============================================================> ] 2 / 2 Finished processing 2 / 2 hosts in 1614.84 ms
This will do a run based on your splay setting, if you wanted to force an immediate run supply -f
Running all nodes¶
In the event that you want to run all your nodes as quick as possible you can use the mc-puppetd script to do this and enforce a maximum concurrency for these runs:
% mco puppetd -W /dev_server/ runall 2 Thu Aug 05 17:47:21 +0100 2010> Running all machines with a concurrency of 2 Thu Aug 05 17:47:21 +0100 2010> Discovering hosts to run Thu Aug 05 17:47:23 +0100 2010> Found 4 hosts Thu Aug 05 17:47:24 +0100 2010> Running dev1.one.net, concurrency is 0 Thu Aug 05 17:47:26 +0100 2010> dev1.one.net schedule status: OK Thu Aug 05 17:47:28 +0100 2010> Running dev1.two.net, concurrency is 1 Thu Aug 05 17:47:30 +0100 2010> dev1.two.net schedule status: OK Thu Aug 05 17:47:32 +0100 2010> Running dev2.two.net, concurrency is 2 Thu Aug 05 17:47:34 +0100 2010> dev2.two.net schedule status: OK Thu Aug 05 17:47:35 +0100 2010> Currently 3 nodes running, waiting Thu Aug 05 17:48:00 +0100 2010> Running dev3.two.net, concurrency is 2 Thu Aug 05 17:48:05 +0100 2010> dev3.two.net schedule status: OK
Here we’re running all our machines with the class /dev_server/ but never more than 2 at a time.
SimpleRPC¶
This plugin is a normal SimpleRPC plugin you can interact with it using the normal mc-rpc as below:
% mco rpc puppetd status
Determining the amount of hosts matching filter for 2 seconds .... 2
* [ ============================================================> ] 2 / 2
dev1.example.net
Running: 0
Enabled: 1
Last Run: 1291118239
Status: Enabled, not running, last run 592 seconds ago
dev2.example.net
Enabled: 1
Running: 0
Status: Enabled, not running, last run 3068 seconds ago
Last Run: 1291115763
Finished processing 2 / 2 hosts in 148.11 ms
As of version 2.6.8 of Puppet a structured summary report of each run gets reported, if you have this version of puppet you can look at these summaries as below:
% mco puppetd summary -I dev1.example.com
* [ ============================================================> ] 1 / 1
dev1.example.com
Events:
{"total"=>0}
Resources:
{"failed"=>0, "changed"=>0, "total"=>564, "restarted"=>0, "out_of_sync"=>0}
Times:
{"group"=>0.001191,
"last_run"=>1302783490,
"class"=>0.227961,
"config_retrieval"=>14.0457620620728,
"yumrepo"=>0.041724,
"service"=>3.984237,
"cron"=>0.001888,
"schedule"=>0.002933,
"total"=>35.4312370620728,
"package"=>0.678558,
"file"=>15.59021,
"exec"=>0.846986,
"filebucket"=>0.000321,
"user"=>0.009466}
Changes:
{"total"=>0}
Finished processing 1 / 1 hosts in 39.24 ms
This would typically be used to write a monitoring system rather than interactive use like this.