#!/bin/bash -

#
# ZABBIX-Agent
#  command:
#   curl http://download.alphabets.cn/bin/zabbix.sh | sh -s -- hostname
#  params:
#   hostname
#   dnsserverip
#

####
# install agent
####
yum -y install http://download.alphabets.cn/lib/zabbix-release-2.4-1.el7.noarch.rpm
yum -y install zabbix-agent

####
# config zabbix agent
####
sed -i "s/^Server=.*$/Server=zabbix.light.cn/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^ServerActive=.*$/ServerActive=zabbix.light.cn/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^Hostname=.*$/Hostname=$1/g" /etc/zabbix/zabbix_agentd.conf

####
# start service
####
systemctl start zabbix-agent
systemctl enable zabbix-agent
