This commit is contained in:
parent
ed7c5583bb
commit
56f27dc9d9
61
states/zabbix/agent2/config.sls
Normal file
61
states/zabbix/agent2/config.sls
Normal file
@ -0,0 +1,61 @@
|
||||
---
|
||||
{%- from "zabbix/map.jinja" import zabbix with context %}
|
||||
zabbix-config-dir:
|
||||
file.directory:
|
||||
- name: /etc/zabbix
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- mode: 755
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
|
||||
zabbix-log-dir:
|
||||
file.directory:
|
||||
- name: /var/log/zabbix
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- mode: 755
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
|
||||
zabbix-agent2-config-dir:
|
||||
file.directory:
|
||||
- name: /etc/zabbix/zabbix_agent2.d
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- mode: 755
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
|
||||
zabbix-agent2-config:
|
||||
file.managed:
|
||||
- name: /etc/zabbix/zabbix_agent2.conf
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- source: salt://zabbix/templates/zabbix_agent2.conf.j2
|
||||
- template: jinja
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
|
||||
{% if zabbix.agent2.config.TLSPSKFile is iterable %}
|
||||
zabbix-agent2-tlspsk-file:
|
||||
file.managed:
|
||||
- name: {{ zabbix.agent2.config.TLSPSKFile }}
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- contents: {{ zabbix.agent2.psk }}
|
||||
- create: true
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
{% endif %}
|
||||
|
||||
zabbix-userparameters:
|
||||
file.managed:
|
||||
- name: /etc/zabbix/zabbix_agent2.d/user_parameters.conf
|
||||
- source: salt://zabbix/templates/user_parameters.j2
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.user }}
|
||||
- mode: 0755
|
||||
- template: jinja
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
6
states/zabbix/agent2/init.sls
Normal file
6
states/zabbix/agent2/init.sls
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
include:
|
||||
- .install
|
||||
- .config
|
||||
- .scripts
|
||||
- .service
|
7
states/zabbix/agent2/install.sls
Normal file
7
states/zabbix/agent2/install.sls
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
{%- from "zabbix/map.jinja" import zabbix with context %}
|
||||
zabbix-agent2-pkgs:
|
||||
pkg.installed:
|
||||
- pkgs: {{ zabbix.agent2.pkgs }}
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
21
states/zabbix/agent2/scripts.sls
Normal file
21
states/zabbix/agent2/scripts.sls
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
{%- from "zabbix/map.jinja" import zabbix with context %}
|
||||
zabbix-script-dir:
|
||||
file.directory:
|
||||
- name: /etc/zabbix/scripts
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.group }}
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
|
||||
{% for key, value in zabbix.agent2.scripts.items() -%}
|
||||
zabbix-script-{{ key }}:
|
||||
file.managed:
|
||||
- name: /etc/zabbix/scripts/{{ value.name }}
|
||||
- source: salt://zabbix/scripts/{{ value.name }}
|
||||
- user: {{ zabbix.agent2.user }}
|
||||
- group: {{ zabbix.agent2.group }}
|
||||
- mode: 0755
|
||||
- watch_in:
|
||||
- service: zabbix-agent2-service
|
||||
{% endfor -%}
|
6
states/zabbix/agent2/service.sls
Normal file
6
states/zabbix/agent2/service.sls
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
{%- from "zabbix/map.jinja" import zabbix with context %}
|
||||
zabbix-agent2-service:
|
||||
service.running:
|
||||
- name: zabbix-agent2
|
||||
- enable: true
|
@ -19,24 +19,24 @@ zabbix:
|
||||
PidFile: /run/zabbix/zabbix_server.pid
|
||||
StartDBSyncers: 1
|
||||
CacheSize: 33554432
|
||||
agent:
|
||||
agent2:
|
||||
enable: true
|
||||
user: zabbix
|
||||
group: zabbix
|
||||
pkgs:
|
||||
- python3-pyzabbix
|
||||
- zabbix-agent
|
||||
# - zabbix-agent
|
||||
- zabbix-agent2
|
||||
# - zabbix-get
|
||||
# - zabbix-sender
|
||||
config:
|
||||
BufferSize: 10000
|
||||
Hostname: localhost
|
||||
Include: "/etc/zabbix/zabbix_agentd.conf.d/*.conf"
|
||||
LogFile: /var/log/zabbix/zabbix_agentd.log
|
||||
Include: "/etc/zabbix/zabbix_agent2.d/*.conf"
|
||||
LogFile: /var/log/zabbix/zabbix_agent2.log
|
||||
LogFileSize: 0
|
||||
LogType: file
|
||||
PidFile: /var/run/zabbix/zabbix_agentd.pid
|
||||
PidFile: /var/run/zabbix/zabbix_agent2.pid
|
||||
Server: 127.0.0.1
|
||||
ServerActive: zabbix.paulbsd.com
|
||||
Timeout: 10
|
||||
|
@ -9,5 +9,11 @@ include:
|
||||
{% endif %}
|
||||
{% if zabbix.agent.enable %}
|
||||
- repo
|
||||
- .agent
|
||||
- .agent2
|
||||
|
||||
## for upgrade
|
||||
zabbix-agent-service:
|
||||
service.stopped:
|
||||
- name: zabbix-agent
|
||||
- enable: false
|
||||
{% endif %}
|
||||
|
4
states/zabbix/templates/zabbix_agent2.conf.j2
Normal file
4
states/zabbix/templates/zabbix_agent2.conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
{%- from "zabbix/map.jinja" import zabbix with context -%}
|
||||
{%- for key, value in zabbix.agent2.config.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{%- endfor -%}
|
Loading…
Reference in New Issue
Block a user