1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ERP5: id-store-interval must be big enough to avoid conflicts (e.g. 1000)
# XXX: Because supervisord can't handle too many processes
# ("too many open files to spawn" errors), these SR
# should instantiate the source processes differently.
[buildout]
extends = test-fluentd-common.cfg
[template-erp5-patched]
extra =
[request-balancer]
config-inituser-login = {{ dumps(inituser_login) }}
config-inituser-password = $${publish-early:inituser-password}
[template-balancer]
recipe =
target = ${template-balancer-patched:location}
[template-balancer-base]
<= template-balancer
recipe = slapos.recipe.build:download
[template-balancer-patched]
<= template-fluentd
base = ${template-balancer-base:target}
tags =
{%- set port, backend_list = haproxy_dict['fluentd'] %}
{%- for i in range(100*len(backend_list)) %}
{%- do tags.__setitem__('wendelin_tag_' ~ i, ipv4 ~ ':' ~ port) %}
{%- endfor %}
[feeder]
feeder =
#
import collections, random, struct
pack = struct.Struct('!d').pack
data = collections.deque(
''.join(chr(int(random.gauss(0, .68)) % 256) for _ in xrange(2500))
# With a period greater than 64kiB (zlib dictionary size),
# we avoid extra compression due to repetition.
for _ in xrange(30))
interval = 60 # XXX: same as fluentd flush internal
time.sleep(interval * random.random())
while True:
emit('', pack(time.time()) + data[0])
data.rotate()
time.sleep(interval)