Installing the Zabbix Agent shell script

Source: Internet
Author: User
Tags snmp

#!/bin/bash[ -d /usr/local/zabbix ] && echo  "/usr/local/zabbix  Exist " && exitif ps -ef | grep zabbix_agentd | grep  -v grep ; thenecho  "Zabbix agent is installed" exitfiyum install - Y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++  libaio libaio-devel bzr bison libtool ncurses5-devel net-snmp\*  libxml2 libxml2-devel bzip2 libpng-devel freetype-devel bzip2-devel curl*  curl-devel libjpeg\* openjpeg\*if [ $? != 0 ] ;thenecho -e  " \033[31minstall rpm failed\033[0m "exit 0fiuseradd zabbixcd /tmpwget http:// 10.10.45.81:8000/zabbix-3.2.6.tar.gztar zvxf zabbix-3.2.6.tar.gzcd zabbix-3.2.6./configure  --prefix=/usr/local/zabbiX --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2makemake  installwhile truedoifconfigecho -e  "\033[31mplease input network\033[0m" read  inputif ifconfig  $input >/dev/null ; thenip= ' ifconfig  $input  | grep   "Inet addr"  | awk  ' {print $2} '  | awk -F  ': '   ' {print  $2} ' echo  $ipbreakelseecho  -e  "\033[31minput err\033[0m" fidonesed -i  ' s/ Server=127.0.0.1/server=10.10.45.152/g '  /usr/local/zabbix/etc/zabbix_agentd.confsed -i  ' s/ Serveractive=127.0.0.1/serveractive=10.10.45.152/g '  /usr/local/zabbix/etc/zabbix_agentd.confsed -i   "s/hostname=zabbix server/hostname= $ip/g"  /usr/local/zabbix/etc/zabbix_agentd.confecho  "- ------------------------------ show zabbix agent conf file --------------------- ----------"awk  '/^[^#]/'  /usr/local/zabbix/etc/zabbix_agentd.conf/usr/local/zabbix/sbin/zabbix_agentdif grep zabbix_ agentd /etc/rc.local >/dev/null ;thenecho -e  "\033[31mno need change  rc.local\033[0m "else echo "/usr/local/zabbix/sbin/zabbix_agentd " >> /etc/ Rc.localfi

Install Zabbix Agent shell script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.