Commit 8b37ad72 authored by Walter Heck's avatar Walter Heck

Add influxdb back to the icinga server

parent b37099ad
......@@ -121,6 +121,27 @@
# Default value: "password"
'opstheater::icinga::ido_password': 'OpsTheaterIcingaPassWord'
# Variable: opstheater::icinga::influxdb::user
# Description: The username used for accessing influxdb
# Default value: admin
'opstheater::icinga::influxdb::user': "%{hiera('opstheater::influxdb::user')}"
# Variable: opstheater::icinga::influxdb::password
# Description: The password used for accessing influxdb
# Default value: admin
'opstheater::icinga::influxdb::password': "%{hiera('opstheater::influxdb::password')}"
# Variable: opstheater::icinga::influxdb::dbname
# Description: The name of the database in influxdb we want to connect to
# Default value: influxdb
'opstheater::icinga::influxdb::dbname': "%{hiera('opstheater::influxdb::dbname')}"
# Variable: opstheater::icinga::influxdb::ip
# Description: The ip used for accessing influxdb
# Default value: ip
'opstheater::icinga::influxdb::ip': "%{hiera('opstheater::influxdb::ip')}"
# Variable: opstheater::icingaweb::fqdn
# Description:
# Default value: "%{hiera('opstheater::icinga::fqdn')}"
......@@ -261,6 +282,32 @@
# Default value: '10.20.1.%'
'opstheater::mysql::whitelist_range': '10.20.1.%'
##############################
### Influxdb Details
###############################
# Variable: opstheater::influxdb::user
# Description: The username used for accessing influxdb
# Default value: admin
'opstheater::influxdb::user': 'admin'
# Variable: opstheater::influxdb::password
# Description: The password used for accessing influxdb
# Default value: admin
'opstheater::influxdb::password': 'admin'
# Variable: opstheater::influxdb::dbname
# Description: The name of the database in influxdb we want to connect to
# Default value: influxdb
'opstheater::influxdb::dbname': 'influxdb'
# Variable: opstheater::influxdb::ip
# Description: The ip used for accessing influxdb
# Default value: ip
'opstheater::influxdb::ip': "%{hiera('opstheater::icinga::ipaddress')}"
##############################
### Grafana Details
###############################
......@@ -283,12 +330,22 @@
# Variable: opstheater::grafana::influxdb::user
# Description: The username used for accessing influxdb
# Default value: admin
'opstheater::grafana::influxdb::user': 'admin'
'opstheater::grafana::influxdb::user': "%{hiera('opstheater::influxdb::user')}"
# Variable: opstheater::grafana::influxdb::password
# Description: The password used for accessing influxdb
# Default value: admin
'opstheater::grafana::influxdb::password': 'admin'
'opstheater::grafana::influxdb::password': "%{hiera('opstheater::influxdb::password')}"
# Variable: opstheater::grafana::influxdb::dbname
# Description: The name of the database in influxdb we want to connect to
# Default value: influxdb
'opstheater::grafana::influxdb::dbname': "%{hiera('opstheater::influxdb::dbname')}"
# Variable: opstheater::grafana::influxdb::ip
# Description: The ip used for accessing influxdb
# Default value: ip
'opstheater::grafana::influxdb::ip': "%{hiera('opstheater::influxdb::ip')}"
# Variable: opstheater::grafana::port
# Description: the port at which grafana should be rechable
......
......@@ -21,7 +21,11 @@ class opstheater::profile::grafana (
String $ldap_password = hiera('opstheater::grafana::ldap::password'),
String $ldap_base_dn = hiera('opstheater::grafana::ldap::base_dn'),
String $ldap_admin_query = hiera('opstheater::grafana::ldap::admin_query'),
String $ldap_editor_query = hiera('opstheater::grafana::ldap::editor_query')
String $ldap_editor_query = hiera('opstheater::grafana::ldap::editor_query'),
String $influxdb_user = hiera('opstheater::grafana::influxdb::user'),
String $influxdb_password = hiera('opstheater::grafana::influxdb::password'),
String $influxdb_ip = hiera('opstheater::grafana::influxdb::ip'),
String $influxdb_dbname = hiera('opstheater::grafana::influxdb::dbname'),
) {
# Specifically convert the class parameter to boolean as the hiera call always returns a string
......@@ -116,6 +120,20 @@ class opstheater::profile::grafana (
},
}
grafana_datasource { 'influxdb':
grafana_url => "http://${grafanaurl}:${grafanaport}",
grafana_user => $grafanauser,
grafana_password => $grafanapasswd,
type => influxdb,
url => "http://${influxdb_ip}:8086",
access_mode => proxy,
is_default => false,
database => $influxdb_dbname,
user => $influxdb_user,
password => $influxdb_password,
require => Class[ 'influxdb::server', 'grafana' ],
}
@firewall { '207 allow HTTP access to grafana':
chain => 'INPUT',
action => 'accept',
......
......@@ -2,6 +2,10 @@ class opstheater::profile::icinga::server (
String $icinga2_db_ipaddress = hiera('opstheater::icinga::mysql_ipaddress'),
String $icinga2_web_fqdn = hiera('opstheater::icingaweb::fqdn'),
String $icinga2_ido_password = hiera('opstheater::icinga::ido_password'),
String $influxdb_user = hiera('opstheater::icinga::influxdb::user'),
String $influxdb_password = hiera('opstheater::icinga::influxdb::password'),
String $influxdb_dbname = hiera('opstheater::icinga::influxdb::dbname'),
String $influxdb_ip = hiera('opstheater::icinga::influxdb::ip'),
) inherits opstheater::profile::params {
class { 'icinga2':
......@@ -50,6 +54,15 @@ class opstheater::profile::icinga::server (
tag => 'icinga2::config::file',
}
class { 'icinga2::feature::influxdb':
host => $influxdb_ip,
username => $influxdb_user,
password => $influxdb_password,
database => $influxdb_dbname,
enable_send_thresholds => true,
enable_send_metadata => true,
}
$lowercase_fqdn = downcase($::fqdn)
class { '::icinga2::feature::api':
accept_commands => true,
......
# == Class: opstheater::profile::influxdb
#
class opstheater::profile::influxdb(
String $influxdb_user = hiera('opstheater::influxdb::username'),
String $influxdb_password = hiera('opstheater::influxdb::password'),
String $influxdb_dbname = hiera('opstheater::influxdb::dbname'),
String $influxdb_ip = hiera('opstheater::influxdb::ip'),
) {
class { 'influxdb::server' : }
exec { 'add_influxdb_database':
path => '/bin:/usr/bin:/sbin:/usr/sbin',
unless => "[ `influx -execute \'SHOW DATABASES\' | grep ${influxdb_dbname}` == \"${influxdb_dbname}\" ]",
command => "sleep 10 && curl -G http://${influxdb_ip}:8086/query --data-urlencode \"q=CREATE DATABASE ${influxdb_dbname}\" && curl -G http://${influxdb_ip}:8086/query --data-urlencode \"q=CREATE USER ${influxdb_user} WITH PASSWORD \'${influxdb_password}\' WITH ALL PRIVILEGES\"",
require => Class[ 'influxdb::server' ],
}
}
......@@ -3,4 +3,5 @@ class opstheater::role::monitoring::standalone {
include opstheater::profile::icinga::web
include opstheater::profile::icinga::server
include opstheater::profile::icinga::checks
include opstheater::profile::influxdb
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment