aboutsummaryrefslogtreecommitdiff
path: root/roles/icinga2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/icinga2')
-rw-r--r--roles/icinga2/defaults/main.yml8
-rw-r--r--roles/icinga2/tasks/icinga.yml1
-rw-r--r--roles/icinga2/templates/icinga2.conf.j21
-rw-r--r--roles/icinga2/templates/influx.conf.j234
4 files changed, 44 insertions, 0 deletions
diff --git a/roles/icinga2/defaults/main.yml b/roles/icinga2/defaults/main.yml
index 7e4e5bc..d4fe89f 100644
--- a/roles/icinga2/defaults/main.yml
+++ b/roles/icinga2/defaults/main.yml
@@ -25,6 +25,14 @@ icinga:
smtp_user: ''
smtp_psw: ''
from: ''
+ influx:
+ enable: false
+ host: 'localhost'
+ port: 8086
+ ssl: true
+ database: 'icinga'
+ username: 'icinga'
+ password: ''
constants:
TicketSalt: ''
NodeName: '{{ ansible_facts.fqdn }}'
diff --git a/roles/icinga2/tasks/icinga.yml b/roles/icinga2/tasks/icinga.yml
index 3efef4b..e9eae1a 100644
--- a/roles/icinga2/tasks/icinga.yml
+++ b/roles/icinga2/tasks/icinga.yml
@@ -47,6 +47,7 @@
- ido-mysql.conf
- api_users.conf
- constants.conf
+ - influx.conf
- name: Install config from git
git:
diff --git a/roles/icinga2/templates/icinga2.conf.j2 b/roles/icinga2/templates/icinga2.conf.j2
index 13d2d7f..921c2d6 100644
--- a/roles/icinga2/templates/icinga2.conf.j2
+++ b/roles/icinga2/templates/icinga2.conf.j2
@@ -18,6 +18,7 @@ include <nscp>
include "features-enabled/*.conf"
include "ido-mysql.conf"
include "api_users.conf"
+include "influx.conf"
{% if icinga.config.manage is true %}
include_recursive "conf.git.d"
diff --git a/roles/icinga2/templates/influx.conf.j2 b/roles/icinga2/templates/influx.conf.j2
new file mode 100644
index 0000000..42b6d3b
--- /dev/null
+++ b/roles/icinga2/templates/influx.conf.j2
@@ -0,0 +1,34 @@
+/**
+* vi: ft=icinga2
+* This File is managed by Ansible. Do NOT change.
+*/
+
+{% if icinga.influx.enable %}
+object InfluxdbWriter "influxdb" {
+ host = "{{ icinga.influx.host }}"
+ ssl_enable = {{ icinga.influx.ssl | string | lower }}
+ port = {{ icinga.influx.port }}
+ database = "{{ icinga.influx.database }}"
+ username = "{{ icinga.influx.username }}"
+ password = "{{ icinga.influx.password }}"
+ flush_threshold = 1024
+ flush_interval = 10s
+ enable_send_thresholds = true
+ enable_send_metadata = true
+ host_template = {
+ measurement = "$host.check_command$"
+ tags = {
+ hostname = "$host.name$"
+ }
+ }
+ service_template = {
+ measurement = "$service.check_command$"
+ tags = {
+ hostname = "$host.name$"
+ service = "$service.name$"
+ check_command = "$service.vars.check_command$"
+ instance = "$service.vars.instance$"
+ }
+ }
+}
+{% endif %}