• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >Android > zabbix 应用系列之nginx tcp stream监控

zabbix 应用系列之nginx tcp stream监控

作者:网友 字体:[增加 减小] 来源:互联网 时间:2017-05-26

网友通过本文主要向大家介绍了zabbix监控nginx,zabbix nginx,nginx php zabbix,zabbix监控nginx服务,zabbix监控nginx日志等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

zabbix 应用系列之nginx tcp stream监控


zabbix 应用系列之nginx tcp stream监控

1、实现思路

  • 原生支持

  • 通过分析日志获取

  • 通过分析网络获取

2、原生支持和日志分析情况nginx自身对监控的支持

  • nginx提供status模块,目前只可以获取http相关信息,而tcp和udp相关的状态信息在当前稳定版本1.10.3暂未实现
  • 日志记录在稳定版本也未实现,经过查阅nginx文档发现后续版本会提供支持:[The ngx_stream_log_module module (1.11.4) writes session logs in the specified format.]http://nginx.org/en/docs/stream/ngx_stream_log_module.html

3、分析网络来监控

  • nentstat 工具中关于连接状态介绍
State       The state of the socket. Since there are no states in raw mode and usu‐       ally no states used in UDP and UDPLite, this column may be left  blank.       Normally this can be one of several values:       ESTABLISHED              The socket has an established connection.       SYN_SENT              The socket is actively attempting to establish a connection.       SYN_RECV              A connection request has been received from the network.       FIN_WAIT1              The socket is closed, and the connection is shutting down.       FIN_WAIT2              Connection  is  closed, and the socket is waiting for a shutdown              from the remote end.       TIME_WAIT              The socket is waiting after close to handle packets still in the              network.       CLOSE  The socket is not being used.       CLOSE_WAIT              The remote end has shut down, waiting for the socket to close.       LAST_ACK              The  remote end has shut down, and the socket is closed. Waiting              for acknowledgement.       LISTEN The socket is listening for incoming connections.  Such  sockets              are  not included in the output unless you specify the --listen‐              ing (-l) or --all (-a) option.       CLOSING              Both sockets are shut down but we still don't have all our  data              sent.       UNKNOWN              The state of the socket is unknown. 
  • centos7 中替代netstat的网络工具ss中连接状态的介绍[ss STATE-FILTER]https://www.systutorials.com/docs/linux/man/8-ss/
STATE-FILTER allows to construct arbitrary set of states to match. Its syntax is sequence of keywords state and exclude followed by identifier of state.Available identifiers are:All standard TCP states: established, syn-sent, syn-recv, fin-wait-1, fin-wait-2, time-wait, closed, close-wait, last-ack, listen and closing.all - for all the statesconnected - all the states except for listen and closedsynchronized - all the connected states except for syn-sentbucket - states, which are maintained as minisockets, i.e. time-wait and syn-recvbig - opposite to bucket
  • ss 运行内容示例
State      Recv-Q Send-Q      Local Address:Port          Peer Address:PortFIN-WAIT-1 0      1               10.0.1.11:59001         117.61.1.199:20060ESTAB      0      0               10.0.1.11:http          117.61.3.172:38306ESTAB      0      0               10.0.1.11:http        117.61.129.104:15315

4、脚本

#!/bin/sh# nginx tcp stream  stats# default two ports 59001 & 59002# c: client to nginx# s: nginx to backend serverfunction c59001 {  ss -t -o state all '( sport = :59001 )' |tail -n +2 |wc -l}function s59001 {  ss -t -o state all '( dport = :59001 )' |tail -n +2 |wc -l}function c59003 {  ss -t -o state all '( sport = :59003 )' |tail -n +2 |wc -l}function s59003 {  ss -t -o state all '( dport = :59003 )' |tail -n +2 |wc -l}function client {  ss -t -o state all '( sport = :http or sport = :https or sport = :59001 or sport = :59003 )' |tail -n +2 |wc -l}function server {  ss -t -o state all |tail -n +2|awk '{print $5}' |grep ^10.0 |wc -l}function all {  client  server}# Run the requested function$1
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • zabbix 应用系列之nginx tcp stream监控

相关文章

  • 2017-05-26Android5.0新特性-Material Design
  • 2017-05-26硅谷新闻2--禁止viewpager预加载,2--viewpager
  • 2017-07-22Android设备上获取照片、裁剪图片、压缩图片
  • 2017-05-26mmap实现分析
  • 2017-05-26Android中button点击后字体的变色效果,androidbutton
  • 2017-05-26Android疑难杂症之Theme,android疑难杂症
  • 2017-05-26Android中手机录屏并转换GIF的两种方式,android录屏
  • 2017-05-26Android刷机教程之LG Nexus 5X线刷官方Nexus系列教程,androidnexus
  • 2017-05-26谷歌IAP:skusBundle array associated with key ITEM_ID_LIST cannot contain more than 20 items.,jsarraycontain
  • 2017-05-26udp connect 总结

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • Android开发艺术探索学习笔记(十一),android艺术探索
    • BaseAdapter的使用(笔记)
    • Kotlin的数据类:节省很多行代码(KAD 10),kotlin很多行
    • Android开发学习-view,android开发-view
    • Android天天数钱游戏项目源码,android项目源码
    • ListView的CheckBox实现全部选中/不选中,listviewcheckbox
    • Android性能优化的浅谈,android性能优化
    • Setting 之dashboard 点击跳转流程,settingdashboard
    • ViewHolder模式超简洁写法,viewholder模式写法
    • 自定义水平进度条样式:黑色虚线,进度条虚线

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有