summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/tasks
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2018-03-07 19:50:28 +0100
committerNiklas Yann Wettengel <niyawe@niyawe.de>2018-03-07 19:50:28 +0100
commit4523a78c97519527ba92fb1ea4276f081e7c6629 (patch)
treeb5e68bf4a0a3bcd783a364c9491a5ae74fef8f1a /roles/install_monitoring/tasks
parentde66f3d823165844e7a97be6adfe24131e178e73 (diff)
add munin monitoring
Diffstat (limited to 'roles/install_monitoring/tasks')
-rw-r--r--roles/install_monitoring/tasks/install_munin.yml162
-rw-r--r--roles/install_monitoring/tasks/install_vnstat.yml2
-rw-r--r--roles/install_monitoring/tasks/main.yml4
3 files changed, 152 insertions, 16 deletions
diff --git a/roles/install_monitoring/tasks/install_munin.yml b/roles/install_monitoring/tasks/install_munin.yml
index bda0e6f..2c8da48 100644
--- a/roles/install_monitoring/tasks/install_munin.yml
+++ b/roles/install_monitoring/tasks/install_munin.yml
@@ -10,23 +10,65 @@
dest: /etc/munin/munin-node.conf
notify: restart munin-node
-- name: copy fastd plugin
+- name: install perl-json
+ pacman:
+ name: perl-json
+ state: present
+ when: "'fastd' in group_names"
+
+- name: copy fastd peers plugin
+ copy:
+ src: munin/munin_fastd_peers
+ dest: /usr/lib/munin/plugins/fastd_peers_
+ mode: 0755
+ when: "'fastd' in group_names"
+
+- name: copy fastd traffic plugin
copy:
- src: munin/munin_fastd_plugin
- dest: /usr/lib/munin/plugins/fastd_
+ src: munin/munin_fastd_traffic
+ dest: /usr/lib/munin/plugins/fastd_traffic_
mode: 0755
+ when: "'fastd' in group_names"
+
+- name: enable munin plugins for fastd peers
+ file:
+ path: /etc/munin/plugins/fastd_peers_ff{{ item.name }}
+ src: /usr/lib/munin/plugins/fastd_peers_
+ state: link
+ with_items: "{{ sites }}"
+ notify: restart munin-node
+ when: "'fastd' in group_names"
+
+- name: enable munin plugins for fastd traffic
+ file:
+ path: /etc/munin/plugins/fastd_traffic_ff{{ item.name }}
+ src: /usr/lib/munin/plugins/fastd_traffic_
+ state: link
+ with_items: "{{ sites }}"
+ notify: restart munin-node
+ when: "'fastd' in group_names"
+
+- name: copy fastd plugin config
+ template:
+ src: munin_fastd_conf.j2
+ dest: /etc/munin/plugin-conf.d/fastd
+ notify: restart munin-node
+ when: "'fastd' in group_names"
- name: copy dhcp-pool plugin
copy:
src: munin/munin_dhcp_pool_plugin
dest: /usr/lib/munin/plugins/dhcp-pool
mode: 0755
+ when: "'fastd' in group_names"
-- name: copy fastd plugin config
- copy:
- src: munin/munin_fastd_conf
- dest: /etc/munin/plugin-conf.d/fastd
+- name: enable munin plugins for dhcp
+ file:
+ path: /etc/munin/plugins/dhcp-pool
+ src: /usr/lib/munin/plugins/dhcp-pool
+ state: link
notify: restart munin-node
+ when: "'fastd' in group_names"
- name: copy global config
copy:
@@ -44,17 +86,109 @@
name: perl-lwp-protocol-https
state: present
-- name: install perl-json
- pacman:
- name: perl-json
- state: present
+- name: enable munin plugins for network monitoring (1/8)
+ file:
+ path: /etc/munin/plugins/if_{{ ansible_default_ipv4.interface }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+
+- name: enable munin plugins for network monitoring (2/8)
+ file:
+ path: /etc/munin/plugins/if_{{ ansible_default_ipv6.interface }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+
+- name: enable munin plugins for network monitoring (3/8)
+ file:
+ path: /etc/munin/plugins/if_{{ item[0] }}{{ item[1].name }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ with_nested:
+ - [ 'bat', 'vpn', 'wg' ]
+ - "{{ sites }}"
+ when: "'fastd' in group_names"
+
+- name: enable munin plugins for network monitoring (4/8)
+ file:
+ path: /etc/munin/plugins/if_bb{{ hostvars[item]['wireguard_bb_name'] }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ with_items: "{{ groups['uplink'] }}"
+ when: "'fastd' in group_names"
+
+- name: enable munin plugins for network monitoring (5/8)
+ file:
+ path: /etc/munin/plugins/if_bb{{ hostvars[item]['wireguard_bb_name'] }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ with_items: "{{ groups['fastd'] }}"
+ when: "'uplink' in group_names"
+
+- name: enable munin plugins for network monitoring (6/8)
+ file:
+ path: /etc/munin/plugins/if_bb{{ item.name }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ with_items: "{{ wireguard_bb_peers|default([]) }}"
+ when: "'uplink' in group_names"
+
+- name: enable munin plugins for network monitoring (7/8)
+ file:
+ path: /etc/munin/plugins/if_bb{{ item.name }}
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ with_items: "{{ ffrl_peers }}"
+ when: "'ffrl_uplink' in group_names"
+
+- name: enable munin plugins for network monitoring (8/8)
+ file:
+ path: /etc/munin/plugins/if_mullvad
+ src: /usr/lib/munin/plugins/if_
+ state: link
+ notify: restart munin-node
+ when: "'mullvad_uplink' in group_names"
- name: enable munin plugins
file:
- path: /etc/munin/plugins/{{ item.name }}
- src: /usr/lib/munin/plugins/{{ item.plugin | default( item.name ) }}
+ path: /etc/munin/plugins/{{ item }}
+ src: /usr/lib/munin/plugins/{{ item }}
state: link
- with_items: "{{ munin_node_plugins }}"
+ with_items:
+ - cpu
+ - df
+ - df_inode
+ - diskstats
+ - entropy
+ - forks
+ - fw_conntrack
+ - fw_forwarded_local
+ - fw_packets
+ - interrupts
+ - irqstats
+ - load
+ - memory
+ - netstat
+ - nginx_request
+ - nginx_status
+ - ntp_kernel_err
+ - ntp_kernel_pll_freq
+ - ntp_kernel_pll_off
+ - ntp_offset
+ - open_files
+ - open_inodes
+ - proc_pri
+ - processes
+ - threads
+ - uptime
+ - users
+ - vmstat
notify: restart munin-node
- name: start and enable munin-node
diff --git a/roles/install_monitoring/tasks/install_vnstat.yml b/roles/install_monitoring/tasks/install_vnstat.yml
index e737d74..4027aa6 100644
--- a/roles/install_monitoring/tasks/install_vnstat.yml
+++ b/roles/install_monitoring/tasks/install_vnstat.yml
@@ -15,6 +15,7 @@
args:
creates: '/var/lib/vnstat/bat{{ item.name }}'
with_items: "{{ sites }}"
+ when: "'fastd' in group_names"
- name: add interfaces to vnstat for uplink interfaces
command: /usr/bin/vnstat -u -i bb{{ hostvars[item]['wireguard_bb_name'] }}
@@ -22,6 +23,7 @@
creates: "/var/lib/vnstat/bb{{ hostvars[item]['wireguard_bb_name'] }}"
with_items:
- "{{ groups['uplink'] }}"
+ when: "'fastd' in group_names"
- name: add interfaces to vnstat for outgoing v4 interface
command: /usr/bin/vnstat -u -i {{ ansible_default_ipv4.interface }}
diff --git a/roles/install_monitoring/tasks/main.yml b/roles/install_monitoring/tasks/main.yml
index 0b63792..407c261 100644
--- a/roles/install_monitoring/tasks/main.yml
+++ b/roles/install_monitoring/tasks/main.yml
@@ -5,5 +5,5 @@
#- name: install ffmyk-influx
# include: install_ffmyk-influx.yml
-#- name: install munin
-# include: install_munin.yml
+- name: install munin
+ import_tasks: install_munin.yml