• zabbix监控nginx


    1.监控nginx

    安装nginx,并且配置一个论坛

    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    yum install centos-release-scl -y
    yum -y install nginx mariadb-server rh-php72-php rh-php72-php-cli rh-php72-php-common rh-php72-php-fpm rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-pdo  rh-php72-php-xml rh-php72-php-mysqlnd rh-redis5 sclo-php72-php-pecl-redis5

    配置文件

    vim /etc/opt/rh/rh-php72/php-fpm.d/www.conf
    user = nginx
    group = nginx

     论坛代码可到官网下载:https://www.discuz.net/forum-10-1.html

    unzip -q Discuz_X3.3_SC_UTF8.zip -d /code/discuz/

    chown -R nginx:nginx /code/discuz/
    vim /etc/nginx/conf.d/discuz.conf
    server {
            listen 80;
            server_name discuz.kongd.com;
            root /code/discuz/upload;
            location / {
            index index.php index.html;
            }
            location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            }
    }

    启动服务 

    systemctl enable nginx.service mariadb.service rh-php72-php-fpm.service rh-redis5-redis.service --now

    输入ip就能访问了 

    vim /etc/nginx/conf.d/monitor.conf

    server {
            listen 127.0.0.1:80;
            server_name 127.0.0.1;
            location /nginxstatus {
            stub_status on;
            access_log off;
            allow 127.0.0.1;
            }
    }

    nginx -t  检查

     nginx -s reload  #加载配置

    测试  curl http://127.0.0.1//nginxstatus

     Active connections:当前活跃的客户端连接数,包括Waiting连接数;

    accepts :接受的客户端连接总数;
    handled :已处理的连接总数。通常与 “accepts” 的值相同,除非达到某些资源限制,
    “worker_connections”
    requests :客户端请求总数,一个客户端连接可能包含多个请求;
    Reading Nginx 正在读取请求标头的当前连接数;
    Writing Nginx 正在将响应写回给客户端的当前连接数;
    Waiting :当前等待请求的空闲连接数。
    通过以上数据可以写脚本获取其中参数
    然后创建zabbix的监控参数
    也可以使用自带的监控模板

    然后添加宏定义,可以在官方文档中找到

  • 相关阅读:
    路由守卫相关知识点
    Linux下手动修改服务器时间(没网环境下)
    java毕业设计道路桥梁工程知识文库系统Mybatis+系统+数据库+调试部署
    react 可视化编辑器1
    【Linux】:常见指令理解(3)
    golang结构与接口方法实现与交互使用示例
    对于相对规范的服务API应如何实现
    docker 清空所有镜像日志
    MyBatis-Plus 字段为Null时不更新解决方案,MyBatis-Plus 更新空字段
    初识Zookeeper
  • 原文地址:https://blog.csdn.net/wwqwwqwwq352/article/details/126143015