#! /usr/bin/env bash # you must change this to the IP of your current Zabbix server ZABBIXSERVER=ip.of.zabbix.server # if we have not already saved the agent conf, then do so if [ ! -f /etc/zabbix/zabbix_agentd.conf.save ] ; then mv /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.save ; fi # write the new configuration # These first two lines are Debian specific echo 'PidFile=/run/zabbix/zabbix_agentd.pid' > /etc/zabbix/zabbix_agentd.conf echo 'LogFile=/var/log/zabbix/zabbix_agentd.log' >> /etc/zabbix/zabbix_agentd.conf echo 'LogFileSize=0' >> /etc/zabbix/zabbix_agentd.conf # allow traffic from ZABBIXSERVER echo 'Server=$ZABBIXSERVER' >> /etc/zabbix/zabbix_agentd.conf # grab our hostname and specifically use it echo Hostname=`hostname -f` >> /etc/zabbix/zabbix_agentd.conf # include anything in the includes directory echo 'Include=/etc/zabbix/zabbix_agentd.d/*.conf' >> /etc/zabbix/zabbix_agentd.conf # restart agent service zabbix-agent restart