所需:LNMP环境追求完美部署、zabbix部署
[root@WangJiayue ~]# d -ri 's/(post_max_size =).*/ 16M/g' /etc/php.ini[root@WangJiayue ~]# d -ri 's/(max_execution_time =).*/ 300/g' /etc/php.ini[root@WangJiayue ~]# d -ri 's/(max_input_time =).*/ 300/g' /etc/php.ini[root@WangJiayue ~]# d -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini[root@WangJiayue ~]# rvice php-fpm restartGracefully shutting down php-fpm . doneStarting php-fpm done[root@WangJiayue ~]# cd /usr/src/zabbix-5.0.2[root@WangJiayue zabbix-5.0.2]# mkdir /usr/local/nginx/html/zabbix[root@WangJiayue zabbix-5.0.2]# cp -a ui/* /usr/local/nginx/html/zabbix/[root@WangJiayue zabbix-5.0.2]# chown -R nginx.nginx /usr/local/nginx/html/zabbix/[root@WangJiayue zabbix-5.0.2]# nginx -s reload[root@WangJiayue zabbix-5.0.2]# rvice php-fpm restartGracefully shutting down php-fpm . doneStarting php-fpm done
[root@WangJiayue ~]# vim /usr/local/nginx/conf/nginx.conflocation / { root html/zabbix; //添加zabbix index index.php index.html index.htm; } //添加以下内容 location ~ \.php$ { root html/zabbix; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}[root@WangJiayue ~]# nginx -s reload
[root@WangJiayue ~]# chmod 777 /usr/local/nginx/html/zabbix/conf[root@WangJiayue ~]# ll -d /usr/local/nginx/html/zabbix/confdrwxrwxrwx 3 nginx nginx 94 7月 6 17:54 /usr/local/nginx/html/zabbix/conf[root@WangJiayue ~]# nginx -s reload
这里原来的浏览器提示版本过低不能访问zabbix页面故改为Google 浏览器访问
[root@WangJiayue ~]# chmod 755 /usr/local/nginx/html/zabbix/conf[root@WangJiayue ~]# ll -d /usr/local/nginx/html/zabbix/confdrwxr-xr-x 3 nginx nginx 117 8月 12 02:03 /usr/local/nginx/html/zabbix/conf
[root@WangJiayue ~]# vim /usr/local/nginx/conf/nginx.conf//添加以下内容location /status { stub_status on; allow 192.168.222.0/24; //让192.168.222.0网段可以访问 deny all; }[root@WangJiayue ~]# nginx -t //检查语法nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[root@WangJiayue ~]# nginx -s reload //重读配置文件
这里截图整个网页文字太小故截取一部分
[root@WangJiayue ~]# mkdir /scripts[root@WangJiayue ~]# cd /scripts/[root@WangJiayue scripts]# vim handled.sh#!/bin/bashstatus=$(curl -s http://192.168.222.139/status |awk 'NR==3{print $3}')echo $status[root@WangJiakeep过去式yue scripts]# chmod +x handled.sh [root@WangJiayue scripts]# vim Reading.sh#!/bin电脑基础知识入门/bashstatus=$(curl -s http://192.168.222.139/status |awk 'NR==4{print $2}')echo $status[root@WangJiayue scripts]# chmod +x Reading.sh [root@WangJiayue scripts]# vim Writing.sh#!/bin/bashstatus=$(curl -s http://192.168.222.139/status |awk 'NR==4{print $4}')echo $status[root@WangJiayue scripts]# chmod +x Writing.sh [root@WangJiayue scripts]# ll总用量 12-rwxr-xr-x 1 root root 98 8月 12 02:13 handled.sh-rwxr-xr-x 1 root root 98 8月 12 02:14 Reading.sh-rwxr-xr-x 1 root root 98 8月 12 02:16 Writing.sh
[root@WangJiayue ~]# vim /usr/local/etc/zabbix_agentd.confUnsafeUrParameters=1 //取消注释更改数值为1//在最后添加以下内容UrParameter=ch南通大学专业eck_handled,/bin/bash /scripts/handled.sh UrParameter=check_Reading,/bin/bash /scripts/Reading.shUrParameter=check_Writing,/bin/bash /scripts/Writing.sh[root@WangJiayue ~]# pkill zabbix[root@WangJiayue ~]# zabbix_rver [root@WangJiayue ~]# zabbix_agentd [root@WangJiayue ~]# ss -antlState Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:10050 *:* LISTEN 0 128 *:10051 *:* LISTEN 0 128 127.0.0.1:9000 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 80 :::3306 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* [root@WangJiayue ~]#
[root@WangJiayue ~]# zabbix_get -s 127.0.0.1 -k check_handled184[root@WangJiayue ~]# zabbix_get -s 127.0.0.1 -k check_Reading0[root@WangJiayue ~]# zabbix_get -s 127.0.0.1 -k check_Writing1
本文地址:https://blog.csdn.net/wanfjiayue/article/deta热烈的祝贺ils/107948495
本文发布于:2023-04-08 21:29:38,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/1bfdee512b1f59ab85245f11ad8f125d.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:zabbix监控Nginx状态.doc
本文 PDF 下载地址:zabbix监控Nginx状态.pdf
留言与评论(共有 0 条评论) |