Files: 37d877810de4ac575152439cf1ddabb2ad8d3788 / sbot.god
1445 bytesRaw
1 | require './sbot_notifier.rb' |
2 | |
3 | # Webhook to send notification events |
4 | God.contact(:webhook) do |c| |
5 | c.name = 'god' |
6 | c.group = 'chatroom' |
7 | c.url = "http://donkey.project-entropy.com:3000/" |
8 | c.format = :json |
9 | end |
10 | |
11 | # SSB notifier to send events |
12 | God.contact(:sbot_notifier) do |c| |
13 | c.name = 'god' |
14 | c.group = 'chatroom' |
15 | c.channel = "#test" |
16 | end |
17 | |
18 | God.watch do |w| |
19 | w.name = "Secure Scuttlebutt Server" |
20 | w.start = "sbot server" |
21 | w.keepalive |
22 | |
23 | # restart if memory or cpu is too high |
24 | w.transition(:up, :restart) do |on| |
25 | on.condition(:memory_usage) do |c| |
26 | c.interval = 20 |
27 | c.above = 900.megabytes |
28 | c.times = [3, 5] |
29 | end |
30 | |
31 | on.condition(:cpu_usage) do |c| |
32 | c.interval = 10 |
33 | c.above = 98.percent |
34 | c.times = [3, 5] |
35 | end |
36 | end |
37 | |
38 | # Handle the process lifecycle |
39 | w.lifecycle do |on| |
40 | |
41 | # If this watch is started or restarted five times withing 5 minutes, then unmonitor it |
42 | # then after ten minutes, monitor it again to see if it was just a temporary problem; |
43 | # if the process is seen to be flapping five times within two hours, then give up completely. |
44 | on.condition(:flapping) do |c| |
45 | c.to_state = [:start, :restart] |
46 | c.times = 5 |
47 | c.within = 5.minute |
48 | c.transition = :unmonitored |
49 | c.retry_in = 10.minutes |
50 | c.retry_times = 5 |
51 | c.retry_within = 2.hours |
52 | |
53 | c.notify = {:contacts => ['chatroom'], :priority => 1, :category => 'flapping'} |
54 | end |
55 | end |
56 | end |
57 |
Built with git-ssb-web