界面汉化

zabbix本身自带中文,可在设置里直接修改为中文。直接点击右上角的[Profile] 直接设置为中文 1

设置之后在查看图形是,会发现有方块字体出现,是因为没有中文字体导 致 2 下载一个中文字体替换默认的字体即可

cd /var/www/html/fonts/
wget https://dl.cactifans.com/tools/msty.ttf
mv msty.ttf DejaVuSans.ttf

说明

zabbix web目录为/var/www/html 具体目录根据自身情况修改,切勿照搬 msty.ttf为微软的雅黑字体,来自互联网共享

替换之后打开图片,中文已经能够正确显示了 3

fping安装配置

zabbix默认自带ICMP的监控模版,不过服务器需要安装fping,才能使用此模版 使用源码编译的方法安装fping 下载fping源码并编译安装

wget http://fping.org/dist/fping-3.13.tar.gz
tar zxvf fping-3.13.tar.gz 
cd fping-3.13
./configure
make
make install

完成fping安装之后,默认的安装路在/usr/local/sbin/fping,zabbix server默认的配置文件里,fping的路径为/usr/sbin/fping,为了方便,直接做一个软连接过去

ln -s /usr/local/sbin/fping /usr/sbin/fping

做好软连接,还需要赋予权限,因为zabbix执行ICMP检测使用系统zabbix用户去调用fping命令,你可能会在zabbix server日志里看到如下错误

fping failed: "/usr/sbin/fping: can't create raw socket (must run as root?) : Operation not permitted

表明没有权限, 赋予权限即可解决

chmod u+s /usr/sbin/fping

启动脚本

使用源码编译不自带启动脚本文件需要自己编写 zabbix server启动文件

#!/bin/sh
#
# chkconfig: - 85 15
# description: Zabbix server daemon
# config: /usr/local/zabbix/etc/zabbix_server.conf
#

### BEGIN INIT INFO
# Provides: zabbix
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix server
# Description: Zabbix server
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -x /usr/local/zabbix/sbin/zabbix_server ]; then
    exec=/usr/local/zabbix/sbin/zabbix_server
else
    exit 5
fi

prog=${exec##*/}
conf=/usr/local/zabbix/etc/zabbix_server.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2)

if [ -f /etc/sysconfig/zabbix-server ]; then
    . /etc/sysconfig/zabbix-server
fi

lockfile=/var/lock/subsys/zabbix-server

start()
{
    echo -n $"Starting Zabbix server: "
    daemon $exec -c $conf
    rv=$?
    echo
    [ $rv -eq 0 ] && touch $lockfile
    return $rv
}

stop()
{
    echo -n $"Shutting down Zabbix server: "
    killproc $prog
    rv=$?
    echo
    [ $rv -eq 0 ] && rm -f $lockfile
    return $rv
}

restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status -p $pidfile $prog
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
        ;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
    echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
    exit 2
    ;;
esac

如果你的zabbix安装路径和文件中的不一致,请根据实际情况修改 把此文件命名为zabbix-server并放到/etc/init.d目录下

chmod a+x /etc/init.d/zabbix-server
chkconfig zabbix-server on

这样就设置了zabbix server开机启动。

设置zabbix agent启动脚本

#!/bin/sh
#
# chkconfig: - 86 14
# description: Zabbix agent daemon
# processname: zabbix_agentd
# config: /usr/local/zabbix/etc/zabbix_agentd.conf
#

### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: zabbix zabbix-proxy
# Should-Stop: zabbix zabbix-proxy
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix agent
# Description: Zabbix agent
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -x /usr/local/zabbix/sbin/zabbix_agentd ]; then
    exec=/usr/local/zabbix/sbin/zabbix_agentd
else
    exit 5
fi

prog=${exec##*/}
conf=/usr/local/zabbix/etc/zabbix_agentd.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2)

if [ -f /etc/sysconfig/zabbix-agent ]; then
    . /etc/sysconfig/zabbix-agent
fi

lockfile=/var/lock/subsys/zabbix-agent

start()
{
    echo -n $"Starting Zabbix agent: "
    daemon $exec -c $conf
    rv=$?
    echo
    [ $rv -eq 0 ] && touch $lockfile
    return $rv
}

stop()
{
    echo -n $"Shutting down Zabbix agent: "
    killproc $prog
    rv=$?
    echo
    [ $rv -eq 0 ] && rm -f $lockfile
    return $rv
}

restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status -p $pidfile $prog 
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
        ;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
    echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
    exit 2
    ;;
esac

如果你的zabbix agent安装路径和文件中的不一致,请根据实际情况修改 把此文件命名为zabbix-agent并放到/etc/init.d目录下

chmod a+x /etc/init.d/zabbix-agent
chkconfig zabbix-agent on

这样就设置了zabbix agent开机启动。