Zabbix监控TCP status
监控原理
ss -ant | awk 'NR>1 {++s[$1]} END {for(k in s) print k,s[k]}'
LAST-ACK 5
ESTAB 348
FIN-WAIT-1 11
CLOSING 1
FIN-WAIT-2 41
TIME-WAIT 2447
LISTEN 8
状态值的解释
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.
CLOSED: 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.
CLOSING: Both sockets are shut down but we still don’t have all our data sent.
监控脚本
#!/bin/bash
# // pdd
# 未出现的状态值取0 status() {
ss -ant | awk 'NR>1 {++s[$1]} END {for(k in s) print k,s[k]}'
} case $ in
LISTEN)
listen=`status | grep "$1" | awk '{print $2}'`
[ -z "$listen" ] && echo || echo "$listen"
;;
SYN-SENT)
syn_sent=`status | grep "$1" | awk '{print $2}'`
[ -z "$syn_sent" ] && echo || echo "$syn_sent"
;;
SYN-RCVD)
syn_rcvd=`status | grep "$1" | awk '{print $2}'`
[ -z "$syn_rcvd" ] && echo || echo "$syn_rcvd"
;;
ESTAB)
estab=`status | grep "$1" | awk '{print $2}'`
[ -z "$estab" ] && echo || echo "$estab"
;;
FIN-WAIT-)
fin_wait_1=`status | grep "$1" | awk '{print $2}'`
[ -z "$fin_wait_1" ] && echo || echo "$fin_wait_1"
;;
CLOSE-WAIT)
close_wait=`status | grep "$1" | awk '{print $2}'`
[ -z "$close_wait" ] && echo || echo "$close_wait"
;;
FIN-WAIT-)
fin_wait_2=`status | grep "$1" | awk '{print $2}'`
[ -z "$fin_wait_2" ] && echo || echo "$fin_wait_2"
;;
LAST-ACK)
last_ack=`status | grep "$1" | awk '{print $2}'`
[ -z "$last_ack" ] && echo || echo "$last_ack"
;;
TIME-WAIT)
time_wait=`status | grep "$1" | awk '{print $2}'`
[ -z "$time_wait" ] && echo || echo "$time_wait"
;;
CLOSED)
closed=`status | grep "$1" | awk '{print $2}'`
[ -z "$closed" ] && echo || echo "$closed"
;;
*)
echo "Usage: LISTEN SYN-SENT SYN-RCVD ESTAB FIN-WAIT-1 CLOSE-WAIT FIN-WAIT-2 LAST-ACK TIME-WAIT CLOSED"
;;
esac
添加配置文件
userparameter_tcp.conf # 需要reload zabbix_agentd
# TCP
UserParameter=tcp.status[*],/usr/local/zabbix/scripts/tcp-status.sh $
添加监控模板

Zabbix监控TCP status的更多相关文章
- Zabbix监控nginx-rtmp status(json版)
与前面的文章 zabbix监控nginx-rtmp status(html版)区别只在于取值的页面不一样 http://127.0.0.1:81/control/get/all_streams sta ...
- zabbix监控tcp状态
Tcp的连接状态对于我们web服务器来说是至关重要的,从TCP的连接状态中可以看出网络的连接情况,服务器的压力情况,对服务器的并发有很好的直观反映:尤其是并发量ESTAB:或者是syn_recv值,假 ...
- zabbix监控tcp连接数的脚本!!
#!/bin/bash #this script is used to get tcp and udp connetion status #tcp status metric=$ tmp_file=/ ...
- zabbix监控tcp连接并发数
第一步,想在zabbix的web监控tcp连接数,那么要看zabbix-server的版本和zabbix-agent版本是否一致,不然TCP-status图没有数据 也会报错.下图就是版本不符合报错的 ...
- ZABBIX监控TCP连接状态
一.获取监控数据 # /bin/netstat -an|awk '/^tcp/{++S[$NF]}END{for(a in S) print a,S[a]}' LISTEN ESTABLISHED T ...
- zabbix 监控TCP状态连接数
1.zabbix客户端,监控TCP状态脚本,并保存到的定路径.(/usr/local/zabbix-agent/shells) # cat zabbix_linux_plugin.sh #!/bin/ ...
- Zabbix监控redis status
概述 zabbix采用Trapper方式监控redis status 原理 redis-cli info命令得到redis服务器的统计信息,脚本对信息分两部分处理: (1)# Keyspace部分为Z ...
- Zabbix监控php-fpm status
开启php-fpm status php-fpm.conf pm.status_path = /statusx45 nginx.conf location ~ /(statusx45)$ { incl ...
- Zabbix监控nginx status
nginx开启status ./configure --with-http_stub_status_module nginx.conflocation /statusx35 { stub_status ...
随机推荐
- Maven– HelloWorld实例
Maven– HelloWorld实例 maven安装好后,可以通过HelloWorld项目来体验一下maven是如何构建项目的.Maven项目的核心是pom.xml(就像Ant的build.xml一 ...
- telnet到RedHat Linux失败--解决办法
失败原因: 1.telnet包未安装,检查telnet包是否安装: [root@vm-rhel root]# rpm -qa telnet telnet-0.17-25 表示已安装 2.telnet包 ...
- GBDT XGBOOST的区别与联系
Xgboost是GB算法的高效实现,xgboost中的基学习器除了可以是CART(gbtree)也可以是线性分类器(gblinear). 传统GBDT以CART作为基分类器,xgboost还支持线性分 ...
- SpringData_JpaRepository接口
该接口提供了JPA的相关功能 List<T> findAll(); //查找所有实体 List<T> findAll(Sort sort); //排序.查找所有实体 List& ...
- #C++初学记录
输入与输出,头文件. #include<iostream> #include<algorithm> using namespace std; int main() { char ...
- Bootstrap fileinput v2.0(ssm版)
前言bootstrap fileinput是一个很好的文件上传插件.但是官方不出api,这就尴尬了.百度一下,每个人写法都不相同,好多代码本身都是错的.我修改后才能跑起来.综上所述:所以今天我摸索了一 ...
- BZOJ:3832: [Poi2014]Rally
题意: 给出$DAG$,询问删掉哪个点之后最长路径最短 思路: 我们令$f[x]$表示从最远的点到达它的距离,$g[x]$表示它能够到达最远的点的距离 那么对于$(x -> y)$一条边来说,它 ...
- Python3.x的BeautifulSoup解析html常用函数
Python3.x的BeautifulSoup解析html常用函数 1,初始化: soup = BeautifulSoup(html) # html为html源代码字符串,type(html) == ...
- 关于Conversion to Dalvik format failed with error 1错误
在用Android导入一个新项目时,不知道为啥就碰上这个错误.在网上搜了半天,发现各种办法都有,但是最后居然是:将一个项目下的文件夹libs作为了source folder,而又在Proporties ...
- pix2pix-tensorflow搭建及其使用
目录 pix2pix-tensorflow搭建过程 1. 环境搭建 2. 环境说明 3. 开始搭建 4. 训练结果说明 5. 数据集 5.1 图片格式说明 5.3 从先用图片创建图像对 5.4 如何进 ...