mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-12 02:46:20 +08:00
Zabbix/Rsyslogd: New template & hostgroup for rsyslogd processes
Also some minor fixes for the postfix templates Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
@@ -26,6 +26,9 @@ zabbix_export:
|
||||
event_name: 'Postfix: potential stuck mails in mailq (2 mails in queue)'
|
||||
opdata: '{ITEM.LASTVALUE1} mails queued'
|
||||
priority: WARNING
|
||||
dependencies:
|
||||
- name: 'Postfix: potential stuck mails in mailq'
|
||||
expression: 'last(/Postfix Mail Queue/postfix.queue)>=5'
|
||||
tags:
|
||||
- tag: postfix
|
||||
value: problem
|
||||
@@ -35,6 +38,9 @@ zabbix_export:
|
||||
event_name: 'Postfix: potential stuck mails in mailq (5 mails in queue)'
|
||||
opdata: '{ITEM.LASTVALUE1} mails queued'
|
||||
priority: AVERAGE
|
||||
dependencies:
|
||||
- name: 'Postfix: stuck mails in mailq'
|
||||
expression: 'last(/Postfix Mail Queue/postfix.queue)>=10'
|
||||
tags:
|
||||
- tag: postfix
|
||||
value: problem
|
||||
|
||||
32
roles/base/files/rsyslog/zabbix-template.yml
Normal file
32
roles/base/files/rsyslog/zabbix-template.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
zabbix_export:
|
||||
version: '7.0'
|
||||
template_groups:
|
||||
- uuid: 372f19ba622745aaa43b4fa0b5168262
|
||||
name: Fedora
|
||||
templates:
|
||||
- uuid: cb1afd4cd71f49beae04347d027ff07b
|
||||
template: 'Rsyslogd Processes'
|
||||
name: 'Rsyslogd Processes'
|
||||
groups:
|
||||
- name: Fedora
|
||||
items:
|
||||
- uuid: 77b90f572e144092abbd08e29fb65dbb
|
||||
name: 'Rsyslogd processes'
|
||||
type: ZABBIX_ACTIVE
|
||||
key: 'proc.num[,,,.*rsyslogd.*]'
|
||||
triggers:
|
||||
- uuid: 438b237bba7c42bab565b352c5fe26a2
|
||||
expression: 'last(/Rsyslogd Processes/proc.num[,,,.*rsyslogd.*])=0'
|
||||
name: 'Rsyslogd: no processes running'
|
||||
opdata: '{ITEM.LASTVALUE1} processes'
|
||||
priority: HIGH
|
||||
tags:
|
||||
- tag: rsyslogd
|
||||
value: down
|
||||
- uuid: 375b16d0994d45acb22cb47e97d90fac
|
||||
expression: 'last(/Rsyslogd Processes/proc.num[,,,.*rsyslogd.*])>2'
|
||||
name: 'Rsyslogd: too many processes'
|
||||
opdata: '{ITEM.LASTVALUE1} processes'
|
||||
priority: HIGH
|
||||
tags:
|
||||
- tag: rsyslogd
|
||||
@@ -510,6 +510,12 @@
|
||||
- config
|
||||
- rsyslog-audit
|
||||
|
||||
- name: Configure Rsyslogd monitoring in Zabbix
|
||||
ansible.builtin.include_tasks: rsyslogd-monitoring.yml
|
||||
tags:
|
||||
- rsyslogd
|
||||
- zabbix_api
|
||||
|
||||
# Custom selinux policy to allow unix_chkpwd to map PAM database
|
||||
- name: Copy over our custom selinux module
|
||||
ansible.builtin.copy: src=selinux/mapchkpwd.pp dest=/usr/local/share/mapchkpwd.pp
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
- postfix
|
||||
- zabbix_agent
|
||||
|
||||
- name: API Block
|
||||
- name: Zabbix API Block
|
||||
vars:
|
||||
ansible_zabbix_auth_key: "{{ zabbix_auth_key }}"
|
||||
ansible_network_os: "{{ zabbix_network_os }}"
|
||||
@@ -73,16 +73,16 @@
|
||||
- zabbix_api
|
||||
- zabbix_agent
|
||||
block:
|
||||
- name: Import template file
|
||||
- name: Import Postfix Zabbix template file
|
||||
community.zabbix.zabbix_template:
|
||||
template_yaml: "{{ lookup('file', 'postfix/zabbix-template.yml') }}"
|
||||
state: present
|
||||
- name: Ensure hostgroup is present
|
||||
- name: Ensure Postfix Zabbix hostgroup is present
|
||||
community.zabbix.zabbix_group:
|
||||
host_groups:
|
||||
- Postfix servers
|
||||
state: present
|
||||
- name: Update hostgroup for self in Zabbix
|
||||
- name: Add self to Postfix in Zabbix
|
||||
community.zabbix.zabbix_host:
|
||||
host_name: "{{ inventory_hostname }}"
|
||||
host_groups: Postfix servers
|
||||
|
||||
@@ -115,4 +115,3 @@
|
||||
- postfix
|
||||
- zabbix_agent
|
||||
- zabbix_api
|
||||
- test
|
||||
|
||||
28
roles/base/tasks/rsyslogd-monitoring.yml
Normal file
28
roles/base/tasks/rsyslogd-monitoring.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
- name: Zabbix API Block
|
||||
vars:
|
||||
ansible_zabbix_auth_key: "{{ zabbix_auth_key }}"
|
||||
ansible_network_os: "{{ zabbix_network_os }}"
|
||||
ansible_connection: "{{ zabbix_connection }}"
|
||||
ansible_httpapi_port: "{{ zabbix_httpapi_port }}"
|
||||
ansible_httpapi_use_ssl: "{{ zabbix_httpapi_use_ssl }}"
|
||||
ansible_httpapi_validate_certs: "{{ zabbix_httpapi_validate_certs }}"
|
||||
ansible_host: "{{ zabbix_server }}"
|
||||
ansible_zabbix_url_path: "{{ zabbix_url_path }}"
|
||||
tags:
|
||||
- zabbix_api
|
||||
block:
|
||||
- name: Import Rsyslogd template file
|
||||
community.zabbix.zabbix_template:
|
||||
template_yaml: "{{ lookup('file', 'rsyslogd/zabbix-template.yml') }}"
|
||||
state: present
|
||||
- name: Ensure Rsyslogd hostgroup is present
|
||||
community.zabbix.zabbix_group:
|
||||
host_groups:
|
||||
- Rsyslogd servers
|
||||
state: present
|
||||
- name: Add self to Rsyslogd in Zabbix
|
||||
community.zabbix.zabbix_host:
|
||||
host_name: "{{ inventory_hostname }}"
|
||||
host_groups: Rsyslogd servers
|
||||
link_templates: Rsyslogd Processes
|
||||
force: false
|
||||
Reference in New Issue
Block a user