Zabbix one key Installation Agent [tar]

Source: Internet
Author: User
Tags snmp

#!/bin/bash# this is a script of auto install zabbix agent#  copyright to jeffery su# written on june 13,2014# set  Variablespath=/bin:/usr/bin:/sbin:/usr/sbin::/usr/local/bin:/usr/local/sbin;export pathip= ' ifconfig  |grep  ' inet addr: ' |awk  ' {print $2} ' |cut -d : -f 2|head -1 ' Function fping_ins {   fping_ver= "fping-3.10"    # Detecting  the setup packages exits   if [ -s ${fping_ver}.tar.gz ];    then       echo  "${fping_ver}.tar.gz [found]"    else       echo  "Error: ${fping_ver} not  found!!! Download now ... "       wget  http://fping.org/dist/${ Fping_ver}.tar.gz   fi   # compile the major programmer       tar zxf ${fping_ver}.tar.gz -c /usr/src   cd /usr/src/$FPING _ver    ./configure      if [[ $? != 0 ]];  then         echo  "error in the  Compilation,stop. "          exit 0   fi   make  &&  make install       # add user     groupadd zabbix   useradd zabbix -g zabbix      # grant privileges   chown root:zabbix /usr/local/ sbin/fping   chmod 4710 /usr/local/sbin/fping    }function  Agent_ins&nbSp {   zabbix_ver= "zabbix-2.2.3"    ZABBIX_SER_IP=172.16.xx.xx        #INTENTION: this is zabbix server ip address     ZABBIX_PRO_HOSTNAME=${IP}   #INTENTION:  this is zabbix proxy hostname    # Prepare work   yum -y install net-snmp  net-snmp-devel libcurl-devel gcc make wget  gcc-c++ autoconf  Ncurses-devel      # add user   groupadd zabbix    useradd zabbix -g zabbix   # Detecting the  zabbix packages exits   if [ -s ${zabbix_ver}.tar.gz ];    then       echo  "${zabbix_ver}.tar.gz [found"     else       echo  "Error: ${zabbix_ver} not found!!! Download now ... "       wget http://jaist.dl.sourceforge.net/ project/zabbix/zabbix%20latest%20stable/2.2.3/zabbix-2.2.3.tar.gz   fi   #  prepare work   yum -y install net-snmp net-snmp-devel  libcurl-devel gcc make wget  gcc-c++ autoconf ncurses-devel     #yum  install lr* -y   # compile the major programmer       tar zxf ${ZABBIX_VER}.tar.gz -C /usr/src    cd /usr/src/$ZABBIX _ver   ./configure --prefix=/usr/local/zabbix  -- enable-agent --with-net-snmp --with-libcurl   if [[ $? != 0  ]]; then         echo  "Error in the compilation,stop ..."          exit 0   fi   make  install   if [[ $? != 0 ]]; then          echo  "Error in the compilation,stop ..."         exit 0   else         echo  "Compilation finish ..."    fi    #  add zabbix services port   /bin/cp /etc/services /etc/ services.bak   cat >> /etc/services <<endzabbix-agent     10050/tcp    #Zabbix  Agentzabbix-agent    10050/udp     #Zabbix  Agentzabbix-trapper  10051/tcp    #Zabbix  trapperzabbix-trapper  10051/udp    #Zabbix  trapperend    # create  start file   /bin/cp /usr/src/$ZABBIX _ver/misc/init.d/fedora/core5/zabbix_ agentd /etc/init.d/   sed -i  ' s#/usr/local#/usr/local/zabbix# '  /etc/init.d/ zabbix_agentd   chmod 750 /etc/init.d/zabbix_agentd   chown  zabbix:zabbix /etc/init.d/zabbix_agentd   sed -i  '/^ZABBIX_BIN/aCONF_FILE= '/usr/ Local/zabbix/etc/zabbix_agentd.conf "'  /etc/init.d/zabbix_agentd   sed -i  ' s/ daemon  $ZABBIX _bin/daemon  $ZABBIX _bin -c   $CONF _file/'  /etc/init.d/zabbix_agentd    # Configure the zabbix_agent.conf   sed -i  "S#server =127.0.0.1#server= $ZABBIX _ser_ip# " /usr/local/zabbix/etc/zabbix_agentd.conf   sed -i   "s#serveractive=127.0.0.1#serveractive= $ZABBIX _ser_ip:10051# " /usr/local/zabbix/etc/zabbix_agentd.conf            sed -i  "/hostname=/s#=.*#" = $ZABBIX _pro_hostname# ""       /usr/local/zabbix/etc/zabbix_agentd.conf   sed -i  "s#\# timeout=3#timeout=30# "          /usr/local/zabbix/etc/zabbix _agentd.conf    #logfile  pidfile   # Start the zabbix  service on boot   chkconfig --add            zabbix_agentd   chkconfig zabbix_agentd   on     /etc/init.d/zabbix_agentd start      # Test  agent    echo  "Check local zabbix  agent"    /usr/ local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf -t system.uptime       }   fping_ins   agent_ins


This article is from the "Jeffery blog" blog, please be sure to keep this source http://oceanszf.blog.51cto.com/6268931/1619673

Zabbix one key Installation Agent [tar]

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.