残缺极品 发表于 2018-7-31 10:25:02

saltstack批量安装zabbix agent

如果zabbix server变更了IP地址(由10.10.10.140改为10.10.10.148):  
# egrep -v '^#|^$' /etc/salt/states/init/files/zabbix_agentd.conf | grep -w Server
  
Server=10.10.10.148
  
推送下,更新服务器的agent ip状态:
  
# salt '*' state.highstate
  
----------
  
          ID: zabbix_agent
  
    Function: file.managed
  
      Name: /etc/zabbix_agentd.conf
  
      Result: True
  
   Comment: File /etc/zabbix_agentd.conf updated
  
   Started: 14:22:29.306875
  
    Duration: 16.102 ms
  
   Changes:
  
            ----------
  
            diff:
  
                  ---
  
                  +++
  
                  @@ -79,7 +79,7 @@
  
                   # Server=
  

  
                   #Server=127.0.0.1
  
                  -Server=10.10.10.140
  
                  +Server=10.10.10.148
  

  
                   ### Option: ListenPort
  
                   #Agent will listen on this port for connections from the server.
  
----------
  
Summary
  
------------
  
Succeeded: 9 (changed=1)
  
Failed:    0
  
------------
  
Total states run:   9
  
检查下客户端,看agent的ip地址是否已经调整了:
  
#salt '*' cmd.run "egrep -v '^#|^$' /etc/zabbix_agentd.conf|grep -w Server"
  
node01.saltstack.com:
  
    Server=10.10.10.148
  
node02.saltstack.com:
  
    Server=10.10.10.148
页: [1]
查看完整版本: saltstack批量安装zabbix agent