zabbix agent安装脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix agent安装脚本相关的知识,希望对你有一定的参考价值。
为了以后批量部署,节省时间和人力就把zabbix_agent的安装方法改成源码的,仅供参考
#!/bin/bash #zabbix server 端IP 地址 SERVER="10.10.99.78" #zabbix 版本号,也就是源码包.tar.gz前面的部分 VER="/usr/local/src/zabbix-2.4.4" groupadd zabbix useradd -g zabbix zabbix -s /sbin/nologin tar xvf $VER.tar.gz cd $VER ./configure --prefix=/usr/local/zabbix --enable-agent make install #该版本zabbix不需要make,直接make install即可,其它版本请酌情修改 echo "Installation completed !" mkdir /var/log/zabbix chown zabbix.zabbix /var/log/zabbix cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/ chmod 755 /etc/init.d/zabbix_agentd sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_agentd ln -s /usr/local/zabbix/etc /etc/zabbix ln -s /usr/loca/zabbix/bin/zabbix_get /usr/bin/ ln -s /usr/loca/zabbix/bin/zabbix_sender /usr/bin/ ln -s /usr/loca/zabbix/sbin/zabbix_agent /usr/sbin/ ln -s /usr/loca/zabbix/sbin/zabbix_agentd /usr/sbin/ echo "zabbix-agent 10050/tcp #Zabbix Agent" >> /etc/services echo "zabbix-agent 10050/udp #Zabbix Agent" >> /etc/services echo "zabbix-trapper 10051/tcp #Zabbix Trapper" >> /etc/services echo "zabbix-trapper 10051/udp #Zabbix Trapper" >> /etc/services sed -i "s/Server\=127.0.0.1/Server=$SERVER/g" /etc/zabbix/zabbix_agentd.conf sed -i "s/ServerActive\=127.0.0.1/ServerActive=$SERVER:10051/g" /etc/zabbix/zabbix_agentd.conf sed -i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g" /etc/zabbix/zabbix_agentd.conf sed -i "s#UnsafeUserParameters=0#UnsafeUserParameters=1#g" /etc/zabbix/zabbix_agentd.conf sed -i "s%# Include=/usr/local/etc/zabbix_agentd.userparams.conf%Include=/etc/zabbix/zabbix_agentd.conf.d/%g" /etc/zabbix/zabbix_agentd.conf chkconfig zabbix_agentd on service zabbix_agentd start
本文出自 “不抛弃!不放弃” 博客,请务必保留此出处http://thedream.blog.51cto.com/6427769/1844447
以上是关于zabbix agent安装脚本的主要内容,如果未能解决你的问题,请参考以下文章