This article is in response to a

本文是针对

question题

here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses as input, PING each of the IP addresses in the list, and send an email via SMTP to a support group when the PING is not successful on an IP address.

在这里专家交流。 楼主(OP)需要一个实用工具,将接受IP地址作为输入的列表,PING每个在列表中的IP地址,并通过SMTP当PING不成功上的IP地址发送电子邮件到一个支持小组。

The method presented in this article requires AutoHotkey, an excellent (free!) programming/scripting language. The quick explanation for installing AutoHotkey is to visit its website and click the big blue Download button. A more comprehensive explanation is to read my EE article, AutoHotkey - Getting Started. After installation, AutoHotkey will own the AHK file type, supporting the solution discussed in the remainder of this article.

本文介绍的方法需要使用一种出色的(免费!)编程/脚本语言AutoHotkey 。 安装AutoHotkey的快速说明是访问其网站 ,然后单击蓝色的大下载按钮。 更全面的解释是阅读我的EE文章AutoHotkey-Getting Started 。 安装后,AutoHotkey将拥有AHK文件类型,支持本文其余部分讨论的解决方案。

The utility takes as input a plain text file with each IP address on a separate line, such as:

该实用程序将纯文本文件作为输入,每个IP地址在单独的行中,例如:

192.168.0.123

192.168.0.123

192.168.0.456

192.168.0.456

192.168.0.789

192.168.0.789

The utility reads the file with the list of IP addresses and PINGs each one. It redirects the output of the PING command to a text file (via the command line ">" operator). It then looks for the five most common PING errors anywhere in the PING output, namely:

该实用程序读取包含IP地址和PING列表的文件。 它将PING命令的输出重定向到文本文件(通过命令行“ > ”运算符)。 然后,它会在PING输出中的任何位置查找五个最常见的PING错误,即:

Destination Host Unreachable

目标主机不可达

Ping request could not find host

ping请求找不到主机

Request Timed Out

请求超时

TTL Expired in Transit

TTL在运输中过期

Unknown Host

未知主机

If the utility finds any of these, it sends an email via SMTP with PING Error Notification as the Subject and with an email Body that looks like this:

如果公用程序发现任何这些,它通过SMTP发送一封电子邮件,PING错误通知主体 ,与电子邮件正文 ,看起来像这样:

IP Address: 192.168.0.123

IP地址:192.168.0.123

PING output: Reply from 192.168.0.101: Destination host unreachable.

PING输出:来自192.168.0.101的回复:无法访问目标主机。

Another example of what it may look like is this:

另一个示例如下所示:

IP Address: 192.168.0.456

IP地址:192.168.0.456

PING output: Request timed out.

PING输出:请求超时。

Of course, you may modify the script to change the Subject and Body of the email as desired.

当然,您可以修改脚本以根据需要更改电子邮件的主题和正文。

The script is attached to this article as a file called PING_IP_Addresses.ahk (Important Note: I updated the article so the file attached to the article is later than the version posted in the Comments). I tested it with Gmail.com as the SMTP server (along with its required parameters), but this may be easily changed. Each of the six lines of code that needs modification (for your file names, SMTP server, and email parameters) is marked with ";***" beginning in column 60 (other lines will need to be changed if your SMTP server is not Gmail).

该脚本作为名为PING_IP_Addresses.ahk的文件附加到本文(重要说明:我更新了该文章,因此该文章附带的文件比“注释”中发布的版本晚)。 我使用Gmail.com作为SMTP服务器(及其必需的参数)对其进行了测试,但这很容易更改。 需要修改的六行代码(用于文件名,SMTP服务器和电子邮件参数)中的每一行都从第60列开始标记为“ ; *** ”(如果未使用SMTP服务器,则需要更改其他行) Gmail)。

After downloading the script and modifying it with your information, you may run it by simply double-clicking on it in Windows/File Explorer (or whatever file manager you use). Since its file type is AHK, AutoHotkey will be launched to process it. If you prefer, the file may be turned into an executable (an EXE file) via the AutoHotkey compiler, as explained in my AutoHotkey - Getting Started article.

下载脚本并用您的信息对其进行修改后,只需在Windows / File Explorer(或您使用的任何文件管理器)中双击该脚本即可运行它。 由于其文件类型为AHK,因此将启动AutoHotkey进行处理。 如果您愿意,可以通过AutoHotkey编译器将文件转换为可执行文件(EXE文件),如我的AutoHotkey-入门文章中所述。

When running the script, it displays a green progress bar in a dialog box that shows each IP address that it processes:

运行脚本时,它将在对话框中显示绿色进度条,该对话框显示了它处理的每个IP地址:

The percentage Done is based on the number of IP addresses in the list.

完成百分比基于列表中IP地址的数量。

It is important to note that PING errors other than the most common five (as documented above) will not be detected by this utility. With that caveat, I hope that the utility is useful to the OP and other EE members.

重要的是要注意,该实用程序将不会检测到除最常见的五个错误(如上所述)之外的PING错误。 有了这一警告,我希望该实用程序对OP和其他EE成员有用。

If you find this article to be helpful, please click the thumbs-up icon below. This lets me know what is valuable for EE members and provides direction for future articles. Thanks very much! Regards, Joe

如果您发现本文有帮助,请单击下面的大拇指图标。 这使我知道什么对EE成员有价值,并为以后的文章提供了指导。 非常感谢! 问候乔

PING-IP-Addresses.ahkPING-IP-Addresses.ahk

翻译自: https://www.experts-exchange.com/articles/12272/Test-IP-Addresses-with-PING.html

使用PING测试IP地址相关推荐

  1. Linux ping 测试IP地址与 telnet 测试IP端口

    文章目录 一.ping命令使用 二.telnet 端口使用 转载文章 一.ping命令使用 原文地址:https://www.cnblogs.com/FengZeng666/p/15093267.ht ...

  2. 测试连接--ping (IP地址,网址,主机名)

    目录 1.ping ip地址 2.ping网址 3.ping 主机名 我们需要使用自己的电脑ping一下ip地址,这样可以查看电脑是否与对方连接了. 1.ping ip地址 win+R键组合打开,输入 ...

  3. 阿里云服务器18个数据中心测试IP地址以及测试方法

    阿里云服务器18个数据中心测试IP地址以及测试方法 2018-09-27 分类:阿里云应用 阅读(3710) 评论(0) 我们用户在选择阿里云服务器的时候是不是感觉阿里云的数据中心太多太多,确实阿里云 ...

  4. window系统批量测试IP地址的bat脚本

    当碰到测试大量的IP地址时,一个一个去ping的工作量太大,那么使用bat脚本来实现批量测试脚本的是最佳的选择了. 使用bat脚本测试IP地址的方法: ① 将需要测试的IP地址写入 IP.txt 文件 ...

  5. 宝塔linux面板ping网址找不到主机,云服务器安装宝塔面板后无法ping通ip地址问题的解决方法...

    为什么云服务器搭建宝塔面板后,服务器ip地址就ping不通了?很多做网站的站长们,在买服务器之前都是怎么去测试IP呢,通常都是通过ping这个方式看看这个时间上,在就是去测试这个IP的节点好不好,那要 ...

  6. 阿里云服务器地域可用区选择根据测试IP地址就近原则

    阿里云服务器地域节点遍布全球,包括中国香港.中国大陆华北2(北京).华东1(杭州)及华南1(深圳).日本.美国.新加坡等海外国家和地区,服务器教程网来详细说下阿里云服务器地域和可用区测速IP及地域节点 ...

  7. 简单测试IP地址连通性

    简单测试IP地址连通性 现有两台主机PC1.PC2,两台交换机S1.S2,一台路由器R1,主机都处于不同的网段,如何让路由器和两台主机连通? 1.搭建拓扑结构图 2.对主机进行配置 同理,对另外一台主 ...

  8. 能ping通IP地址,ping不通主机名问题解决

    财务室一台新电脑要求安装用友U8,品牌机市场基本都是出厂带windows 7系统,可是财务室的U8版本不兼容,要u8v8.90之后的版本才兼容,于是购买一台联想扬天M6880N(性价比还可以),顺便说 ...

  9. 香港云服务器CN2+BGP网络线路测试IP地址

    硅云香港云服务器默认是通用BGP线路,通用BGP是指CN2+BGP多线网络,由三网直连线路(中国电信CN2 GIA直连.中国联通CU直连.中国移动CMI直连).中国电信骨干网以及HGC.NTT.PCC ...

最新文章

  1. error: index-pack died of signal fatal: index-pack failed【Git】
  2. Python下载与安装教程
  3. (20)HTML5 <summary>标签
  4. 使用mysql悲观锁解决并发问题
  5. 飞机游戏跟踪导弹的算法[C#源码]
  6. IOS 文件目录的获取与操作
  7. 软件测评:如何做软件项目验收测试报告 ?
  8. hdu3987(最小割最小边数)
  9. 记事本开发 dos下编译java 多个类文件_通过记事本编写的java代码通过()命令运行。_学小易找答案...
  10. 大一计算机课程学什么,大一新生应该如何学习 主要学什么课程
  11. 基于VUE的SVG动画处理(一)
  12. 蓝牙打印 设置打印样式_Android蓝牙打印机,带你真正了解各种打印格式
  13. 燕十八 Mysql 笔记 68 课
  14. 图案输出(二)----输出平行四边形图案:(难度系数:小于半颗星)
  15. STM32c8t6驱动激光雷达(一)
  16. 洛谷刷题C语言:距离函数、闰年展示、计算阶乘、猴子吃桃、培训
  17. Windows CE/Moblie截屏工具及实现源码
  18. python科研用哪个软件_科研画图都用什么软件?
  19. 微博和知乎中的 feed 流是如何实现的?
  20. PC购买XGP至游玩的记录-Xbox游戏不显示x下载速度慢解决

热门文章

  1. 关于数学分支与数学家的一个故事
  2. 基于SSM的创意商城动态网站【毕设-附源码】
  3. jQuery UI Autocomplete是jQuery UI的自动完成组件
  4. MicroByte蓝牙手柄初探
  5. PV操作与信号灯及例子+三大操作系统共同点的线程通信
  6. Vscode 与服务器建立远程连接(ssh)
  7. vc 键盘按键KeyValue值
  8. 海康相机RTSP连接代码分析
  9. grails Domian对象转JSON去class以及自己定义字段的最佳方式
  10. C++:乱码之字符串编码