-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sls
61 lines (55 loc) · 1.55 KB
/
init.sls
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
49
50
51
52
53
54
55
56
57
58
59
60
61
{% set collectd_conf = '/etc/collectd/collectd.conf' %}
{% set smartmon = '/srv/collectd/smartmon.sh' %}
{% set redismon = '/srv/collectd/redis.sh' %}
collectd_ppa:
pkgrepo.managed:
- ppa: vbulax/collectd5
collectd:
pkg.installed:
- require:
- pkgrepo: collectd_ppa
service.running:
- enable: True
- require:
- pkg: collectd
- watch:
- file: {{ collectd_conf }}
smartmontools:
pkg.installed
{{ smartmon }}:
file.managed:
- source: salt://collectd/files{{ smartmon }}
- mode: 755
- require:
- pkg: smartmontools
{{ redismon }}:
file.managed:
- source: salt://collectd/files{{ redismon }}
- mode: 755
{{ collectd_conf }}:
file.managed:
- source: salt://collectd/files{{ collectd_conf }}
- template: jinja
- defaults:
graphite_host: graphite01
graphite_port: 2003
loglevel: info
{% if 'databases' in grains %}
- databases: {{ grains['databases'] }}
{% endif %}
{% if 'filecount' in grains.get('collectd', {}) %}
- filecount: {{ grains['collectd']['filecount'] }}
{% endif %}
{% if 'loglevel' in grains.get('collectd', {}) %}
- loglevel: {{ grains['collectd']['loglevel'] }}
{% endif %}
{% if 'smartmon_drives' in grains.get('collectd', {}) %}
- smartmon_drives: {{ grains['collectd']['smartmon_drives'] }}
{% endif %}
{% if 'redis' in grains.get('collectd', {}) %}
- redis: {{ grains['collectd']['redis'] }}
{% endif %}
- require:
- pkg: collectd
- file: {{ smartmon }}
- file: {{ redismon }}