instance-monitor.cfg.jinja2 3.59 KB
Newer Older
1 2
[buildout]

3 4
extends = {{ monitor_template_output }}

5 6
parts =
  cron
7
  cron-network-bench
8 9
  symlink-re6st-logs
  symlink-collected-logs
10
  python-symlink
11 12
  monitor-collect-csv-wrapper
  monitor-base
13 14
  monitor-check-memory-usage
  monitor-check-cpu-usage
15
  publish-connection-information
16

17

18 19
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
20 21
offline = true

22 23 24 25
[cron-network-bench]
<= cron
recipe = slapos.cookbook:cron.d
name = network-bench-test
26
frequency = */10 * * * *
Alain Takoudjou's avatar
Alain Takoudjou committed
27 28 29 30
# skip to not fill cron log file.
# command = {{ buildout_bin }}/networkbench ${network-bench-configuration:rendered} ${monitor-directory:monitor-log}
command = true

31

32 33
[symlink-re6st-logs]
recipe = cns.recipe.symlink
34
symlink = /var/log/re6stnet = ${monitor-directory:system-log}/re6stnet
35 36 37 38
autocreate = true

[symlink-collected-logs]
recipe = cns.recipe.symlink
39
symlink = /srv/slapgrid/var/data-log = ${monitor-directory:server-log}/data-log
40
autocreate = true
41 42 43

[network-bench-configuration]
recipe = slapos.recipe.template:jinja2
44 45
template = {{ network_benck_cfg_output }}
rendered = ${monitor-directory:etc}/network_bench.cfg
46 47
mode = 0744
context =
48
  key slapparameter_dict slap-configuration:configuration
49

50 51 52 53 54 55 56 57 58 59
[pwgen]
recipe = slapos.cookbook:generate.password
user = admin
bytes = 16

[pwgen32]
recipe = slapos.cookbook:generate.password
user = admin
bytes = 16

60 61 62
[monitor-instance-parameter]
monitor-httpd-port = {{ slap_configuration['configuration.monitor-base-port'] }}

63
[monitor-directory]
64 65 66 67 68 69
service = ${buildout:directory}/etc/service
var = ${buildout:directory}/var
srv = ${buildout:directory}/srv
server-log = ${:private}/server-log
monitor-log = ${:private}/monitor-log
system-log = ${:private}/system-log
Alain Takoudjou's avatar
Alain Takoudjou committed
70
consumption = ${:log}/consumption
71

72 73 74 75 76
[python-symlink]
recipe = plone.recipe.command
command = ln -sf {{ buildout_bin }}/pythonwitheggs ${monitor-directory:bin}/python
update-command = ${:command}

77 78 79
[monitor-collect-csv-wrapper]
recipe = slapos.cookbook:wrapper
command-line = 
Alain Takoudjou's avatar
Alain Takoudjou committed
80
  ${monitor-directory:bin}/python {{ monitor_collect_csv_dump }} --output_folder ${monitor-directory:consumption}
81
wrapper-path = ${monitor-directory:bin}/monitor-collect-csv-dump  
82

83
[monitor-check-memory-usage]
84 85 86 87
<= monitor-promise-base
module = check_command_execute
name = check-computer-memory-usage.py
config-command = {{ buildout_bin}}/check-computer-memory -db ${monitor-instance-parameter:collector-db} --threshold ${slap-parameter:memory-percent-threshold} --unit percent
88

89 90 91 92 93 94 95 96 97 98 99
[monitor-check-cpu-usage]
recipe = slapos.cookbook:promise.plugin
eggs =
  slapos.toolbox
file = ${monitor-conf-parameters:promise-output-file}
content = 
  from slapos.promise.plugin.check_server_cpu_load import RunPromise
output = ${directory:plugins}/system-CPU-load-check.py
mode = 600
config-cpu-load-threshold = ${slap-parameter:cpu-load-threshold}

100 101
[publish-connection-information]
recipe = slapos.cookbook:publish
102 103
monitor-setup-url = https://monitor.app.officejs.com/#page=settings_configurator&url=${monitor-publish-parameters:monitor-url}&username=${monitor-publish-parameters:monitor-user}&password=${monitor-publish-parameters:monitor-password}
server_log_url = ${monitor-publish-parameters:monitor-base-url}/${slap-configuration:private-hash}/ 
104 105 106 107 108 109 110 111 112 113

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
private-hash = ${pwgen:passwd}${pwgen32:passwd}
frontend-domain = 
114 115

[slap-parameter]
116 117
# Max cpu load for one core on server
cpu-load-threshold = 3.0
118
memory-percent-threshold = 96