Zabbix监控Tengine
title: Zabbix监控Tengine
tags: zabbix,nginx,tengine
author: Chinge Yang
date: 2016-12-29
Zabbix监控Tengine
@(学习)[nginx, zabbix, tengine]
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。现在作为一个开源项目,也越来越多的人使用它代替nginx。
1.添加Tengine配置
tengine配置文件添加如下server
server {
listen 80 ;
server_name 127.0.0.1 ;
location /nginx-status {
stub_status on;
allow 127.0.0.1;
deny all;
access_log off;
}
location /check-status {
check_status;
allow 127.0.0.1;
deny all;
access_log off;
}
}
重载Tengine后,本机查看结果:
# curl 127.0.0.1/nginx-status
Active connections: 1
server accepts handled requests
1805146 1805146 1805167
Reading: 0 Writing: 1 Waiting: 0
以上为正常显示结果。
2.添加nginx监控源脚本
cat /usr/local/zabbix/shell/nginx_status.sh
#!/bin/bash
HOST="127.0.0.1"
PORT="80"
# Functions to return nginx stats
function active {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| grep 'Active' | awk '{print $NF}'
}
function reading {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| grep 'Reading' | awk '{print $2}'
}
function writing {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| grep 'Writing' | awk '{print $4}'
}
function waiting {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| grep 'Waiting' | awk '{print $6}'
}
function accepts {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| awk NR==3 | awk '{print $1}'
}
function handled {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| awk NR==3 | awk '{print $2}'
}
function requests {
/usr/bin/curl "http://$HOST:$PORT/nginx-status" 2>/dev/null| awk NR==3 | awk '{print $3}'
}
# Run the requested function
$1
3.编辑zabbix agentd配置文件
修改如下:
vim /usr/local/zabbix/etc/zabbix_agentd.conf

添加zabbix自定义key,重启zabbix agentd
vim /usr/local/zabbix/etc/zabbix_agentd.conf.d/nginx_status_key
#nginx_status_key
UserParameter=nginx.accepts,/usr/local/zabbix/shell/nginx_status.sh accepts
UserParameter=nginx.handled,/usr/local/zabbix/shell/nginx_status.sh handled
UserParameter=nginx.requests,/usr/local/zabbix/shell/nginx_status.sh requests
UserParameter=nginx.connections.active,/usr/local/zabbix/shell/nginx_status.sh active
UserParameter=nginx.connections.reading,/usr/local/zabbix/shell/nginx_status.sh reading
UserParameter=nginx.connections.writing,/usr/local/zabbix/shell/nginx_status.sh writing
UserParameter=nginx.connections.waiting,/usr/local/zabbix/shell/nginx_status.sh waiting
从zabbix server端获取监控数据,结果如下为正常:

4.导入zabbix监控Tengine模板

5.Zabbix主机链接模板

6.监控成功

总结
从上文看到,Zabbix添加自定义监控数据,需要做到:
Zabbix agentd添加自定义key;
自定义key调用的是获取监控数据源脚本等;
添加Zabbix主机数据源模板,主机链接模板。
Zabbix监控Tengine的更多相关文章
- Tengine zabbix 监控
Tengine 配置 在http 段下新增以下配置 req_status_zone server_stat "$host" 3M; server { listen 9008; lo ...
- 使用Zabbix监控Oracle数据库
Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabb ...
- Zabbix监控nginx-rtmp status(json版)
与前面的文章 zabbix监控nginx-rtmp status(html版)区别只在于取值的页面不一样 http://127.0.0.1:81/control/get/all_streams sta ...
- Zabbix监控mysql performance
介绍 zabbix监控mysql性能,使用zabbix自带的mysql监控模板,可以监控以下内容OPS(增删改查).mysql慢查询数量.mysql请求\响应流量带宽 配置 新建mysql监控用户 G ...
- zabbix监控Java 8080端口
linux下端口和服务是对应的,Java进程启动时默认监听8080端口,如果服务挂掉则8080端口就没有了. lsof -i:8080 端口,如果没有任何的输出,说明该端口不在工作. 想在zabbix ...
- zabbix监控报错zabbix server is not running解决方法
问题描述: 布置好zabbix监控,正常运行.但是重启了虚拟机服务器之后,页面出现如下的报错,而且设置的报信息也是失效的:
- zabbix 监控web网站性能
一直在纠结用什么实例来给大家演示呢?想来想去还是官方的好,那我们怎么用zabbix监控web性能和可用性呢?我们这边分为几个步骤:打开网站.登陆.登陆验证.退出,一共4个小step,看实例. 检测流程 ...
- Zabbix监控disk performance
概述 zabbix获取/sys里面的磁盘信息并分析来监控disk performance sysfs是Linux内核中设计较新的一种虚拟的基于内存的文件系统,它的作用与 proc 有些类似(默认挂载在 ...
- Zabbix监控mysql主从复制状态
原理 mysql slave show slave status\G 在输出信息中查看I/O线程和SQL线程的状态值(YES为正常,NO为错误) Slave_IO_Running: Yes Slave ...
随机推荐
- Solr3.6.1 在Tomcat6下的环境搭建
Solr3.6.1 在Tomcat6下的环境搭建 Tomcat路径:D:\prg\apache-tomcat-6-solr 简写为tomcat_home Solr文件下载保存路径为:F:\softwa ...
- sqlserver2008存储过程(比较两个日期大小和获取当前月最大天数的存储过程)
下面简单介绍sqlserver2008两个常用的存储过程 1.比较两个日期大小的存储过程 2.获取当前月份的最大天数的存储过程 1.创建比较两个日期大小的存储过程 1)创建比较两个日期大小的存储过程 ...
- yii的入口文件index.php中为什么会有这两句
yii的应用模板中,index.php中 前面会有这两句 <?php // comment out the following two lines when deployed to produc ...
- Linux-网络连接-(VMware与CentOS)
VMware虚拟机中安装CentOS,进行网络连接,分为两步,内网连接,与外网连接. 前提: 当你正确安装VMware后,网络适配器会增加2个新的网卡:(可在设备管理器->网络适配器中查看) 第 ...
- asp.net identity 介绍
Asp.Net Identity 设计目标 微软在 asp.net 2.0 引入了 membership,为 asp.net 应用程序提供身份验证和授权功能.membership 假定用户在网站注册, ...
- Apache Lucene(全文检索引擎)—分词器
目录 返回目录:http://www.cnblogs.com/hanyinglong/p/5464604.html 本项目Demo已上传GitHub,欢迎大家fork下载学习:https://gith ...
- Struts2(3) —— 数据处理
Struts2框架框架使用OGNL语言和值栈技术实现数据的流转处理. 值栈就相当于一个容器,用来存放数据,而OGNL是一种快速查询数据的语言. 值栈:ValueStack一种数据结构,操作数据的方式为 ...
- nth-child和:nth-of-type的区别
:nth-of-type为什么要叫:nth-of-type?因为它是以"type"来区分的.也就是说:ele:nth-of-type(n)是指父元素下第n个ele元素, 而ele: ...
- 服务器重启后导致访问ArcServer地图服务须登录
问题状况: 重启服务器后,在访问网站的地图服务时会提示登录,输入各种密码账号都不好用 解决方法: 通过进入[服务管理器],找到ArcGISServer的服务,重新启动该服务就可以.
- iOS 直播-闪光灯的使用
iOS 直播-闪光灯的使用 应用场景是这样的,最近公司决定做一款直播类的软件. 在开发中就遇到了不曾使用过的硬件功能-闪光灯. 这篇博客将简单介绍一下闪光灯的使用. // // ViewControl ...