Shell Scripting Bulk Ping IP

Source: Internet
Author: User

Recently do the computer room bandwidth detection. Recently wrote a shell script to ping the IP of the machine room in bulk, returning the failure rate and the average response time

#!/bin/bashlog=$1.logecho-n "" > $logfor i in ' Cat $ do/bin/ping-s 1000-f-C $i > Ip.txtecho "' Curl ip.cn ? ip= $i ' Cat Ip.txt | grep transmitted | Gawk ' {print $6} ' cat Ip.txt | grep avg | Gawk-f/' {print $} ' >> $logdonerm-rf ip.txt

Store all IP required for detection in text file 1

Execute script SH ip.sh 1

A file is generated after executing the script: 1.log

Cat 1.log

ip:122.114.78.23 from: Zhengzhou City, Henan province, Jing an network 0% 48.073

This article is from the "Tranquility Zhiyuan" blog, please be sure to keep this source http://irow10.blog.51cto.com/2425361/1837024

Shell Scripting Bulk Ping IP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.