prometheus-splash 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -2
  3. data/config/splash.yml +1 -1
  4. data/lib/splash/backends/redis.rb +3 -1
  5. data/lib/splash/constants.rb +1 -1
  6. data/lib/splash/loggers/cli.rb +1 -0
  7. data/lib/splash/orchestrator/grammar.rb +1 -1
  8. data/lib/splash/transports/rabbitmq.rb +2 -2
  9. data/templates/ansible-splash/Vagrantfile +26 -0
  10. data/templates/ansible-splash/deploy.yml +49 -0
  11. data/templates/ansible-splash/group_vars/DEV.yml +22 -0
  12. data/templates/ansible-splash/group_vars/PROD.yml +25 -0
  13. data/templates/ansible-splash/group_vars/all.yml +0 -0
  14. data/templates/ansible-splash/inventory.dev +25 -0
  15. data/templates/ansible-splash/inventory.prod +26 -0
  16. data/templates/ansible-splash/roles/backend/handlers/main.yml +4 -0
  17. data/templates/ansible-splash/roles/backend/tasks/main.yml +13 -0
  18. data/templates/ansible-splash/roles/backend/templates/redis.conf.j2 +1316 -0
  19. data/templates/ansible-splash/roles/mq/handlers/main.yml +5 -0
  20. data/templates/ansible-splash/roles/mq/tasks/main.yml +42 -0
  21. data/templates/ansible-splash/roles/splash/tasks/main.yml +28 -0
  22. data/templates/ansible-splash/roles/splash/templates/splash.yml.j2 +105 -0
  23. data/templates/ansible-splash/roles/supervision_gateway/handlers/main.yml +4 -0
  24. data/templates/ansible-splash/roles/supervision_gateway/tasks/main.yml +5 -0
  25. data/templates/ansible-splash/roles/supervision_master/handlers/main.yml +8 -0
  26. data/templates/ansible-splash/roles/supervision_master/tasks/main.yml +29 -0
  27. data/templates/ansible-splash/roles/supervision_master/templates/alertmanager.yml.j2 +126 -0
  28. data/templates/ansible-splash/roles/supervision_master/templates/prometheus.yml.j2 +33 -0
  29. data/templates/splashd.service +5 -4
  30. metadata +22 -2
@@ -0,0 +1,5 @@
1
+
2
+ ---
3
+ - name: restart rabbitmq
4
+ service: name=rabbitmq-server state=restarted
5
+ become: yes
@@ -0,0 +1,42 @@
1
+ ---
2
+ - name : MQ install MQ service (RabbitMQ)
3
+ package:
4
+ pkg: rabbitmq-server
5
+ state: present
6
+
7
+ - name: MQ enable rabbitmq plugins
8
+ rabbitmq_plugin: names=rabbitmq_management,rabbitmq_tracing,rabbitmq_federation state=enabled
9
+ notify: restart rabbitmq
10
+
11
+ - name: add Admin users
12
+ rabbitmq_user:
13
+ user: "{{ mq_admin_username }}"
14
+ password: "{{ mq_admin_password }}"
15
+ tags: administrator,"{{ mq_admin_username }}"
16
+ vhost: /
17
+ configure_priv: .*
18
+ write_priv: .*
19
+ read_priv: .*
20
+ state: present
21
+
22
+
23
+ - name: remove default guest user
24
+ rabbitmq_user:
25
+ user: guest
26
+ state: absent
27
+
28
+
29
+ - name: MQ Configure Splash vhost
30
+ rabbitmq_vhost:
31
+ name: "{{ mq_splash_vhost }}"
32
+ state: present
33
+
34
+ - name: MQ Add Splash service user
35
+ rabbitmq_user:
36
+ user: "{{ mq_splash_username }}"
37
+ password: "{{ mq_splash_password }}"
38
+ vhost: "{{ mq_splash_vhost}}"
39
+ configure_priv: .*
40
+ read_priv: .*
41
+ write_priv: .*
42
+ state: present
@@ -0,0 +1,28 @@
1
+ ---
2
+ - name : SPLASH install infra (ruby)
3
+ package:
4
+ pkg: ruby
5
+ state: present
6
+
7
+ - name : SPLASH install Splash (gem)
8
+ gem:
9
+ name: prometheus-splash
10
+ state: present
11
+
12
+ - name: SPLASH Check if setup done
13
+ stat:
14
+ path: /etc/splash.yml
15
+ register: stat_result
16
+
17
+ - name: SPLASH Installation
18
+ shell: splash conf set
19
+ when: not stat_result.stat.exists
20
+
21
+ - name: SPLASH Configuration
22
+ template:
23
+ src: splash.yml.j2
24
+ dest: /etc/splash.yml
25
+ owner: root
26
+ group: root
27
+ mode: 0644
28
+ #notify: restart Splash
@@ -0,0 +1,105 @@
1
+ # Splash Configuration
2
+ :splash:
3
+
4
+ ### Main Configuration
5
+ :loggers:
6
+ :level: :info
7
+ :daemon:
8
+ :file: /var/log/splash.log
9
+ :cli:
10
+ :emoji: true
11
+ :color: true
12
+ :templates:
13
+ :execution:
14
+ :path: /etc/splash_execution_report.tpl
15
+ :backends:
16
+ :stores:
17
+ :execution_trace:
18
+ :type: :redis
19
+ :host: "{{ redis_host }}"
20
+ :port: "{{ redis_port }}"
21
+ :auth: "{{ redis_password }}"
22
+ :base: "{{ redis_base }}"
23
+ :transports:
24
+ :active: :rabbitmq
25
+ :rabbitmq:
26
+ :vhost: {{ mq_splash_vhost }}
27
+ :port: {{ mq_port }}
28
+ :host: {{ hostvars[groups['mq'][0]]['ansible_host'] }}
29
+ :passwd: {{ mq_splash_password }}
30
+ :user: {{ mq_splash_username }}
31
+ :daemon:
32
+ :logmon_scheduling:
33
+ :every: 20s
34
+ :process_name: "Splash : daemon."
35
+ :paths:
36
+ :pid_path: /var/run/splash
37
+ :trace_path: /var/run/splash/traces
38
+ :files:
39
+ :stdout_trace: stdout.txt
40
+ :stderr_trace: stderr.txt
41
+ :pid_file: splash.pid
42
+ :prometheus:
43
+ :pushgateway:
44
+ :host: "{{ pushgateway_host }}"
45
+ :port: "{{ pushgateway_port }}"
46
+
47
+
48
+ ### configuration of commands and scheduling
49
+ :commands:
50
+ :id_root:
51
+ :desc: run id command on root
52
+ :command: id root
53
+ :true_test:
54
+ :desc: "test command returning true : 0"
55
+ :command: "true"
56
+ :schedule:
57
+ :every: "1h"
58
+ :on_failure: :ls_slash_tmp
59
+ :on_success: :pwd
60
+ :false_test:
61
+ :desc: "test command returning false > 0"
62
+ :command: "false"
63
+ :schedule:
64
+ :every: "1h"
65
+ :on_failure: :ls_slash_tmp
66
+ :on_success: :pwd
67
+ :ls_slash_tmp:
68
+ :desc: list file in /tmp
69
+ :command: ls -al /tmp
70
+ :user: daemon
71
+ :on_success: :echo1
72
+ :pwd:
73
+ :desc: run pwd
74
+ :command: pwd
75
+ :on_success: :echo1
76
+ :on_failure: :echo2
77
+ :echo1:
78
+ :desc: echo 'foo'
79
+ :command: echo foo
80
+ :on_failure: :echo3
81
+ :echo2:
82
+ :desc: echo 'bar'
83
+ :command: echo bar
84
+ :echo3:
85
+ :desc: echo 'been'
86
+ :command: echo been
87
+ :rand_sleep_5:
88
+ :desc: sleep on a rand 5
89
+ :command: ruby -e 'sleep rand(5)'
90
+ :schedule:
91
+ :every: "10s"
92
+ :test_remote_call:
93
+ :desc: remote call test
94
+ :delegate_to:
95
+ :host: omicron
96
+ :remote_command: :echo2
97
+ :on_success: :echo3
98
+
99
+
100
+ ### configuration of monitored logs
101
+ :logs:
102
+ - :log: /tmp/test
103
+ :pattern: ERROR
104
+ - :log: /tmp/test2
105
+ :pattern: ERROR
@@ -0,0 +1,4 @@
1
+ ---
2
+ - name: restart Prometheus Gateway
3
+ service: name=prometheus-pushgateway state=restarted
4
+ become: yes
@@ -0,0 +1,5 @@
1
+ ---
2
+ - name : SUPERVISION install gateway service (Prometheus PushGateway)
3
+ package:
4
+ pkg: prometheus-pushgateway
5
+ state: present
@@ -0,0 +1,8 @@
1
+ ---
2
+ - name: restart Prometheus
3
+ service: name=prometheus state=restarted
4
+ become: yes
5
+
6
+ - name: restart Alertmanager
7
+ service: name=prometheus-alertmanager state=restarted
8
+ become: yes
@@ -0,0 +1,29 @@
1
+ ---
2
+ - name : SUPERVISION install master service (Prometheus)
3
+ package:
4
+ pkg: prometheus
5
+ state: present
6
+
7
+ - name : SUPERVISION install alert service (alertmanager)
8
+ package:
9
+ pkg: prometheus-alertmanager
10
+ state: present
11
+
12
+ - name: SUPERVISION Configuration
13
+ template:
14
+ src: prometheus.yml.j2
15
+ dest: /etc/prometheus/prometheus.yml
16
+ owner: root
17
+ group: root
18
+ mode: 0644
19
+ notify: restart Prometheus
20
+
21
+
22
+ - name: SUPERVISION Configuration
23
+ template:
24
+ src: alertmanager.yml.j2
25
+ dest: /etc/prometheus/alertmanager.yml
26
+ owner: root
27
+ group: root
28
+ mode: 0644
29
+ notify: restart Alertmanager
@@ -0,0 +1,126 @@
1
+ # Sample configuration.
2
+ # See https://prometheus.io/docs/alerting/configuration/ for documentation.
3
+
4
+ global:
5
+ # The smarthost and SMTP sender used for mail notifications.
6
+ smtp_smarthost: 'localhost:25'
7
+ smtp_from: 'alertmanager@example.org'
8
+ smtp_auth_username: 'alertmanager'
9
+ smtp_auth_password: 'password'
10
+ # The auth token for Hipchat.
11
+ hipchat_auth_token: '1234556789'
12
+ # Alternative host for Hipchat.
13
+ hipchat_url: 'https://hipchat.foobar.org/'
14
+
15
+ # The directory from which notification templates are read.
16
+ templates:
17
+ - '/etc/prometheus/alertmanager_templates/*.tmpl'
18
+
19
+ # The root route on which each incoming alert enters.
20
+ route:
21
+ # The labels by which incoming alerts are grouped together. For example,
22
+ # multiple alerts coming in for cluster=A and alertname=LatencyHigh would
23
+ # be batched into a single group.
24
+ group_by: ['alertname', 'cluster', 'service']
25
+
26
+ # When a new group of alerts is created by an incoming alert, wait at
27
+ # least 'group_wait' to send the initial notification.
28
+ # This way ensures that you get multiple alerts for the same group that start
29
+ # firing shortly after another are batched together on the first
30
+ # notification.
31
+ group_wait: 30s
32
+
33
+ # When the first notification was sent, wait 'group_interval' to send a batch
34
+ # of new alerts that started firing for that group.
35
+ group_interval: 5m
36
+
37
+ # If an alert has successfully been sent, wait 'repeat_interval' to
38
+ # resend them.
39
+ repeat_interval: 3h
40
+
41
+ # A default receiver
42
+ receiver: team-X-mails
43
+
44
+ # All the above attributes are inherited by all child routes and can
45
+ # overwritten on each.
46
+
47
+ # The child route trees.
48
+ routes:
49
+ # This routes performs a regular expression match on alert labels to
50
+ # catch alerts that are related to a list of services.
51
+ - match_re:
52
+ service: ^(foo1|foo2|baz)$
53
+ receiver: team-X-mails
54
+ # The service has a sub-route for critical alerts, any alerts
55
+ # that do not match, i.e. severity != critical, fall-back to the
56
+ # parent node and are sent to 'team-X-mails'
57
+ routes:
58
+ - match:
59
+ severity: critical
60
+ receiver: team-X-pager
61
+ - match:
62
+ service: files
63
+ receiver: team-Y-mails
64
+
65
+ routes:
66
+ - match:
67
+ severity: critical
68
+ receiver: team-Y-pager
69
+
70
+ # This route handles all alerts coming from a database service. If there's
71
+ # no team to handle it, it defaults to the DB team.
72
+ - match:
73
+ service: database
74
+ receiver: team-DB-pager
75
+ # Also group alerts by affected database.
76
+ group_by: [alertname, cluster, database]
77
+ routes:
78
+ - match:
79
+ owner: team-X
80
+ receiver: team-X-pager
81
+ - match:
82
+ owner: team-Y
83
+ receiver: team-Y-pager
84
+
85
+
86
+ # Inhibition rules allow to mute a set of alerts given that another alert is
87
+ # firing.
88
+ # We use this to mute any warning-level notifications if the same alert is
89
+ # already critical.
90
+ inhibit_rules:
91
+ - source_match:
92
+ severity: 'critical'
93
+ target_match:
94
+ severity: 'warning'
95
+ # Apply inhibition if the alertname is the same.
96
+ equal: ['alertname', 'cluster', 'service']
97
+
98
+
99
+ receivers:
100
+ - name: 'team-X-mails'
101
+ email_configs:
102
+ - to: 'team-X+alerts@example.org'
103
+
104
+ - name: 'team-X-pager'
105
+ email_configs:
106
+ - to: 'team-X+alerts-critical@example.org'
107
+ pagerduty_configs:
108
+ - service_key: <team-X-key>
109
+
110
+ - name: 'team-Y-mails'
111
+ email_configs:
112
+ - to: 'team-Y+alerts@example.org'
113
+
114
+ - name: 'team-Y-pager'
115
+ pagerduty_configs:
116
+ - service_key: <team-Y-key>
117
+
118
+ - name: 'team-DB-pager'
119
+ pagerduty_configs:
120
+ - service_key: <team-DB-key>
121
+ - name: 'team-X-hipchat'
122
+ hipchat_configs:
123
+ - auth_token: <auth_token>
124
+ room_id: 85
125
+ message_format: html
126
+ notify: true
@@ -0,0 +1,33 @@
1
+ # Sample config for Prometheus.
2
+
3
+ global:
4
+ scrape_interval: 15s
5
+ evaluation_interval: 15s
6
+
7
+
8
+ external_labels:
9
+ monitor: 'example'
10
+
11
+
12
+ rule_files:
13
+ # - "first.rules"
14
+ # - "second.rules"
15
+
16
+ # himself
17
+ scrape_configs:
18
+ - job_name: 'prometheus'
19
+ scrape_interval: 5s
20
+ scrape_timeout: 5s
21
+ static_configs:
22
+ - targets: ['{{ groups['supervision_master'][0] }}:9090']
23
+
24
+ # PushGateway
25
+ - job_name: node
26
+ static_configs:
27
+ - targets: ['{{ groups['supervision_gateway'][0] }}:9091']
28
+
29
+ alerting:
30
+ alertmanagers:
31
+ - static_configs:
32
+ - targets:
33
+ - '{{ groups['supervision_master'][0] }}:9093'
@@ -3,13 +3,14 @@ Description=Splash Daemon
3
3
  After=network-online.target
4
4
 
5
5
  [Service]
6
- Type=simple
6
+ Type=forking
7
7
 
8
- User=splash
9
- Group=splash
8
+ User=root
9
+ Group=root
10
10
  UMask=007
11
11
 
12
- ExecStart=/splash daemon start
12
+ ExecStart=/usr/local/bin/splash daemon start
13
+ ExecStop=/usr/local/bin/splash daemon stop
13
14
 
14
15
  Restart=on-failure
15
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-splash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain GEORGES
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-14 00:00:00.000000000 Z
11
+ date: 2020-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -273,6 +273,26 @@ files:
273
273
  - lib/splash/transports/rabbitmq.rb
274
274
  - prometheus-splash.gemspec
275
275
  - spec/templates_spec.rb
276
+ - templates/ansible-splash/Vagrantfile
277
+ - templates/ansible-splash/deploy.yml
278
+ - templates/ansible-splash/group_vars/DEV.yml
279
+ - templates/ansible-splash/group_vars/PROD.yml
280
+ - templates/ansible-splash/group_vars/all.yml
281
+ - templates/ansible-splash/inventory.dev
282
+ - templates/ansible-splash/inventory.prod
283
+ - templates/ansible-splash/roles/backend/handlers/main.yml
284
+ - templates/ansible-splash/roles/backend/tasks/main.yml
285
+ - templates/ansible-splash/roles/backend/templates/redis.conf.j2
286
+ - templates/ansible-splash/roles/mq/handlers/main.yml
287
+ - templates/ansible-splash/roles/mq/tasks/main.yml
288
+ - templates/ansible-splash/roles/splash/tasks/main.yml
289
+ - templates/ansible-splash/roles/splash/templates/splash.yml.j2
290
+ - templates/ansible-splash/roles/supervision_gateway/handlers/main.yml
291
+ - templates/ansible-splash/roles/supervision_gateway/tasks/main.yml
292
+ - templates/ansible-splash/roles/supervision_master/handlers/main.yml
293
+ - templates/ansible-splash/roles/supervision_master/tasks/main.yml
294
+ - templates/ansible-splash/roles/supervision_master/templates/alertmanager.yml.j2
295
+ - templates/ansible-splash/roles/supervision_master/templates/prometheus.yml.j2
276
296
  - templates/report.txt
277
297
  - templates/splashd.service
278
298
  - ultragreen_roodi_coding_convention.yml