zabbix5.0 Agent包配置

Zabbix Agent配置文件参数详解

  • LogFileSize:0-1024MB,制定日志文件大小,默认为1MB,可以适当调整,当设置为0,日志将不会自动切割
  • RefreshActiveChecks:活动检查列表的刷新频率,以秒为单位。请注意,在刷新活动检查失败后,将在 60 秒后尝试下一次刷新。
  • BufferSend:不要将数据保存在缓冲区中超过 N 秒
  • BufferSize:内存缓冲区中的最大值数。 会寄存在agent中,如果缓冲区已满,则将所有收集的数据发送到 Zabbix 服务器或代理。
  • Timeout:处理时间不超过超时秒数
  • UnsafeUserParameters:允许将所有特殊字符作为参数传递给用户定义的参数
  • AllowRoot

zabbix Agent默认配置

[root@kvm-10-128-52-177 etc]# egrep -v "^#|^$" zabbix_agentd.conf
PidFile=/opt/zabbix_agent/tmp/zabbix_agentd.pid
LogFile=/opt/zabbix_agent/log/zabbix_agentd.log
LogFileSize=10
AllowKey=system.run[*]
Server=10.128.52.177
ServerActive=10.128.52.177
Hostname=10.128.52.177
Timeout=30
AllowRoot=1
Include=/opt/zabbix_agent/etc/zabbix_agentd.conf.d/*.conf
UnsafeUserParameters=1

为zabbix agent设置systemctl启动

# /lib/systemd/system

#  vim zabbix-agent.service

[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/opt/zabbix_agent/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/opt/zabbix_agent/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/opt/zabbix_agent/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
#User=zabbix
#Group=zabbix

[Install]
WantedBy=multi-user.target

配置开机自启动

systemctl enable --now zabbix-agent

Zabbix Agent2配置文件参数详解

[root@kvm-10-128-52-177 etc]# egrep -v "^#|^$" zabbix_agent2.conf
PidFile=/opt/zabbix_agent/tmp/zabbix_agent2.pid
LogFile=/opt/zabbix_agent/log/zabbix_agent2.log
LogFileSize=10
Server=10.128.52.177
ServerActive=10.128.52.177
Hostname=kvm-10-128-52-177
Timeout=30
ControlSocket=/opt/zabbix_agent/tmp/agent.sock
AllowKey=system.run[*]

为zabbix agent2设置systemctl启动

# /lib/systemd/system

#  vim zabbix-agent2.service

[Unit]
Description=Zabbix Agent 2
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/opt/zabbix_agent/etc/zabbix_agent2.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent2
Type=simple
Restart=on-failure
PIDFile=/opt/zabbix_agent/tmp/zabbix_agent2.pid
KillMode=control-group
ExecStart=/opt/zabbix_agent/sbin/zabbix_agent2 -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
#User=zabbix
#Group=zabbix

[Install]
WantedBy=multi-user.target

 配置开机自启动

systemctl enable --now zabbix-agent2

  

  

 

posted @ 2022-03-06 14:46  摩天居士-谢烟客  阅读(277)  评论(0编辑  收藏  举报