linux安装zabbix的tar包和另外一个并存

在安装zabbix客户端的时候,发现存在一个zabbix客户端,现在我们要重新建一个来与之并存

第一步安装:

cd /data0/software/
tar xf zabbix-3.0.28.tar.gz 
cd zabbix-3.0.28
./configure --prefix=/usr/local/zabbix-3.0.28 --enable-agent
make & make install

第二步:

cd /data0/software/zabbix-3.0.28/misc/init.d/fedora/core
cp zabbix_agentd  /etc/init.d/zabbix_agentd-3.0.28

cd /etc/init.d
#修改 BASEDIR=/usr/local/zabbix-3.0.28
#BINARY_NAME=zabbix_agentd-3.0.28

zabbix的启动配置文件

linux安装zabbix的tar包和另外一个并存
. /etc/init.d/functions
    # Zabbix-Directory
    BASEDIR=/usr/local/zabbix-3.0.28
    # Binary File
    BINARY_NAME=zabbix_agentd-3.0.28
    # Full Binary File Call
    FULLPATH=$BASEDIR/sbin/$BINARY_NAME
    # PID file
    PIDFILE=/tmp/$BINARY_NAME.pid
    # Establish args
    ERROR=0
    STOPPING=0
if [ -f $PIDFILE  ] && [ -s $PIDFILE ]
    then
    PID=`cat $PIDFILE`
    if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null && [ $BINARY_NAME == `ps -e | grep $PID | awk '{print $4}'` ]
    then
        STATUS="$BINARY_NAME (pid `pidof $APP`) running.."
        RUNNING=1
    else
        rm -f $PIDFILE
        STATUS="$BINARY_NAME (pid file existed ($PID) and now removed) not running.."
        RUNNING=0
    fi
else
    if [ `ps -e | grep $BINARY_NAME | head -1 | awk '{ print $1 }'` ]
        then
        STATUS="$BINARY_NAME (pid `pidof $APP`, but no pid file) running.."
    else
        STATUS="$BINARY_NAME (no pid file) not running"
    fi
    RUNNING=0
fi
start() {
    if [ $RUNNING -eq 1 ]
        then
        echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"
    else
        action $"Starting $BINARY_NAME: " $FULLPATH
        touch /var/lock/subsys/$BINARY_NAME
    fi
}
stop() {
    echo -n $"Shutting down $BINARY_NAME: "
    killproc $BINARY_NAME
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BINARY_NAME
    RUNNING=0
}
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $BINARY_NAME
        ;;
    restart)
        stop
        sleep 10
        start
        ;;
    help|*)
        echo $"Usage: $0 {start|stop|status|restart|help}"
        cat <<EOF
            start        - start $BINARY_NAME
            stop        - stop $BINARY_NAME
            status        - show current status of $BINARY_NAME
            restart        - restart $BINARY_NAME if running by sending a SIGHUP or start if not running
            help        - this screen
EOF
    exit 1
    ;;
esac
exit 0
zabbix启动文件

第三步:修改配置文件

cd /usr/local/zabbix-3.0.28/etc

[root@123 etc]# egrep -v "^#|^$" zabbix_agentd.conf
PidFile=/tmp/zabbix_agentd-3.0.28.pid
LogFile=/tmp/zabbix_agentd-3.0.28.log
Server=ip
ListenPort=10052
ServerActive=ip
Hostname=主机名

touch /tmp/zabbix_agentd-3.0.28.pid

touch /tmp/zabbix_agentd-3.0.28.log

chown zabbix.zabbix /tmp/zabbix_agentd-3.0.28.pid

chown zabbix.zabbix /tmp/zabbix_agentd-3.0.28.log

mv /usr/local/zabbix-3.0.28/sbin/zabbix_agentd /usr/local/zabbix-3.0.28/sbin/zabbix_agentd-3.0.28  #修改命令,这跟配置文件有关

第四步:配置自启动

chkconfig --add zabbix_agentd-3.0.28 
chkconfig --level 345 zabbix_agentd-3.0.28 on

 

上一篇:zabbix如何自定义一个监控项对web网站进行存活监控和报警?


下一篇:我的环境