-
Notifications
You must be signed in to change notification settings - Fork 0
How to use
An example is provided in the examples directory under god.
This example allows you to remotely control god with Jabber.
See the results of the example here.
First, change the jabber account information in the config.yml file to the account you wish the bot to use.
The provided monitor file can be used to control a mongrel cluster of rails apps.
To adapt your own monitor file for use with XMPPBot, add this code to the file:
require 'rubygems'
require 'god_plugin'
config = YAML.load_file('config.yml')
host = config['server']['host']
port = config['server']['port']
#XmmpBot is a custom contact class for usage with a XMMPBot
God.contact(:xmpp_bot) do |c|
c.name = 'user'
c.connect host, port
end
and then, in your conditions, you can specify:
c.notify('user')which will result in god notifying all users chatting with the bot.
To start the bot, run the server.rb file. This will start the bot and the god server.
If your monitor file is not in the same folder as the server, edit the server.rb file to point the start command to your monitorfile, or set the autostart option to false.
DRb.start_service("druby://#{server_host}:#{port}", XMPPBot::XMPPBot.new("God", {:username => username, :password => password, :host => host, :auto_start => false, :start_command => lambda { `god -c /folder/containing/monitor/file/monitor.rb` }, :poll_status => true, :vcard => vcard}, nil, false))
If all is well, you should be able to interact with god through your favorite jabber application.
Other examples: