Browse code

Monitoring SWAP i drobne porzadki.

Lukasz P authored on16/02/2021 12:10:45
Showing7 changed files
... ...
@@ -1,5 +1,4 @@
1
-- name: Print server name
2
-  debug:
1
+- debug:
3 2
     msg: Installing Nagios configuration for host {{ item.host_name }}
4 3
 
5 4
 - name: Copy nagios server file
... ...
@@ -15,8 +15,8 @@
15 15
       - {host_name: jezynka.ping.local, host_ip: 192.168.111.110}
16 16
       - {host_name: malinka.ping.local, host_ip: 192.168.111.106}
17 17
       - {host_name: leap15test.ping.local, host_ip: 192.168.111.43}
18
-      - {host_name: outpost.ping.local, host_ip: 192.168.111.96}
19
-      #- {host_name: potemkin.ping.local, host_ip: 192.168.111.19} # LOCALHOST
18
+      - {host_name: outpost.ping.local, host_ip: 192.168.111.95}
19
+      - {host_name: potemkin.ping.local, host_ip: 192.168.111.19}
20 20
       - {host_name: python-cave.ping.local, host_ip: 192.168.111.50}
21 21
       - {host_name: rawhide.ping.local, host_ip: 192.168.111.81}
22 22
       - {host_name: rhel8.ping.local, host_ip: 192.168.111.83}
23 23
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+---
2
+- name: Setup various nrpe checks
3
+  hosts: all
4
+
5
+  tasks:
6
+
7
+  - name: Update nrpe checks configuration to Redhat-like hosts.
8
+    include_tasks: monitoring_setup_nrpe_checks.yaml
9
+    loop:
10
+    - {plugin_path: "/usr/lib64/nagios/plugins"}
11
+    when: ansible_os_family == 'RedHat'
12
+  
13
+  - name: Update nrpe checks configuration to Debian-like and Suse hosts.
14
+    include_tasks: monitoring_setup_nrpe_checks.yaml
15
+    loop:
16
+    - {plugin_path: "/usr/lib/nagios/plugins"}
17
+    when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse'
18
+
19
+
20
+  handlers:
21
+
22
+  - name: restart nrpe RS
23
+    systemd:
24
+      name: nrpe
25
+      state: restarted
26
+
27
+  - name: restart nrpe D
28
+    systemd:
29
+      name: nagios-nrpe-server
30
+      state: restarted
31
+
0 32
similarity index 97%
1 33
rename from helpers/monitoring_setup_nrpe.yaml
2 34
rename to helpers/monitoring_setup_nrpe_servers.yaml
... ...
@@ -1,5 +1,5 @@
1 1
 ---
2
-- name: Configure nrpe on monitored hosts 
2
+- name: Configure nrpe servers on monitored hosts 
3 3
   hosts: all
4 4
 
5 5
   tasks:
... ...
@@ -1,35 +1,6 @@
1 1
 ---
2 2
 - import_playbook: helpers/monitoring_basic_setup.yaml
3
-- import_playbook: helpers/monitoring_setup_nrpe.yaml
3
+- import_playbook: helpers/monitoring_setup_nrpe_servers.yaml
4
+- import_playbook: helpers/monitoring_setup_nrpe_plugins.yaml
4 5
 - import_playbook: helpers/monitoring_setup_nagios_servers.yaml
5 6
 
6
-- name: Setup nrpe checks
7
-  hosts: all
8
-
9
-  tasks:
10
-
11
-  - name: Update nrpe checks configuration to Redhat-like hosts.
12
-    include_tasks: helpers/monitoring_setup_nrpe_checks.yaml
13
-    loop:
14
-    - {plugin_path: "/usr/lib64/nagios/plugins"}
15
-    when: ansible_os_family == 'RedHat'
16
-  
17
-  - name: Update nrpe checks configuration to Debian-like and Suse hosts.
18
-    include_tasks: helpers/monitoring_setup_nrpe_checks.yaml
19
-    loop:
20
-    - {plugin_path: "/usr/lib/nagios/plugins"}
21
-    when: ansible_os_family == 'Debian' or ansible_os_family == 'Suse'
22
-
23
-
24
-  handlers:
25
-
26
-  - name: restart nrpe RS
27
-    systemd:
28
-      name: nrpe
29
-      state: restarted
30
-
31
-  - name: restart nrpe D
32
-    systemd:
33
-      name: nagios-nrpe-server
34
-      state: restarted
35
-
... ...
@@ -1,3 +1,5 @@
1
+# Managed with Ansible
2
+
1 3
 define host {
2 4
     use                     linux-server
3 5
     host_name               {{ item.host_name }}
... ...
@@ -26,3 +28,10 @@ define service{
26 28
     check_command           check_nrpe!-c check_load
27 29
 }
28 30
 
31
+define service{
32
+    use                     bindir-service
33
+    host_name               {{ item.host_name }}
34
+    service_description     SWAP
35
+    check_command           check_nrpe!-c check_swap
36
+}
37
+
... ...
@@ -1,4 +1,5 @@
1 1
 # Managed with Ansible
2 2
 command[check_load]={{ item.plugin_path }}/check_load -w "$(($(nproc --all)))" -c "$(($(nproc --all)+1))"
3 3
 command[check_disk]={{ item.plugin_path }}/check_disk / -w 20% -c 10%
4
+command[check_swap]={{ item.plugin_path }}/check_swap -w 30% -c 10% -n ok
4 5