暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

牛逼的运维,一个ping命令都玩得如此高大上!

Linux运维进阶之路 2024-10-08
288

ping命令,我相信大家都不会陌生。但是能够把ping命令完成这样的,估计又是少数了。今天浩道跟大家分享最近github上看到的一个非常牛逼的gping工具。截止目前,该项目已经收获10.5K Star,一起看看大牛运维是如何将ping命令玩得如此高大上。


 对应github地址:https://github.com/orf/gping/releases


gping是一款基于Rust编程语言开发的网络诊断与监控工具。它不仅继承了传统ping命令的功能,还通过实时图形显示的方式,提供了一种全新的网络性能追踪和可视化手段。以下是关于gping的详细介绍:

一、功能特点

1、实时图形化显示:gping使用ASCII字符绘制的图表实时更新,能够直观地展示每秒的网络延迟变化,使网络性能的变化一目了然。

2、多主机支持:该工具支持同时监测多个主机的延迟情况,每个主机的数据都有独立的颜色区分,便于用户进行比较和分析。

3、自定义颜色配置:用户可以为各个主机或命令分配特定颜色,使图表更加易读和个性化。

4、命令执行时间监控:除了ping之外,gping还可以监控自定义命令的执行时间,这在性能调优和故障排查中非常有用。

5、跨平台兼容性:gping支持Windows、MacOS和Linux等操作系统,确保了广泛的适用性。

6、灵活设置:用户可以自定义刷新间隔、图表缓冲区大小、颜色和图形模式等参数,以满足不同的监控需求。

二、安装与使用
以下我是基于欧拉系统22.03版本环境进行安装演示,大家可以自行参考。
(一)获取下载链接

(二)wget命令下载
    wget https://github.com/orf/gping/releases/download/gping-v1.17.3/gping-Linux-x86_64.tar.gz


    (三)解压运行
      tar -xzvf gping-Linux-x86_64.tar.gz -C opt/
        [root@localhost ~]# cd opt/
        [root@localhost opt]# ./gping --help
        Ping, but with a graph.


        Usage: gping [OPTIONS] [HOSTS_OR_COMMANDS]...


        Arguments:
        [HOSTS_OR_COMMANDS]... Hosts or IPs to ping, or commands to run if --cmd is provided. Can use cloud shorthands like aws:eu-west-1.


        Options:
        --cmd
        Graph the execution time for a list of commands rather than pinging hosts
        -n, --watch-interval <WATCH_INTERVAL>
        Watch interval seconds (provide partial seconds like '0.5'). Default for ping is 0.2, default for cmd is 0.5.
        -b, --buffer <BUFFER>
        Determines the number of seconds to display in the graph. [default: 30]
        -4
        Resolve ping targets to IPv4 address
        -6
        Resolve ping targets to IPv6 address
        -i, --interface <INTERFACE>
        Interface to use when pinging
        -s, --simple-graphics
        Uses dot characters instead of braille
        --vertical-margin <VERTICAL_MARGIN>
        Vertical margin around the graph (top and bottom) [default: 1]
        --horizontal-margin <HORIZONTAL_MARGIN>
        Horizontal margin around the graph (left and right) [default: 0]
        -c, --color <color>
        Assign color to a graph entry.


        This option can be defined more than once as a comma separated string, and the
        order which the colors are provided will be matched against the hosts or
        commands passed to gping.


        Hexadecimal RGB color codes are accepted in the form of '#RRGGBB' or the
        following color names: 'black', 'red', 'green', 'yellow', 'blue', 'magenta',
        'cyan', 'gray', 'dark-gray', 'light-red', 'light-green', 'light-yellow',
        'light-blue', 'light-magenta', 'light-cyan', and 'white'
        --clear
        Clear the graph from the terminal after closing the program
        -h, --help
        Print help
        -V, --version
        Print version
        [root@localhost opt]#


        运行gping命令后,看到如上打印信息,说明可以正常运行。

        (四)使用过程举例

        1、不指定协议栈的情况下,默认ping的是IPv4地址

          ./gping www.taobao.com
          2、通过指定-6参数,ping向IPv6的地址
             ./gping -6 fe80::5669:fe4b:fe25:6d6a

            3、通过指定-c参数,以指定颜色显示ping状态
              ./gping www.taobao.com -c 'red'
              4、可以同时ping几个目标地址
                 ./gping www.taobao.com -c 'red' www.baidu.com -c 'blue'

                (五)总结

                实际工作中,各种运维小工具还是挺多的。大家都可以去试一试,看看是不是逼格更高点。或者大家也可以自己开发一些属于自己的小工具。


                - EOF -


                推荐阅读  点击标题可跳转

                1、Linux系统常用小技巧大作用序列~

                2、挖矿病毒处置(Linux篇) ——从入门到放弃

                3、Ansible 批量100台服务器添加 Crontab

                4、如何在Linux中列出USB设备

                5、推荐八款Linux远程连接工具,非常实用

                6、35个常用一线运维shell脚本再整理(经典)

                7、Linux故障排查思路及常用命令(收藏)


                看完本文有收获?请分享给更多人

                推荐关注「Linux 运维进阶之路」,提升Linux技能



                ❤️点赞&在看❤️,服务器三年不宕机

                文章转载自Linux运维进阶之路,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

                评论