[Linux] λ€νΈμν¬ νΈλν½ λͺ¨λν°λ§ vnstat μ€μΉ
- -
리λ μ€ λ€νΈμν¬ νΈλν½ λͺ¨λν°λ§ vnstat μ€μΉ
μ½μμμ λͺ λ Ήμ΄λ‘ νΈλν½μ νμΈν΄ λ³Ό μ μλ λ°λͺ¬μ΄λ€.
μΉλΈλΌμ°μ μμ λͺ¨λν°λ§μ vnstat_php_frontend λ μ€μΉνμ¬μΌ νλ€. ( Webalizer λ³΄λ€ νΈλν½ λΆμμ΄ μ’μ )
CentOS 7.x μμ ν μ€νΈ λμλ€.
vnstat μ€μΉ
yum -y install vnstat
vnstat μμ λ° λΆν λ°λͺ¬ λ±λ‘
[root@conoha ~]# systemctl start vnstat
[root@conoha ~]# systemctl enable vnstat
Created symlink from /etc/systemd/system/multi-user.target.wants/vnstat.service to /usr/lib/systemd/system/vnstat.service.
Top 10 보기
[root@conoha ~]# vnstat -t
eth0 / top 10
# day rx | tx | total | avg. rate
-----------------------------+-------------+-------------+---------------
1 01/13/14 2.38 GiB | 86.84 GiB | 89.21 GiB | 8.66 Mbit/s
2 01/06/14 2.43 GiB | 83.68 GiB | 86.11 GiB | 8.36 Mbit/s
3 01/20/14 2.01 GiB | 83.78 GiB | 85.79 GiB | 8.33 Mbit/s
4 11/18/13 2.42 GiB | 82.10 GiB | 84.53 GiB | 8.21 Mbit/s
5 12/16/13 2.11 GiB | 79.59 GiB | 81.70 GiB | 7.93 Mbit/s
6 02/03/14 1.96 GiB | 79.50 GiB | 81.45 GiB | 7.91 Mbit/s
7 03/17/14 1.91 GiB | 79.43 GiB | 81.34 GiB | 7.90 Mbit/s
8 11/11/13 2.81 GiB | 77.92 GiB | 80.72 GiB | 7.84 Mbit/s
9 03/23/15 1.84 GiB | 78.39 GiB | 80.24 GiB | 7.79 Mbit/s
10 01/08/14 2.04 GiB | 78.16 GiB | 80.20 GiB | 7.79 Mbit/s
-----------------------------+-------------+-------------+---------------
μλ³ λ³΄κΈ°
[root@conoha ~]# vnstat -m
eth0 / monthly
month rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
Jun '15 35.01 GiB | 1.13 TiB | 1.16 TiB | 3.85 Mbit/s
Jul '15 30.77 GiB | 1.04 TiB | 1.07 TiB | 3.42 Mbit/s
Aug '15 35.19 GiB | 980.86 GiB | 0.99 TiB | 3.18 Mbit/s
Sep '15 32.17 GiB | 868.54 GiB | 900.71 GiB | 2.92 Mbit/s
Oct '15 35.44 GiB | 916.26 GiB | 951.70 GiB | 2.98 Mbit/s
Nov '15 28.02 GiB | 749.36 GiB | 777.38 GiB | 2.52 Mbit/s
Dec '15 25.14 GiB | 635.72 GiB | 660.86 GiB | 2.07 Mbit/s
Jan '16 23.27 GiB | 603.81 GiB | 627.08 GiB | 1.96 Mbit/s
Feb '16 20.01 GiB | 534.52 GiB | 554.52 GiB | 1.86 Mbit/s
Mar '16 27.19 GiB | 584.04 GiB | 611.23 GiB | 1.91 Mbit/s
Apr '16 24.49 GiB | 526.96 GiB | 551.45 GiB | 1.78 Mbit/s
May '16 16.67 GiB | 378.93 GiB | 395.60 GiB | 1.55 Mbit/s
------------------------+-------------+-------------+---------------
estimated 20.91 GiB | 475.28 GiB | 496.19 GiB |
μ£Όλ³ λ³΄κΈ°
[root@conoha ~]# vnstat -w
eth0 / weekly
rx | tx | total | avg. rate
---------------------------+-------------+-------------+---------------
last 7 days 4.74 GiB | 105.96 GiB | 110.70 GiB | 1.60 Mbit/s
last week 4.71 GiB | 104.95 GiB | 109.66 GiB | 1.52 Mbit/s
current week 2.19 GiB | 47.10 GiB | 49.29 GiB | 1.76 Mbit/s
---------------------------+-------------+-------------+---------------
estimated 5.67 GiB | 121.72 GiB | 127.39 GiB |
μΌλ³ 보기
[root@conoha ~]# vnstat -d
eth0 / daily
day rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
04/26/16 862.14 MiB | 17.65 GiB | 18.49 GiB | 1.80 Mbit/s
04/27/16 789.06 MiB | 17.62 GiB | 18.39 GiB | 1.79 Mbit/s
04/28/16 970.95 MiB | 19.62 GiB | 20.57 GiB | 2.00 Mbit/s
04/29/16 1.15 GiB | 19.08 GiB | 20.23 GiB | 1.96 Mbit/s
04/30/16 665.59 MiB | 15.47 GiB | 16.12 GiB | 1.57 Mbit/s
05/01/16 470.69 MiB | 14.09 GiB | 14.55 GiB | 1.41 Mbit/s
05/02/16 728.59 MiB | 15.05 GiB | 15.76 GiB | 1.53 Mbit/s
05/03/16 793.13 MiB | 15.93 GiB | 16.71 GiB | 1.62 Mbit/s
05/04/16 823.53 MiB | 17.46 GiB | 18.26 GiB | 1.77 Mbit/s
05/05/16 402.19 MiB | 12.88 GiB | 13.27 GiB | 1.29 Mbit/s
05/06/16 580.29 MiB | 14.52 GiB | 15.09 GiB | 1.47 Mbit/s
05/07/16 395.45 MiB | 12.91 GiB | 13.30 GiB | 1.29 Mbit/s
05/08/16 386.30 MiB | 12.62 GiB | 13.00 GiB | 1.26 Mbit/s
05/09/16 926.07 MiB | 17.93 GiB | 18.84 GiB | 1.83 Mbit/s
05/10/16 864.42 MiB | 18.21 GiB | 19.05 GiB | 1.85 Mbit/s
05/11/16 976.42 MiB | 16.52 GiB | 17.47 GiB | 1.70 Mbit/s
05/12/16 876.79 MiB | 16.29 GiB | 17.14 GiB | 1.66 Mbit/s
05/13/16 911.00 MiB | 16.86 GiB | 17.75 GiB | 1.72 Mbit/s
05/14/16 397.09 MiB | 12.20 GiB | 12.58 GiB | 1.22 Mbit/s
05/15/16 467.59 MiB | 13.42 GiB | 13.88 GiB | 1.35 Mbit/s
05/16/16 766.32 MiB | 16.33 GiB | 17.07 GiB | 1.66 Mbit/s
05/17/16 804.50 MiB | 14.71 GiB | 15.49 GiB | 1.50 Mbit/s
05/18/16 644.90 MiB | 15.05 GiB | 15.68 GiB | 1.52 Mbit/s
05/19/16 998.73 MiB | 15.49 GiB | 16.47 GiB | 1.60 Mbit/s
05/20/16 737.70 MiB | 15.53 GiB | 16.25 GiB | 1.58 Mbit/s
05/21/16 438.38 MiB | 14.30 GiB | 14.73 GiB | 1.43 Mbit/s
05/22/16 435.13 MiB | 13.55 GiB | 13.97 GiB | 1.36 Mbit/s
05/23/16 849.21 MiB | 16.11 GiB | 16.94 GiB | 1.64 Mbit/s
05/24/16 892.03 MiB | 18.80 GiB | 19.67 GiB | 1.91 Mbit/s
05/25/16 503.95 MiB | 12.19 GiB | 12.68 GiB | 1.72 Mbit/s
------------------------+-------------+-------------+---------------
estimated 703 MiB | 17.03 GiB | 17.72 GiB |
μκ°λ³ 보기
[root@conoha ~]# vnstat -h
eth0 17:10
^ t
| t
| t
| t
| t
| t
| t t t
| t t t t t t t
| t t t t t t t t t t t t t t t
| t t t t t t t t t t t t t t t t t t t t t t t
-+--------------------------------------------------------------------------->
| 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17
h rx (KiB) tx (KiB) h rx (KiB) tx (KiB) h rx (KiB) tx (KiB)
18 30149 737631 02 16910 495675 10 28690 735393
19 19602 490800 03 55951 2665686 11 23858 621353
20 18931 630324 04 12392 449728 12 33190 856515
21 33945 1118384 05 12928 358430 13 52776 1130989
22 34773 1064222 06 14546 403971 14 84248 864656
23 94213 995095 07 17050 481698 15 27708 516365
00 28808 744898 08 25482 589208 16 28374 450383
01 19283 614499 09 29579 704719 17 4268 92914
μ€μκ° λ³΄κΈ°
[root@conoha ~]# vnstat -l
Monitoring eth0... (press CTRL-C to stop)
rx: 72 kbit/s 99 p/s tx: 920 kbit/s 105 p/s^C
eth0 / traffic statistics
rx | tx
--------------------------------------+------------------
bytes 305 KiB | 6.36 MiB
--------------------------------------+------------------
max 344 kbit/s | 5.76 Mbit/s
average 87.14 kbit/s | 1.86 Mbit/s
min 28 kbit/s | 768 kbit/s
--------------------------------------+------------------
packets 3695 | 5259
--------------------------------------+------------------
max 445 p/s | 659 p/s
average 131 p/s | 187 p/s
min 53 p/s | 78 p/s
--------------------------------------+------------------
time 28 seconds
μ€μκ° λ³΄κΈ°λ κ³μ 체ν¬νλ€κ° Ctrl + C λ₯Ό λλ₯΄λ©΄ κ·Έλμμ νΈλν½μ 보μ¬μ€λ€.
μ΄λ²μλ μΉμμ νμΈμ΄ κ°λ₯ν vnstat_php_frontend λ₯Ό μ€μΉν΄λ³΄μ.
μ€μΉλ wget μΌλ‘ λ°μμ μμΆνκ³ μνμΉ ν΄λμ λ£μ΄μ£Όλ©΄ λλ€.
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
tar zxvf vnstat_php_frontend-1.5.1.tar.gz
mv vnstat_php_frontend-1.5.1 /var/www/html/vnstat
chown -R apache.apache /var/www/html/vnstat
κ·Έλ¦¬κ³ /var/www/html/vnstat/config.php νκ²½μ€μ νμΌμ μλ μ²λΌ μμ ν΄μ£Όμ.
//$language = 'nl';
$language = 'en';
//$iface_list = array('eth0', 'sixxs');
$iface_list = array('eth0');
//$graph_format='svg';
$graph_format='png';
μνμΉ μ¬μμ
# systemctl restart httpd.service
μ΄μ μΉλΈλΌμ°μ λ‘ νμΈμ νλ©΄ λλ€. ( λλ©μΈμ£Όμ λ€μ /vnstat μ λΆμ΄λ©΄ λλ μμ μ μνμΉ μ€μ μ λ°λ₯΄λ©΄ λλ€. )
(ννμ΄μ§ 루νΈκ° /var/www/html μ΄ μλλΌλ©΄ μνμΉ μ€μ μ Alias /vnstat /var/www/html/vnstat μ μΆκ°ν΄μ£Όλ©΄ λλ€.)
vnstat PHP frontend
νΈλν½ λͺ¨λν°λ§μμλ Webalizer λ³΄λ€ λμ κ² κ°λ€.
μΆμ²: http://blog.ivps.kr/70 [iVPS κ°μμλ²νΈμ€ν
]
'DevOps > OS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[Ubuntu] μλμ°(Window)μμ μ°λΆν¬(Ubuntu) μ격μ μ (0) | 2023.02.04 |
---|---|
[Windows10] hosts νμΌ μμ νλ λ² (0) | 2017.08.08 |
[Linux] egrep λͺ λ Ήμ΄ (0) | 2016.11.08 |
[Linux] VI λ¬ΈμνΈμ§κΈ° λ° κ·Έ μΈ λͺ λ Ήμ΄λ€ (0) | 2016.11.08 |
[Linux] cp λͺ λ Ήμ΄ μ mv λͺ λ Ήμ΄ (0) | 2016.11.08 |
μμ€ν κ³΅κ° κ°μ¬ν©λλ€. π