Skip to content

Commit

Permalink
Merge pull request #4 from tbauriedel/add-grafana
Browse files Browse the repository at this point in the history
Add grafana
  • Loading branch information
tbauriedel authored Oct 4, 2024
2 parents 5b1b0f5 + 5e432da commit f7dfb3f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 23 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ Hostname: `icinga-dev`
Provider: `VirtualBox`

The following ports will be forwarded into the Vagrant box:
* 80 (guest) => 80 (host)
* 443 (guest) => 443 (host) // Webserver with TLS not configured via default
* 5665 (guest) => 5665 (host)
* 8086 (guest) => 8086 (host)
* Mysql: 3306 (guest) => 3306 (host)
* Webserver: 80 (guest) => 80 (host)
* Webserver: 443 (guest) => 443 (host) // Webserver with TLS not configured via default
* Icinga 2: 5665 (guest) => 5665 (host)
* InfluxDB: 8086 (guest) => 8086 (host)
* Grafana: 3000 (guest) => 3000 (host)
* Carbonapi: 8888 (guest) => 8888 (host)

## Credentials

Default credentials if not customized (Format: `user` - `password`):
* Icinga Web 2 admin => `icinga` - `icinga`
* Icinga 2 API user => `poweruser` - `poweruser`
* Icinga Web 2 admin => `icinga` - `icinga`
* Icinga 2 API user => `poweruser` - `poweruser`
* IcingaDB-redis password => `redis-pass`
* Mysql `*.*` user => `poweruser` - `poweruser`
* Mysql root user: `root` - `root0815!`
* InfluxDB admin user: `admin` - `admin12345!`
* Mysql `*.*` user => `poweruser` - `poweruser`
* Mysql root user => `root` - `root0815!`
* InfluxDB admin user => `admin` - `admin12345!`
* InfluxDB admin token => `AHDUKAGSszifgj21711sfztGASg2`
* Grafana initial user => `admin` - `admin`

## Components

Expand All @@ -42,6 +47,8 @@ The most common used components are pre-installed and configured.
* carbonapi
* InfluxDB (Ansible collection `tbauriedel.influxdb2`)
* InfluxDB v2
* Grafana
* Grafana (Ansible collection `grafana.grafana`)

## Requirements

Expand Down
3 changes: 3 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 443, host: 443
config.vm.network "forwarded_port", guest: 5665, host: 5665
config.vm.network "forwarded_port", guest: 8086, host: 8086
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.network "forwarded_port", guest: 3306, host: 3306
config.vm.network "forwarded_port", guest: 8888, host: 8888
end
39 changes: 25 additions & 14 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
- hosts: all
gather_facts: true
become: true
vars:
_enabled_roles:
- tbauriedel.gographite.gocarbon
- tbauriedel.gographite.carbonapi
- tbauriedel.influxdb2.repos
- tbauriedel.influxdb2.influxdb2
- grafana.grafana.grafana
- geerlingguy.mysql
- icinga.icinga.repos
- icinga.icinga.icinga2
- icinga.icinga.icingadb_redis
- icinga.icinga.icingadb
- icinga.icinga.icingaweb2
- icinga.icinga.monitoring_plugins

pre_tasks:
- name: Include vars
ansible.builtin.include_vars:
Expand All @@ -15,30 +30,26 @@
when:
- ansible_os_family == "RedHat"
- icinga_repo_subscription_username == "" or icinga_repo_subscription_password == ""
- "'icinga.icinga.repos' in _enabled_roles"

tasks:
- ansible.builtin.include_role:
name: "{{ item }}"
loop: "{{ _enabled_roles }}"

post_tasks:
- name: Start / enable icinga-director
ansible.builtin.systemd_service:
name: icinga-director
state: started
enabled: true
when: "'icinga.icinga.icingaweb2' in _enabled_roles"

- name: Start / enable httpd if needed
ansible.builtin.systemd_service:
name: httpd
state: started
enabled: true
when: ansible_os_family == "RedHat"

roles:
- tbauriedel.gographite.gocarbon
- tbauriedel.gographite.carbonapi
- tbauriedel.influxdb2.repos
- tbauriedel.influxdb2.influxdb2
- geerlingguy.mysql
- icinga.icinga.repos
- icinga.icinga.icinga2
- icinga.icinga.icingadb_redis
- icinga.icinga.icingadb
- icinga.icinga.icingaweb2
- icinga.icinga.monitoring_plugins
when:
- ansible_os_family == "RedHat"
- "'icinga.icinga.icingaweb2' in _enabled_roles"
25 changes: 25 additions & 0 deletions ansible/vars/grafana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
grafana_security:
admin_user: admin
admin_password: admin
allow_embedding: true
grafana_auth:
anonymous:
enabled: true
org_role: Viewer

grafana_datasources:
- name: "Local CarbonApi"
ds_type: graphite
ds_url: http://localhost:8888
- name: "Local InfluxDB - Flux"
ds_type: influxdb
ds_url: http://localhost:8086
additional_json_data:
version: "Flux"
organization: "monitoring"
defaultBucket: "icinga2"
tlsSkipVerify: false
additional_secure_json_data:
token: "AHDUKAGSszifgj21711sfztGASg2"
# Add "InfluxDB - InfluxQL" as datasource
2 changes: 2 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ collections:
- name: icinga.icinga
- name: tbauriedel.gographite
- name: tbauriedel.influxdb2
- name: grafana.grafana
- name: community.grafana

0 comments on commit f7dfb3f

Please sign in to comment.