Neste post será script para instalar o agente do Zabbix com os agentes pré-compilados do site.
Para manter o versionamento do agente eu coloquei o pacote na raíz do site do servidor do frontend do Zabbix , este agente é a versão pré-compilada.
http://www.zabbix.com/download.php
OBS : No passo “configure_agent” se atente ao parâmetro Server .
# !/bin/bash agentdownload=http://10.0.0.5/zabbix/zabbix_agents_3.0.0.linux2_6.amd64.tar.gz zbdir=/tmp/zabbix-agent zbconf=/etc/zabbix/zabbix_agentd.conf temp=/tmp/zabbix-* ## Check Presence if [ -f /etc/zabbix/zabbix_agentd.conf ] then echo $'Zabbix agent exists.' else #Download agent mkdir $zbdir cd $zbdir echo $'Download Agent' wget -v $agentdownload #descompress cd $zbdir tar -xvf zabbix_agents_3.0.0.linux2_6.amd64.tar.gz echo $'Unzip files' #install_agent echo $'Install agent' adduser zabbix -s /bin/false cd $zbdir mkdir /etc/zabbix cp -R bin/* /etc/zabbix/ cp -R sbin/* /etc/zabbix/ cp -R bin/* /usr/local/bin/ cp -R sbin/* /usr/local/sbin/ chown -R zabbix:zabbix /etc/zabbix/ #configure_agent echo $'Configure agent' cd $zbdir cp $zbconf $zbconf.ORIG echo "" > $zbconf echo "Server=10.0.0.5" >> $zbconf echo "Hostname=`hostname`" >> $zbconf echo "StartAgents=5" >> $zbconf echo "DebugLevel=3" >> $zbconf echo "LogFile=/var/log/zabbix_agentd.log" >> $zbconf echo "Timeout=3" >> $zbconf #remove_temp echo $'Remove temp files' rm -rf $temp #start_service touch /var/log/zabbix_agentd.log chown zabbix.zabbix /var/log/zabbix_agentd.log cd /usr/local/etc/ ln -s /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd #Log Install echo "Agent zabbix is configured at `date`" >> /etc/zabbix/dateinstall.log fi
Após rodar os scripts com os parâmetros do ambiente que será aplicado podemos ver que o processo do zabbix agent está rodando :