웹서버의 종류(IIS , Tomcat, PHP 등)을 알면 더 좋을텐데, 일단 윈도우서버라고 하셨으니 윈도우서버 기본 탑재되어 있는 IIS 기준으로 본다면 유명한게 Webalizer 와 AWStats 가 있습니다. 1. Webalizer 2. AWStats 네트워크 트래픽을 모니터링하려면 wireshark 만한게 있을까 싶네요~ https://www.wireshark.org/ Linux에서도 tcpdump가 간편하게 트래픽 모니터링할때 괜찮지만, GUI 환경에서 다양하게 검토해 볼때는 wireshark가 더 편하고요. 너무 방대한 트래픽들이 저장되어 처리에 어려움이 있을 수도 있기 때문에, 불필요한 트래픽들은 걸러지게 Capture Filter를 잘 설정해서 캡쳐하는게 도움이 될걸로 보이고요~ 필터링 설정 방법이라든지 사용방법 등등에 대해 공부를 좀해서 해야 할 것 같고요. 시행 착오로 부터 얻어 지는 노하우도 있어야 분석하는데 큰 어려움이 없을 걸로 보여지기도 하네요. 이전에 사용하던 vnstat 이라는 것이 있습니다. 서버를 운영하면서 하루에 500GB 트래픽을 찍으면 기분이 좋아지고 그런 것이 있죠 ㅎㅎ vnstat 이라는 것으로 트래픽을 일 주 달 시간 등으로 나누어 확인할 수 있는 패키지입니다. 시작합니다. -- 아래의 글은 U5PVR Debian 9 Stretch 에서 작성된 글입니다. 본래 8버전에서는 php5 가 설치됩니다. 1. apache2 php7 vnstat 설치하기 root@AOL-Debian:~# apt install apache2 libapache2-mod-php php php-gd vnstat Reading package lists... Done Building dependency tree Reading state information... Done apache2 is already the newest version (2.4.25-3+deb9u6). apache2 set to manually installed. The following packages were automatically installed and are no longer required: libjsoncpp0 libmicrohttpd10 libupnpp4 Use 'apt autoremove' to remove them. The following additional packages will be installed: libapache2-mod-php7.0 libgd3 libxpm4 php-common php7.0 php7.0-cli php7.0-common php7.0-gd php7.0-json php7.0-opcache php7.0-readline Suggested packages: php-pear libgd-tools vnstati The following NEW packages will be installed: libapache2-mod-php libapache2-mod-php7.0 libgd3 libxpm4 php php-common php-gd php7.0 php7.0-cli php7.0-common php7.0-gd php7.0-json php7.0-opcache php7.0-readline vnstat 0 upgraded, 15 newly installed, 0 to remove and 6 not upgraded. Need to get 3,078 kB of archives. After this operation, 10.3 MB of additional disk space will be used. Do you want to continue? [Y/n] 2. vnstat 설정하기 vnstat 을 실행하고 모니터링할 대상을 넣어줍니다. root@AOL-Debian:~# vnstat No database found, nothing to do. Use --help for help. A new database can be created with the following command: vnstat --create -i eth0 Replace 'eth0' with the interface that should be monitored. The following interfaces are currently available: wlan0 lo eth0 (1000 Mbit) teql0 # eth0 에 대해서 트래픽 모니터링을 걸어줍니다. root@AOL-Debian:~# vnstat --create -i eth0 Creating database for interface "eth0"... Info: -> A new database has been created. Restart the vnStat daemon if it is currently running in order to start monitoring "eth0". # 일정 기간 지나야 트래픽이 표시됩니다. root@AOL-Debian:~# vnstat eth0: Not enough data available yet. # vnstat 계정을 aid_inet 그룹에 추가합니다. root@AOL-Debian:~# adduser vnstat aid_inet Adding user `vnstat' to group `aid_inet' ... Adding user vnstat to group aid_inet Done. # 서비스를 시작합니다. root@AOL-Debian:~# service vnstat restart [ ok ] Stopping vnStat daemon: vnstatd. [ ok ] Starting vnStat daemon: vnstatd. # 실행 확인을 해줍니다. root@AOL-Debian:~# ps -ef | grep vnstat vnstat 27269 1 0 21:25 ? 00:00:00 /usr/sbin/vnstatd -d --pidfile /run/vnstat/vnstat.pid root 27389 14114 0 21:26 pts/0 00:00:00 grep vnstat --여담 대부분 프로세스나 서비스들을 가이드에 따르면, 이때까지 root 계정으로 실행해 왔습니다. root 권한으로 프로세스가 돌게 되면 보안상 위험이 있지만, 이 이유는 아래와 같습니다. 1. 세팅 과정상 권한이 부족함에서 오는 에러 방지 (스트레스 방지) --> 이후 익숙하시면 프로세스 실행 주체를 root 에서 다른 것으로 바꾸시면 됩니다. 2. 안드로이드 환경에 맞게 프로세스 실행 계정 통일 3. 리소스에 대한 우선권을 가지기 위함 # vnstat db 업데이트 root@AOL-Debian:~# vnstat -u # 다시 명령 실행 root@AOL-Debian:~# vnstat Database updated: Mon Apr 8 21:31:02 2019 eth0 since 04/08/2019 rx: 1.72 GiB tx: 373.91 MiB total: 2.09 GiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Apr '19 1.72 GiB | 373.91 MiB | 2.09 GiB | 26.98 kbit/s ------------------------+-------------+-------------+--------------- estimated 6.88 GiB | 1.45 GiB | 8.33 GiB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- today 1.72 GiB | 373.91 MiB | 2.09 GiB | 226.34 kbit/s ------------------------+-------------+-------------+--------------- estimated 1.92 GiB | 416 MiB | 2.33 GiB | root@AOL-Debian:~# 실제로 vnstat 데몬이 알아서 DB 를 갱신하기 때문에 crontab 에 vnstat -u 명령을 넣을 필요는 없습니다. 기본 5분 단위로 되어 있는것 같습니다. 설정을 변경하시려면, /etc/vnstat.conf 파일을 수정하세요. 3. vnstat php web 설치하기 http://www.sqweek.com/sqweek/index.php?p=1 상기에서 배포중입니다. 일단 웹서버 설정을 건들이지 않고 매우 기본적이게 해보겠습니다. 기본적으로 웹서버 잘 구동되는 지 체크합니다. 다음으로 vnstat web 소스를 풀어 넣습니다. # 웹 기본 루트로 이동합니다. root@AOL-Debian:~# cd /var/www/html/ # 소스를 받습니다. root@AOL-Debian:/var/www/html# wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz --2019-04-08 21:38:58-- http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz Resolving www.sqweek.com (www.sqweek.com)... 46.19.33.108 Connecting to www.sqweek.com (www.sqweek.com)|46.19.33.108|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 57460 (56K) [application/x-gzip] Saving to: ‘vnstat_php_frontend-1.5.1.tar.gz’ vnstat_php_frontend-1.5.1.tar.g 100%[=======================================================>] 56.11K 96.6KB/s in 0.6s 2019-04-08 21:39:00 (96.6 KB/s) - ‘vnstat_php_frontend-1.5.1.tar.gz’ saved [57460/57460] # 압축을 풀어줍니다. root@AOL-Debian:/var/www/html# tar xf vnstat_php_frontend-1.5.1.tar.gz # 잠시 파일 구조 눈치를 봅니다. (폴더 밑에 풀림, 필요없는 파일 삭제해야 됨!) root@AOL-Debian:/var/www/html# ls index.html vnstat_php_frontend-1.5.1 vnstat_php_frontend-1.5.1.tar.gz # 필요없는 압축파일 index.html 파일 지웁니다. root@AOL-Debian:/var/www/html# rm vnstat_php_frontend-1.5.1.tar.gz index.html # 하위 폴더 파일을 상위 폴더로 이동합니다. root@AOL-Debian:/var/www/html# mv vnstat_php_frontend-1.5.1/* . # 빈폴더를 지웁니다. root@AOL-Debian:/var/www/html# rm -rf vnstat_php_frontend-1.5.1/ 작동을 확인합니다. 언어가 .. 음.. 언어설정을 수정합니다. root@AOL-Debian:/var/www/html# nano config.php <?php // // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra () // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // see file COPYING or at http://www.gnu.org/licenses/gpl.html // for more information. // error_reporting(E_ALL | E_NOTICE); // // configuration parameters // // edit these to reflect your particular situation // $locale = 'en_US.UTF-8'; $language = 'en'; 아래처럼 표기 됩니다. 차후에 몇일 데이터를 모아서 보여드리겠습니다. 감사합니다. |