Last Modified
2014-06-23 23:30:44 +0000
Requires
  • rubygems
  • irb
  • bond
  • mcollective

Description

Simple IRB shell for mcollective

mc-irb nrpe
Determining the amount of hosts matching filter for 2 seconds .... 47
>> rpc :runcommand, :command => "check_disks"

 * [ ============================================================> ] 47 / 47

 dev1.your.net                      Request Aborted
    CRITICAL
                 Output: DISK CRITICAL - free space: / 176 MB (4% inode=86%);
              Exit Code: 2
       Performance Data:  /=3959MB;3706;3924;0;4361 /boot=26MB;83;88;0;98 /dev/shm=0MB;217;230;0;256

=> true
>> mchelp
<shows the DDL based help for the chosen agent>
=> true
>> rpc(:runcommand, :command => "check_disks") do |resp|
?> puts resp[:sender] + ":   " + resp[:data][:output]
>> end

 * [ ============================================================> ] 47 / 47

 dev1.your.net:   DISK OK
 <snip>
=> true
>>

You can access the agent variable via @agent from where you can do the usual manipulation of filters etc, if you wish to switch to a different agent mid run just do newagent(“some_other_agent”)

If you install the Bond gem you’ll get some DDL assisted completion in the rpc method