Add check for mailserver-pgsql
This commit is contained in:
parent
f026e3a166
commit
70382d628f
4 changed files with 46 additions and 0 deletions
|
@ -55,6 +55,27 @@
|
|||
- "{{ role_path }}/templates/zones.d/master/*.conf.j2"
|
||||
notify: Reload icinga2 service
|
||||
|
||||
- name: Create global-templates zone directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/icinga2/zones.d/global-templates
|
||||
state: directory
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0750
|
||||
|
||||
- name: Copy files under global-templates zone directory
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/icinga2/zones.d/global-templates/{{ item | basename | replace('.j2', '') }}"
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- "{{ role_path }}/templates/zones.d/global-templates/*.conf.j2"
|
||||
notify: Reload icinga2 service
|
||||
|
||||
- name: Create services directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
object CheckCommand "sudo_pgsql" {
|
||||
import "pgsql"
|
||||
command = [ "sudo", "-u", "postgres" ] + command
|
||||
}
|
|
@ -10,3 +10,13 @@
|
|||
group: nagios
|
||||
mode: 0644
|
||||
notify: Reload icinga2 service
|
||||
|
||||
- name: Copy sudoers file for nagios as postgres
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
content: 'nagios ALL=(postgres) NOPASSWD:/usr/lib/nagios/plugins/check_pgsql'
|
||||
dest: /etc/sudoers.d/nagios-pgsql
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
validate: 'visudo -cf %s'
|
||||
|
|
|
@ -26,3 +26,12 @@ apply Service "imaps" {
|
|||
check_command = "simap"
|
||||
assign where host.name == "{{ inventory_hostname }}"
|
||||
}
|
||||
|
||||
apply Service "mailserver-pgsql" {
|
||||
import "generic-service"
|
||||
check_command = "sudo_pgsql"
|
||||
command_endpoint = host.name
|
||||
assign where host.name == "{{ inventory_hostname }}"
|
||||
vars.pgsql_hostname = "/run/postgresql"
|
||||
vars.pgsql_database = "mailserver"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue