root/lang/ruby/bgpwatch/trunk/example.rb @ 36519

Revision 36519, 1.1 kB (checked in by ihag, 4 years ago)
  • hash tag support
  • Property svn:keywords set to Id
Line 
1#!/usr/local/bin/ruby
2# $Id$
3
4# $LOAD_PATH.unshift '/please/specify/path/to/bgpwatch/lib/bgpwatch.rb'
5$LOAD_PATH.unshift File.expand_path('./lib', File.dirname($0))
6require 'bgpwatch'
7
8class MyNotifier < Notifier::IRCClient
9  server 'irc6.ii-okinawa.ne.jp' # irc.reicha.net
10  port 6667
11  nick 'bgpbot6'
12  realname 'IHANet BGP peer status watcher (http://www.ihanet.info/)'
13  channel '#ihanet'
14  charcode Kconv::JIS # Kconv::AUTO, Kconv::UTF8, Kconv::SJIS, etc.
15end
16
17class TwitterNotifier < Notifier::TwitterNotifier
18  user 'your_twitter_account@example.com'
19  password 'your_twitter_password'
20  hash_tag '#YourHashTag'
21end
22
23class MyWatcher < Watcher::VTY::Quagga
24  server 'localhost'
25  user 'root'
26  password 'your_quagga_vty_password_here'
27  enable_password 'your_quagga_vty_enable_password_here'
28end
29
30class MyStorage < Storage::FileStorage
31  file '/tmp/bgpbot.db'
32end
33
34class MyResolver < Resolver
35  file 'example/ihanet-asnum.txt'
36  readonly
37end
38
39class MyBGPWatch < BGPWatch
40  notifier [MyNotifier, TwitterNotifier]
41  watcher MyWatcher
42  storage MyStorage
43  resolver MyResolver
44  pidfile '/tmp/bgpbot.pid'
45end
46
47MyBGPWatch.new.run
Note: See TracBrowser for help on using the browser.