一、安裝依賴包node
[root@hlsms-fensheng-3 ~]# yum install ncurses* 已加載插件:fastestmirror, security 設置安裝進程 Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirror.bit.edu.cn * updates: mirror.bit.edu.cn base | 3.7 kB 00:00 dell-system-update_dependent | 2.3 kB 00:00 dell-system-update_independent | 2.3 kB 00:00 extras | 3.4 kB 00:00 mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql57-community | 2.5 kB 00:00 updates | 3.4 kB 00:00 包 ncurses-devel-5.7-4.20090207.el6.x86_64 已安裝而且是最新版本 包 ncurses-5.7-4.20090207.el6.x86_64 已安裝而且是最新版本 包 ncurses-libs-5.7-4.20090207.el6.x86_64 已安裝而且是最新版本 包 ncurses-base-5.7-4.20090207.el6.x86_64 已安裝而且是最新版本 解決依賴關係 --> 執行事務檢查 ---> Package ncurses-static.x86_64 0:5.7-4.20090207.el6 will be 安裝 ---> Package ncurses-term.x86_64 0:5.7-4.20090207.el6 will be 安裝 --> 完成依賴關係計算 依賴關係解決 ==================================================================================================================================================== 軟件包 架構 版本 倉庫 大小 ==================================================================================================================================================== 正在安裝: ncurses-static x86_64 5.7-4.20090207.el6 base 543 k ncurses-term x86_64 5.7-4.20090207.el6 base 546 k 事務概要 ==================================================================================================================================================== Install 2 Package(s) 總下載量:1.1 M Installed size: 5.1 M 肯定嗎?[y/N]:y 下載軟件包: (1/2): ncurses-static-5.7-4.20090207.el6.x86_64.rpm | 543 kB 00:00 (2/2): ncurses-term-5.7-4.20090207.el6.x86_64.rpm | 546 kB 00:00 ---------------------------------------------------------------------------------------------------------------------------------------------------- 總計 83 kB/s | 1.1 MB 00:13 運行 rpm_check_debug 執行事務測試 事務測試成功 執行事務 正在安裝 : ncurses-term-5.7-4.20090207.el6.x86_64 1/2 正在安裝 : ncurses-static-5.7-4.20090207.el6.x86_64 2/2 Verifying : ncurses-static-5.7-4.20090207.el6.x86_64 1/2 Verifying : ncurses-term-5.7-4.20090207.el6.x86_64 2/2 已安裝: ncurses-static.x86_64 0:5.7-4.20090207.el6 ncurses-term.x86_64 0:5.7-4.20090207.el6 完畢!
[root@hlsms-fensheng-3 ~]# yum install libpcap* 已加載插件:fastestmirror, security 設置安裝進程 Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirror.bit.edu.cn * updates: mirror.bit.edu.cn 包 14:libpcap-devel-1.4.0-4.20130826git2dbcaa1.el6.x86_64 已安裝而且是最新版本 包 14:libpcap-1.4.0-4.20130826git2dbcaa1.el6.x86_64 已安裝而且是最新版本 無須任何處理
二、下載源碼包mysql
[root@hlsms-fensheng-3 ~]# cd /usr/local/src/ [root@hlsms-fensheng-3 src]# wget https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz --2019-09-16 16:34:20-- https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz 正在解析主機 github.com... 52.74.223.119 正在鏈接 github.com|52.74.223.119|:443... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 302 Found 位置:https://codeload.github.com/raboof/nethogs/tar.gz/v0.8.1 [跟隨至新的 URL] --2019-09-16 16:34:26-- https://codeload.github.com/raboof/nethogs/tar.gz/v0.8.1 正在解析主機 codeload.github.com... 13.250.162.133 正在鏈接 codeload.github.com|13.250.162.133|:443... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:未指定 [application/x-gzip] 正在保存至: 「v0.8.1.tar.gz」 [ <=> ] 35,986 --.-K/s in 0.1s 2019-09-16 16:34:32 (289 KB/s) - 「v0.8.1.tar.gz」 已保存 [35986]
三、編譯git
[root@hlsms-fensheng-3 src]# tar -zxvf v0.8.1.tar.gz nethogs-0.8.1/ nethogs-0.8.1/.cproject nethogs-0.8.1/.cvsignore nethogs-0.8.1/.gitignore nethogs-0.8.1/.project nethogs-0.8.1/.travis.yml nethogs-0.8.1/COPYING nethogs-0.8.1/Changelog nethogs-0.8.1/DESIGN nethogs-0.8.1/INSTALL nethogs-0.8.1/Makefile nethogs-0.8.1/README.decpcap.txt nethogs-0.8.1/README.md nethogs-0.8.1/connection.cpp nethogs-0.8.1/connection.h nethogs-0.8.1/conninode.cpp nethogs-0.8.1/conninode.h nethogs-0.8.1/cui.cpp nethogs-0.8.1/cui.h nethogs-0.8.1/decpcap.c nethogs-0.8.1/decpcap.h nethogs-0.8.1/decpcap_test.cpp nethogs-0.8.1/devices.cpp nethogs-0.8.1/devices.h nethogs-0.8.1/inode2prog.cpp nethogs-0.8.1/inode2prog.h nethogs-0.8.1/main.cpp nethogs-0.8.1/nethogs.8 nethogs-0.8.1/nethogs.cpp nethogs-0.8.1/nethogs.h nethogs-0.8.1/packet.cpp nethogs-0.8.1/packet.h nethogs-0.8.1/process.cpp nethogs-0.8.1/process.h nethogs-0.8.1/refresh.cpp nethogs-0.8.1/refresh.h [root@hlsms-fensheng-3 src]# cd nethogs-0.8.1/ [root@hlsms-fensheng-3 nethogs-0.8.1]# make && make install g++ -Wall -Wextra -c packet.cpp g++ -Wall -Wextra -c connection.cpp g++ -Wall -Wextra -c process.cpp g++ -Wall -Wextra -c refresh.cpp cc -Wall -Wextra -c decpcap.c g++ -Wall -Wextra -c cui.cpp -DVERSION=\"0\" -DSUBVERSION=\"8\" -DMINORVERSION=\"1\" g++ -Wall -Wextra -c inode2prog.cpp g++ -Wall -Wextra -c conninode.cpp g++ -Wall -Wextra -c -o devices.o devices.cpp g++ -Wall -Wextra main.cpp packet.o connection.o process.o refresh.o decpcap.o cui.o inode2prog.o conninode.o devices.o -o nethogs -lpcap -lm -lncurses -DVERSION=\"0\" -DSUBVERSION=\"8\" -DMINORVERSION=\"1\" g++ -Wall -Wextra decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm install -d -m 755 /usr/local/sbin install -m 755 nethogs /usr/local/sbin install -d -m 755 /usr/local/share/man/man8/ install -m 644 nethogs.8 /usr/local/share/man/man8/ [root@hlsms-fensheng-3 nethogs-0.8.1]#
四、運行github
[root@hlsms-fensheng-4 nethogs-0.8.1]# nethogs em1 Waiting for first packet to arrive (see sourceforge.net bug 1019381) NetHogs version 0.8.1 PID USER PROGRAM DEV SENT RECEIVED 11647 mysql /usr/sbin/mysqld em1 11.513 0.756 KB/sec ? root 172.28.5.152:8101-172.28.5.151:39721 0.000 0.012 KB/sec ? root 172.28.5.152:46878-172.28.5.148:80 0.000 0.000 KB/sec ? root 172.28.5.152:46877-172.28.5.148:80 0.000 0.000 KB/sec ? root 172.28.5.152:46876-172.28.5.148:80 0.000 0.000 KB/se
能夠看到哪一個進程佔用帶寬sql
[root@bogon ~]# yum install nethogs 已加載插件:fastestmirror Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 epel | 5.3 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/2): epel/x86_64/updateinfo | 1.0 MB 00:00:05 (2/2): epel/x86_64/primary_db | 6.8 MB 00:00:06 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 nethogs.x86_64.0.0.8.5-1.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ============================================================================================================================================= Package 架構 版本 源 大小 ============================================================================================================================================= 正在安裝: nethogs x86_64 0.8.5-1.el7 epel 38 k 事務概要 ============================================================================================================================================= 安裝 1 軟件包 總下載量:38 k 安裝大小:71 k Is this ok [y/d/N]: y Downloading packages: nethogs-0.8.5-1.el7.x86_64.rpm | 38 kB 00:00:05 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : nethogs-0.8.5-1.el7.x86_64 1/1 驗證中 : nethogs-0.8.5-1.el7.x86_64 1/1 已安裝: nethogs.x86_64 0:0.8.5-1.el7 完畢!