Write an automated task that catches the response from the streams for
example:
task :cluster_uptime, :roles => 'all' do
run("uptime") do |channel, stream, data|
data_from_stdout << data if stream == :stdout
end
puts date_from_stdout ## or write it to sql (if you also need the
hostnme, then
end
run("$(uptime)::::$(hostname)")
(for example)
On 11 August 2010 08:23, Justin <[email protected]> wrote:
> We are playing with Capistrano to poll our cluster of servers. We have
> it up and running, and are able to send commands to all of our servers
> like:
>
> $cap shell
>
> cap> uptime
> [establishing connection(s) to web1.XXXXXX.com, db1.XXXXXX.com,
> web1.XXXXXX.com, web2.XXXXXX.com, db1.XXXXXX.com, web1.XXXXXX.com,
> db1.XXXXXX.com, web1.XXXXXX.com, db1.XXXXXX.com]
> ** [out :: web1.XXXXXX.com] 23:11:24 up 23:18, 0 users, load
> average: 0.00, 0.00, 0.00
> ** [out :: web2.XXXXXX.com] 23:11:24 up 22:28, 0 users, load
> average: 0.00, 0.00, 0.00
> ** [out :: db1.XXXXXX.com] 23:11:25 up 23:22, 0 users, load
> average: 0.00, 0.00, 0.00
> ** [out :: db1.XXXXXX.com] 01:11:31 up 5 days, 2:51, 0 users, load
> average: 0.00, 0.00, 0.00
> ** [out :: web1.XXXXXX.com] 23:11:36 up 4 days, 6:06, 0 users,
> load average: 0.00, 0.00, 0.00
> ** [out :: web1.XXXXXX.com] 01:11:33 up 5 days, 2:33, 0 users,
> load average: 0.00, 0.00, 0.00
> ** [out :: db1.XXXXXXX.com] 23:11:40 up 6 days, 3:38, 0 users,
> load average: 0.00, 0.00, 0.00
> ** [out :: web1.XXXXXX.com] 23:11:33 up 3 days, 20:23, 0 users,
> load average: 0.00, 0.00, 0.00
> ** [out :: db1.XXXXXX.com] 23:11:39 up 7 days, 21:41, 0 users, load
> average: 0.00, 0.00, 0.00
>
> What is the best way to process this information though. We wish to
> store the results into a MySQL database. So like:
>
> INSERT INTO load_averages (server, minute, five_minute,
> fifteen_minute) VALUES ('web1.XXXXXX.com', 0.00, 0.00, 0.00);
>
> Thanks.
>
> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected]<capistrano%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en