a20018d1468a1dc8a72fe3667e05daa69d89e6f2
[packages/precise/mcollective.git] / website / reference / plugins / rpcutil.md
1 ---
2 layout: default
3 title: The rpcutil Agent
4 toc: false
5 ---
6
7 We include an agent with a few utilities and helpers there to assist in retrieving information about the running mcollectived.
8
9 We aim to add the ability to initiate reloads and so forth in this agent too in future, this
10 will require further internal refactoring though.
11
12 ## _inventory_ Action
13
14 Retrieves an inventory of the facts, classes and agents and plugins on the system, takes no arguments
15 and returns a hash like this:
16
17 {% highlight ruby %}
18 {:agents   => ["rpcutil", "discovery"],
19  :facts     => {"mcollective"=>1},
20  :classes   => ["common::linux", "motd"],
21  :data_plugins=>["sysctl_data", "fstat_data"],
22  :collectives=>["mcollective"],
23  :main_collective=>"mcollective",
24  :version=>"2.0.0"}
25 {% endhighlight %}
26
27 ## _daemon`_`stats_ Action
28
29 Retrieves statistics about the running daemon, how many messages it's handled, passed, dropped etc.
30
31 See the DDL for the agent for a full reference
32
33 {% highlight ruby %}
34 {:configfile=>"/etc/mcollective/server.cfg",
35  :validated=>46,
36  :threads=>      ["#<Thread:0xb7dcf480 sleep>",
37                   "#<Thread:0xb7fba704 sleep>",
38                   "#<Thread:0xb7dcfb88 run>"],
39  :starttime=>1284305683,
40  :agents=>["rpcutil", "discovery"],
41  :unvalidated=>0,
42  :pid=>15499,
43  :times=>{:cutime=>0.0, :utime=>0.15, :cstime=>0.0, :stime=>0.02},
44  :passed=>46,
45  :total=>46,
46  :filtered=>0,
47  :replies=>45}
48 {% endhighlight %}
49
50 Replies will always be less than received since the current message has not been sent yet when the stats are gathered.
51
52 ## _get`_`fact_ Action
53
54 Retrieves a single fact from the server
55
56 {% highlight ruby %}
57 {:fact   => "mcollective",
58  :value  => 1}
59 {% endhighlight %}
60
61 ## _agent`_`inventory_ Action
62
63 Returns a list of all agents with their meta data like version, author, license etc
64
65 {% highlight ruby %}
66 {:agents=> [
67               {:agent=>"discovery",
68                :license=>"Apache License, Version 2",
69                :author=>"R.I.Pienaar <rip@devco.net>"},
70
71               {:agent=>"rpcutil",
72                :license=>"Apache License, Version 2.0",
73                :name=>"Utilities and Helpers for SimpleRPC Agents",
74                :url=>"http://marionette-collective.org/",
75                :description=> "General helpful actions that expose stats and internals to SimpleRPC clients",
76                :version=>"1.0",
77                :author=>"R.I.Pienaar <rip@devco.net>",
78                :timeout=>3}
79            ]
80 }
81 {% endhighlight %}
82
83 ## _get`_`config`_`item_ Action
84
85 Retrieves the active value for any configuration item on a server
86
87 {% highlight ruby %}
88 {:item   => "loglevel",
89  :value  => "debug"}
90 {% endhighlight %}
91
92 ## _ping_ Action
93
94 A simple lightweight ping action that just returns each nodes local time
95
96 {% highlight ruby %}
97 {:pong   => 1295471526}
98 {% endhighlight %}
99
100 ## _collective`_`info_ Action
101
102 Retrieves the main and sub collectives configured
103
104 For a server configured with:
105
106 {% highlight ruby %}
107 collectives = mcollectivedev,subdev1
108 main_collective = mcollectivedev
109 {% endhighlight %}
110
111 The following structure gets returned:
112
113 {% highlight ruby %}
114 {:collectives=>["mcollectivedev", "subdev1"],
115  :main_collective=>"mcollectivedev"}
116 {% endhighlight %}