一、zabbix-nginx部署
1.nginx源码编译、安装
[root@server3 ~]#ls
nginx-1.18.0.tar.gz
tar zxf nginx-1.18.0.tar.gz %解压
cd nginx-1.18.0/
vim auto/cc/gcc
# debug %注释debug选项,最小化安装空间
#CFLAGS="$CFLAGS -g"
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module %生成makefile文件
make && make install %安装
[root@server3 nginx-1.18.0]# cd /usr/local/nginx/
[root@server3 nginx]# ls
conf html logs sbin
[root@server3 nginx]#ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ %创建软连接,相当于创建环境变量
[root@server3 nginx]# which nginx
/usr/local/bin/nginx
[root@server3 conf]# vim /usr/local/nginx/conf/nginx.conf %修改配置文件以下部分
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
2.zabbix对nginx服务器的监控部署
nginx服务器:
[root@server3 conf]# cd /etc/zabbix/zabbix_agentd.d/
[root@server3 zabbix_agentd.d]# cp userparameter_mysql.conf userparameter_nginx.conf
[root@server3 zabbix_agentd.d]# ls
userparameter_mysql.conf userparameter_nginx.conf
[root@server3 zabbix_agentd.d]# vim userparameter_nginx.conf %编写监控项
UserParameter=nginx.active,curl -s http://127.0.0.1/status | grep Active | awk ‘{print $3}’
UserParameter=nginx.accept,curl -s http://127.0.0.1/status | awk ‘NR==3{print $1}’
UserParameter=nginx.handled,curl1/ -s http://127.0.0.status | awk 'NR==3{print $2}'
UserParameter=nginx.request,curl -s http://127.0.0.1/status | awk 'NR==3{print $3}'
[root@server3 zabbix_agentd.d]# systemctl restart zabbix-agent.service %重启zabbix-agent服务
zabbix server端:
yum install zabbix-get %安装get工具
zabbix_get -s 172.25.10.3 -p 10050 -k "nginx.active" %获取状态信息
3.zabbix图形界面监控项添加
4.监控图形化显示
二、字体修正
graphfont.ttf simkai.ttf > 下载这两个相关的字体文件到/usr/share/zabbix/assets/fonts目录中并将其权限改为777
修改定义前端页面字体的文件:
[root@server1 fonts]#vim /usr/share/zabbix/include/defines.inc.php