5 监控TCP的11种状态、

摘要:
1、如何监控12种状态假如:有人给服务器发ddos攻击,tcp什么状态会特别多这个值比较大的时候监控所以需要监控tcp状态1、12种状态查看[root@linux-node1~]#netstat-ant状态查看12种状态[root@linux-node1~]#mannetstatStateThestateofthesocket.Sincetherearenostatesinrawmodeandus

1、如何监控12种状态

假如:有人给服务器发ddos攻击,tcp什么状态会特别多

5 监控TCP的11种状态、第1张

这个值比较大的时候监控

所以需要监控tcp状态

1、12种状态查看

[root@linux-node1 ~]# netstat -ant

5 监控TCP的11种状态、第2张

状态查看 12种状态

[root@linux-node1 ~]# man netstat

   State
       The state of the socket. Since there are no states in raw mode and usually no states used inUDP and
       UDPLite, this column may be left blank. Normally thiscan be one of several values:

       ESTABLISHED
              The socket has an established connection.

       SYN_SENT
              The socket isactively attempting to establish a connection.

       SYN_RECV
              A connection request has been received fromthe network.

       FIN_WAIT1
              The socket is closed, and the connection isshutting down.

       FIN_WAIT2
              Connection is closed, and the socket is waiting for a shutdown fromthe remote end.

       TIME_WAIT
              The socket is waiting after close to handle packets still inthe network.

       CLOSE  The socket isnot being used.

       CLOSE_WAIT
              The remote end has shut down, waiting forthe socket to close.

       LAST_ACK
              The remote end has shut down, and the socket is closed. Waiting foracknowledgement.

       LISTEN The socket is listening for incoming connections.  Such sockets are not included in the  out‐
              put unless you specify the --listening (-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.

查看tcp状态的次数

[root@linux-node1 ~]# netstat -ant |grep -c UNKNOWN
0[root@linux-node1 ~]# netstat -ant |grep -c LISTEN
12

2、命令行,配置

参考mysql的配置

[root@linux-node2 ~]# cd /etc/zabbix/zabbix_agentd.d/[root@linux-node2 /etc/zabbix/zabbix_agentd.d]# tail -1userparameter_mysql.conf 
UserParameter=mysql.version,mysql -V

Conf文件

[root@linux-node2 /etc/zabbix/zabbix_agentd.d]# vim TCP_Status.conf
[root@linux-node2 /etc/zabbix/zabbix_agentd.d]# cat TCP_Status.conf
UserParameter=TCP_Status[*],netstat -ant |grep -c $1

重启agent

[root@linux-node2 /etc/zabbix/zabbix_agentd.d]# systemctl restart zabbix-agent

zabbixServer上Test

[root@linux-node1 /etc/zabbix/zabbix_agentd.d]# zabbix_get -s 192.168.194.132 -k TCP_Status[TIME_WAIT]
4[root@linux-node1 /etc/zabbix/zabbix_agentd.d]# zabbix_get -s 192.168.194.132 -k TCP_Status[LISTEN]
7# 不存在为0
[root@linux-node1 /etc/zabbix/zabbix_agentd.d]# zabbix_get -s 192.168.194.132 -k TCP_Status[fdafas]
0

有时候zabbix执行,没有权限

方法1 Sudo 方法2 suid

2、zabbix界面添加

1、自定义模板

5 监控TCP的11种状态、第3张

5 监控TCP的11种状态、第4张

2、创建item

5 监控TCP的11种状态、第5张

5 监控TCP的11种状态、第6张

其他的直接clone这个

4个状态

5 监控TCP的11种状态、第7张

3、创建主机

5 监控TCP的11种状态、第8张

5 监控TCP的11种状态、第9张

5 监控TCP的11种状态、第10张

5 监控TCP的11种状态、第11张

4、最新数据

刷新下

[root@linux-node1 /etc/zabbix/zabbix_agentd.d]# zabbix_server -R config_cache_reload
zabbix_server [71979]: command sent successfully

5 监控TCP的11种状态、第12张

5 监控TCP的11种状态、第13张

免责声明:文章转载自《5 监控TCP的11种状态、》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇MySQL在linux上的rpm包方式安装方法转 Android智能手机上捕获数据包下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

kvm虚拟机磁盘文件读取小结

kvm虚拟机磁盘挂载还真不是一帆风顺的。xen虚拟化默认就raw格式的磁盘,可以直接挂载,kvm如果采用raw也可以直接挂载,与xen磁盘挂载方式一致。 本文出自:http://koumm.blog.51cto.com 1.kvm虚拟化相比xen虚拟化来说,工具与方法众多,本文列举思路如下: (1)raw格式的磁盘可以直接挂载,可以将qcow2磁盘转换成r...

linux命令--ldconfig和ldd用法

一、ldconfig ldconfig是一个动态链接库管理命令,为了让动态链接库为系统所共享,还需运行动态链接库的管理命令--ldconfig。 ldconfig 命令的用途,主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态 链接库(格式如前介绍,lib*.so*),进而创...

linux 服务器配置 ASF 云挂卡

关于社区打不开:https://github.com/zyfworks/AnotherSteamCommunityFix 下载asf:https://github.com/JustArchi/ArchiSteamFarm/releases 依赖包: ubuntu: sudo apt-get install libunwind8 libunwind8-dev...

青蛙学Linux—进程管理

进程,Process,是一个具有一定独立功能的程序关于某个数据集合的一次运行活动。它是操作系统动态执行的基本单元,在传统的操作系统中,进程既是基本的分配单元,也是基本的执行单元。 进程的概念主要有两点:第一,进程是一个实体。每一个进程都有它自己的地址空间,一般情况下,包括文本区域(text region)、数据区域(data region)和堆栈(stac...

谈谈网络协议 – 传输层( Transport)

传输层( Transport) 传输层有2个协议 TCP(Transmission Control Protocol),传输控制协议 UDP(User Datagram Protocol),用户数据报协议 UDP - 用户数据报协议 UDP - 首部数据格式 UDP是无连接的,减少了建立和释放连接的开销 UDP尽最大能力交付,不保证可靠交付 因...

禅道从windows迁移到linux

一、禅道数据库备份 1.1、在Windows下安装的禅道备份数据库 很多人觉得无从下手,甚至数据库账号密码都不知道怎么办,我的是在windows server 2008上安装的禅道,在安装目录下比如我的是C:UsersAdministratorDownloadsxamppzentaoconfigmy.php下有mysql的信息,端口账号密码是不是一下子就有...