salt安装zabbix

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了salt安装zabbix相关的知识,希望对你有一定的参考价值。

states文件:

 

技术分享

技术分享

 

 技术分享

 技术分享

技术分享

 

[[email protected] base]# cat top.sls
base:
  ‘*‘:
    - init.env_init
[[email protected] base]# cat init/env_init.sls
include:
  - init.zabbix_agent

[[email protected] base]# cat init/zabbix_agent.sls
zabbix-agent:
  pkg.installed:
    - name: zabbix22-agent

  file.managed:
    - name: /etc/zabbix_agentd.conf
    - source: salt://init/files/zabbix_agentd.conf
    - tmplate: jinjia
    - defaults:
      Server: {{ pillar[‘zabbix-agent‘][‘Zabbix-Server‘] }}
    - require:
    - pkg: zabbix-agent

  service.running:
    - enable: True
    - watch:
    - pkg: zabbix-agent
    - file: zabbix-agent

 

 

[[email protected] pillar]# cat base/top.sls
base:
  ‘*‘:
    - zabbix
[[email protected] pillar]# cat base/zabbix.sls
zabbix-agent:
  Zabbix-Server: 192.168.1.65

 

[[email protected] files]# grep -Ev "^$|^#" zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server={{Server}}
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix_agentd.conf.d/

 

启动时没这个文件会报错:

mkdri /etc/zabbix_agentd.conf.d

 

 执行:

[[email protected] ~]# salt ‘*‘ state.highstate test=True

[[email protected] ~]# salt ‘*‘ state.highstate 

 

以上是关于salt安装zabbix的主要内容,如果未能解决你的问题,请参考以下文章

saltstack源码安装zabbix_agent

SaltStack 使用pillar安装配置管理zabbix

SaltStack在Master上给Minion端安装zabbix

Saltstack配置管理

zabbix 监控硬盘状态

Saltstack部署zabbix