puppet MCollective 命令行使用

【puppet MCollective常用命令行 】

 #mco inventory hotpu

Inventory for hotpu:

Server Statistics:
Version: 2.8.4
Start Time: Mon May 30 18:53:09 +0800 2016
Config File: /etc/mcollective/server.cfg
Collectives: mcollective
Main Collective: mcollective
Process ID: 2260
Total Messages: 1
Messages Passed Filters: 1
Messages Filtered: 0
Expired Messages: 0
Replies Sent: 0
Total Processor Time: 91.79 seconds
System Time: 72.83 seconds

Agents:
discovery filemgr nrpe
package puppet rpcutil
service shell

………………

#mco inventory hotpu | awk '/Facts:/','/^$/'
Facts:
architecture => x86_64
augeasversion => 1.0.0
bios_release_date => 08/10/2007
bios_vendor => Dell Inc.
bios_version => 1.5.1

………………

 #mco facts hostname
Report for fact: hostname

computer001   found 1 times
computer002  found 1 times
computer003  found 1 times

cat inventory.mc

inventory do
format "%20s %8s %10s %-20s"
fields {[ identity, facts["architecture"],facts["operatingsystem"], facts["operatingsystemrelease"]
]}
end

#mco inventory --script inventory.mc
hotpu x86_64 CentOS 6.6
computer001 x86_64 CentOS 6.5
computer002 x86_64 CentOS 6.7
computer003 x86_64 CentOS 6.7

#mco plugin doc mc
mc
==

MCollective Broadcast based discovery

Author: R.I.Pienaar <rip@devco.net>
Version: 0.1
License: ASL 2.0
Timeout: 2
Home Page: http://marionette-collective.org/

DISCOVERY METHOD CAPABILITIES:
Filter based on configuration management classes
Filter based on system facts
Filter based on mcollective identity
Filter based on mcollective agents
Compound filters combining classes and facts

#echo "computer001" > host && mco rpc rpcutil ping --disc-method flatfile --disc-option ./host
Discovering hosts using the flatfile method .... 1

* [ ============================================================> ] 1 / 1
computer001
Timestamp: 1464848863

Finished processing 1 / 1 hosts in 29.80 ms

 #mco find --with-identity /c/
mco find --with-fact operatingsystem=CentOS 

#查看操作系统为CentOS的MC 服务端机器列表

mco find --with-agent package 
mco ping --select "operatingsystem=CentOS and !environment=dev"
 mco facts osfamily --limit 5 --with-class base
mco package status sudo --batch 10 --batch-sleep 20

#查看软件包状态