实时监控服务器某个端口状态TCPing
在给客户做运维服务期间,发现了一个奇怪的现象:备份系统(第三方国产)告警日志显示,每天晚上备份服务器的客户端在3点左右离线然后上线,再离线再上线,每晚两次,很是诡异。
联系了厂家技术支持,前后花了两天时间也没给出个答案,一会让我测试网络是否连接正常,一会让我重启客户端服务试试,最终不了了之,很不专业,体验极差。
我通过长ping生成日志,发现在3点左右网络是正常的,没有出现丢包现象。
思索着既然网络没有问题,查看系统日志在3点左右没任何异常日志,就猜测是不是端口异常,如何实时监听要做备份的客户端跟备份服务器制定端口连接情况?网上搜索了很久找到了TCPing这个工具,很好用。做个记录,也分享给大家。
Windows版本下载地址:https://elifulkerson.com/projects/tcping.php
参数如下:
NAME |
翻译如下:
描述 概要 选项 -6,优先使用IPv6 -h,使用http模式 -t,让命令持续运行,直到使用ctrl + c指令退出 -n 数字,发送命令的次数,默认4次 -i 数字,发送ping命令的时间间隔,默认1s,可以为小数 -w 数字,等待响应的时间间隔,默认2s,可以为小数 -d,使输出的每一行显示时间和日期 -f,强制ping命令至少发送一个比特(byte) -g 数字,失败指定次就放弃(注意默认是80端口,若其他端口没开也算失败) -b 数字,开启蜂鸣器,参数4会一直响铃 -c,只显示改变的信息(ping时间很短一般不会改变) -r 数字,每发送指定个数据包,就重新查找主机一次(通过DNS或路由查找) -s,ping通就立即退出 -u,与-h命令连用,每一行输出目标的url -v,显示版本信息 -j,使用默认的方法,求ping的均值减小波动,网络有一定的不稳定性时,用此参数可以减小波动 -js 数字,用指定个实例求平均值减小波动,使用这个参数,系统会tcping 指定次,然后求出平均值作为一次结果显示,减小波动 –tee file_path,将结果输出到指定位置,tcping –tee /data/test.txt192.168.0.100,会把ping的结果保存在/data下的test文件中 –file,从文件中获得ping的来源;在/data下新建一个test.txt文件,并输入要tcping的所有ip或域名,一行一个,然后执行命令tcping –file /data/test.txt,就会依次tcping文件中指定的地址 destination,可以是DNS地址、IP地址、URL(需要使用-h,http模式)。使用http模式时,不要加https//或:port,例如:tcping http://www.elifulkerson.com:8080/index.html就会失败,使用tcping www.elifulkerson.com/index.html 8080就会成功 port 数字,指定tcp端口(1-65535),如果不指定,默认是80 –header,在头部显示时间和日期,与–tee显示的格式差不多 –block,tcping不通的等待时间,默认是20秒(很长)。–block可以把-w参数冲突掉 ,例如tcping --block www.baiu.com网址不正确,显然tcpping不通,默认会等待20s 。 tcping -w 0.5 –block www.baiu.com还是会等20s,而不是0.5s,因为–block选项会把-w选项冲突掉。 HTTP模式选项 –head,在http模式中,使用head方法 –get Shorthand to invoke “http” mode for consistency’s sake. –proxy-server,指定代理服务 –proxy-port,指定代理服务端口 –proxy-credentials username:password,使用代理的安全验证,需要输入用户名和密码 返回值 测试:tcping 200.209.200.15 21 |
我主要用的功能是长ping和输出存档:tcping.exe -t -d --tee d:/tcpping.log 192.168.**.** 9952
自动保存到D盘目录。
实时监控服务器某个端口状态TCPing的更多相关文章
- zabbix自定义脚本监控服务器端口状态
zabbix可以通过客户端的[net.tcp.port[<ip>,port]]该item监控项来判断本地/远程服务器TCP端口是否正常,不过当时没有想起来,就用了自定义脚本去写的,很久没有 ...
- 【转载】CentsOS系统inotify实时监控服务器文件(夹)定制事件处理程序
原始博文和参考博文 1.CentsOS系统inotify实时监控服务器文件 2.Linux中让进程在后台运行的方法 3.linux inotify 监控文件系统事件 非常好 方法一 说明: 服务器系统 ...
- Zabbix如何实现批量监控端口状态
引言 ------------------------------------------------------------------------------------------------- ...
- shell脚本监控httpd服务80端口状态
监控httpd服务端口状态,根据端口判断服务器是否启动,如果没有启动则脚本自动拉起服务,如果服务正在运行则退出脚本程序:如果换成别的服务端口也可以,但是脚本程序需要做调整. #!/bin/bash # ...
- 案例六:shell脚本监控httpd服务80端口状态
这里是举例监控httpd服务端口状态,根据端口判断服务器是否启动,如果没有启动则脚本自动拉起服务,如果服务正在运行则退出脚本程序:如果换成别的服务端口也可以,但是脚本程序需要做调整. #!/bin/b ...
- 交换机的端口状态是UP,但是查询该端口下的MAC地址为空
(电脑已关机)电脑与交换机直连的端口状态 还是 UP ,但是 查询该端口下的 MAC地址为空. 初步怀疑原因: Wake-on-LAN(电脑关机,网卡还在工作) Wake-On-LAN简称WOL,是一 ...
- nmap端口状态解析
nmap端口状态解析 状态 说明 open 应用程序在该端口接收 TCP 连接或者 UDP 报文 closed 关闭的端口对于nmap也是可访问的, 它接收nmap探测报文并作出响应.但没有应用程序在 ...
- 在Linux下用netstat查看网络状态、端口状态
在Linux下用netstat查看网络状态.端口状态 在linux一般使用netstat 来查看系统端口使用情况步. netstat命令是一个监控TCP/IP网络的非常有用的工具,它可以显示路由表.实 ...
- PIC16SCM设置不同IO功耗端口状态的影响
最近做的PIC低功耗微控制器,因此,要设置不同的IO端口状态有关电源的情况测试,在系列万用表的方法来测量电流,供应链管理IO港是在地狱,无头整个系统驱动器.的是PIC16F690单片机. 思路例如以下 ...
随机推荐
- 开源分布式中间件 DBLE 快速入门指南
GitHub:https://github.com/actiontech/dble 官方中文文档:https://actiontech.github.io/dble-docs-cn/ 一.环境准备 D ...
- Codevs 2492 上帝造题的七分钟 2(线段树)
时间限制: 1 s 空间限制: 64000 KB 题目等级 : 大师 Master 题目描述 Description XLk觉得<上帝造题的七分钟>不太过瘾,于是有了第二部. " ...
- linux mysql5.7设置中文字符集
ubuntu16.04已测试 注意版本,好像从5.6根5.5就不一样,配置文件更深了一层. 1.用vim或nano编辑 /etc/mysql/mysql.conf.d/mysqld.cnf 2.[ ...
- 内存管理2-set方法的内存管理
1.对象之间的内存管理: 每个学生都有一本书 book类 @price 学生类 @age @book -------------------- #import "book.h" ...
- C++ new 和 delete
l new操作符(new operator) string *ps = new string(“Memory Management”); 这里的new是由语言内建的,我们成为new关键字.new操作符 ...
- c标签forEach
<c:forEach items="${requestScope.getUserMenuModelList}" var="item" varStatus= ...
- tmux 入门踩坑记录
软件安装 sudo apt-get install tmux 1. 分割左右窗口 ^b -> % 运行 tmux 新建一个 tmux 的会话(session),此时窗口唯一的变化是在底部会出现一 ...
- 安装vue模板时,选择webpack-simple还是Webpack?
选用模板常用的是webpack与webpack-simple.webpack-simple是基于Webpack@2.1.0-beta.25进行配置的版本,而webpack模板则是基于Webpack ^ ...
- cookie和session的区别及其原理
1.为什么要有cookie/session? HTTP是一种无状态的协议,为了分辨链接是谁发起的,需自己去解决这个问题.不然有些情况下即使是同一个网站每打开一个页面也都要登录一下.而Session和C ...
- SQL-W3School-高级:SQL ALIAS(别名)
ylbtech-SQL-W3School-高级:SQL ALIAS(别名) 1.返回顶部 1. 通过使用 SQL,可以为列名称和表名称指定别名(Alias). SQL Alias 表的 SQL Ali ...