RadarURL

조회 수 1633 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

3. MRTG Script 사용법


앞에서도 밝혔듯이 필자가 mrtg를 약간 수정을 했다고 했다. 그 수정한 script를 사용
하는 법을 이 section 에서 다루고자 한다.


mrtg script 는 4가지의 option을 가지고 있다. 아래의 help를 보도록 하자.
 


 Hanterm 

 [root@bbuwoo mydir]$ mrtg help

  Usage: /usr/sbin/mrtg {conf|index|log}
  conf  - create mrtg config file
  index - create index file of mrtg
  log   - logging mrtg log

 [root@bbuwoo mydir]$
 


mrtg script 에는 위에서와 같이 3가지의 옵션을 보여준다. 위에서 4 가지라고 한것은
rpm 으로 설치를 할때 mrtg.cfg 를 생성시켜 주기 위한 것으로 알 필요는 없다.  일단
각각의 옵션들에 대해 설명을 해 보도록 하겠다.

mrtg log 명령은  mrtg.cfg file의 설정을 이용하여 WorkDir 에 mrtg log와 html file
그리고 gif image(mrtg graph)를 생성을 한다.

mrtg index 는 index.html 을 생성해 준다.

mrtg conf 는 mrtg.cfg 를 생성을 해 주는데.. 여기서는 router 의 전송량을 mrtg.cfg
로 만들어 주게 되어 있다. 그러므로 mrtg conf 명령은 별로 사용할일이 없을 것이다.
아니 router의 사용량을 보고 싶다면 mrtg conf명령을 실행하되.. 주의 할것은 기본적
인 mrtg.cfg 를 덮어씌우게 되므로 백업을 한 뒤에 생성을 하고 생성된 파일에서 mrtg
router 설정 부분만 원 cfg file의 가장 뒤에 붙여서 사용을 하기 바란다.

그럼 다시 본론으로 들어가서 앞에서 까지의 과정 즉,  mrtg.cfg 의 수정을 완료를 했
다면 일단 처음 mrtg.cfg를 수정한 사람의 경우에는 WorkDir 로 지정되어 있는 디렉토
리에 있는 파일들을 모두 삭제를 한다. 이유는 아직 mrtg.cfg를 설정하지 않았는데 앞
에서 cron 으로 mrtg 를  작동하게 해 놓았기 때문에 잘못된 데이타 들이 들어가 있는
log file들이 존재 하기 때문이다. 그러므로 일단 이 파일들을 삭제한 뒤에 아래와 같
이 명령을 실행 하도록 한다.

다시 당부하지만 WorkDir 즉 /home/httpd/html/MRTG-data 에 있는 파일들을 삭제할 경
우는 mrtg.cfg 를 처음 설정한 경우에만 해당한다.
 


 Hanterm

 [root@bbuwoo etc]$ rm -rf /home/httpd/html/MRTG-data/*.*

 삭제를 할때 *으로 삭제를 하면 기본적인 icon까지 삭제가 되므로
 꼭 *.* 으로 삭제를 하기 바란다.

 [root@bbuwoo etc]$ mrtg log
  Rateup WARNING: rateup could not read the primary log file for router_1
  Rateup WARNING: rateup The backup log file for router_1 was invalid as well
  Rateup WARNING: rateup Can't remove router_1.old updating log file
  Rateup WARNING: rateup Can't rename router_1.log to router_1.old updating log file
  Rateup WARNING: rateup could not read the primary log file for router_2
  Rateup WARNING: rateup The backup log file for router_2 was invalid as well
  Rateup WARNING: rateup Can't remove router_2.old updating log file
  Rateup WARNING: rateup Can't rename router_2.log to router_2.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work
  Rateup WARNING: rateup The backup log file for work was invalid as well
  Rateup WARNING: rateup Can't remove work.old updating log file
  Rateup WARNING: rateup Can't rename work.log to work.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_eth0
  Rateup WARNING: rateup The backup log file for work_eth0 was invalid as well
  Rateup WARNING: rateup Can't remove work_eth0.old updating log file
  Rateup WARNING: rateup Can't rename work_eth0.log to work_eth0.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_load
  Rateup WARNING: rateup The backup log file for work_load was invalid as well
  Rateup WARNING: rateup Can't remove work_load.old updating log file
  Rateup WARNING: rateup Can't rename work_load.log to work_load.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_httpd
  Rateup WARNING: rateup The backup log file for work_httpd was invalid as well
  Rateup WARNING: rateup Can't remove work_httpd.old updating log file
  Rateup WARNING: rateup Can't rename work_httpd.log to work_httpd.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_disk
  Rateup WARNING: rateup The backup log file for work_disk was invalid as well
  Rateup WARNING: rateup Can't remove work_disk.old updating log file
  Rateup WARNING: rateup Can't rename work_disk.log to work_disk.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_mem
  Rateup WARNING: rateup The backup log file for work_mem was invalid as well
  Rateup WARNING: rateup Can't remove work_mem.old updating log file
  Rateup WARNING: rateup Can't rename work_mem.log to work_mem.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_swap
  Rateup WARNING: rateup The backup log file for work_swap was invalid as well
  Rateup WARNING: rateup Can't remove work_swap.old updating log file
  Rateup WARNING: rateup Can't rename work_swap.log to work_swap.old updating log file

  mrtg log 명령을 처음 실행하면 위와 같이 현란한 에러 메세지들이 출력이 될것이다.
  하지만 당황하지 말자. 그냥 나오는 메세지 들이다. 3 번째 명령 부터는 에러가 없어
  질 것이다. 단순히 log file의 backup file이 존재하지 않기 때문에 발생하는 에러일
  뿐이다.

 [root@bbuwoo etc]$ mrtg index

  mrtg index 명령은 mrtg log 명령으로 log file 들과 결과물들을 생성한 후에 index
  page를 생성을 한다

 [root@bbuwoo etc]$
 


위의 process 를 마친 후면 web browser로 http://domain.com/MRTG-data/ 로 들어가서
확인을 할수가 있다. 이까지의 작업을 마쳤으면 다음 부터는 아무것도 할 필요가 없이
그냥 나두면 cron daemon 이 알아서 계속 측정을 하게 된다.
 


3. MRTG Script 사용법
앞에서도 밝혔듯이 필자가 mrtg를 약간 수정을 했다고 했다. 그 수정한 script를 사용 하는 법을 이 section 에서 다루고자 한다. mrtg script 는 4가지의 option을 가지고 있다. 아래의 help를 보도록 하자.
 Hanterm

 [root@bbuwoo mydir]$ mrtg help

  Usage: /usr/sbin/mrtg {conf|index|log}
  conf  - create mrtg config file
  index - create index file of mrtg
  log   - logging mrtg log

 [root@bbuwoo mydir]$
mrtg script 에는 위에서와 같이 3가지의 옵션을 보여준다. 위에서 4 가지라고 한것은
rpm 으로 설치를 할때 mrtg.cfg 를 생성시켜 주기 위한 것으로 알 필요는 없다.  일단
각각의 옵션들에 대해 설명을 해 보도록 하겠다.

mrtg log 명령은  mrtg.cfg file의 설정을 이용하여 WorkDir 에 mrtg log와 html file
그리고 gif image(mrtg graph)를 생성을 한다.

mrtg index 는 index.html 을 생성해 준다.

mrtg conf 는 mrtg.cfg 를 생성을 해 주는데.. 여기서는 router 의 전송량을 mrtg.cfg
로 만들어 주게 되어 있다. 그러므로 mrtg conf 명령은 별로 사용할일이 없을 것이다.
아니 router의 사용량을 보고 싶다면 mrtg conf명령을 실행하되.. 주의 할것은 기본적
인 mrtg.cfg 를 덮어씌우게 되므로 백업을 한 뒤에 생성을 하고 생성된 파일에서 mrtg
router 설정 부분만 원 cfg file의 가장 뒤에 붙여서 사용을 하기 바란다.

그럼 다시 본론으로 들어가서 앞에서 까지의 과정 즉,  mrtg.cfg 의 수정을 완료를 했
다면 일단 처음 mrtg.cfg를 수정한 사람의 경우에는 WorkDir 로 지정되어 있는 디렉토
리에 있는 파일들을 모두 삭제를 한다. 이유는 아직 mrtg.cfg를 설정하지 않았는데 앞
에서 cron 으로 mrtg 를  작동하게 해 놓았기 때문에 잘못된 데이타 들이 들어가 있는
log file들이 존재 하기 때문이다. 그러므로 일단 이 파일들을 삭제한 뒤에 아래와 같
이 명령을 실행 하도록 한다.

다시 당부하지만 WorkDir 즉 /home/httpd/html/MRTG-data 에 있는 파일들을 삭제할 경
우는 mrtg.cfg 를 처음 설정한 경우에만 해당한다.
 Hanterm

 [root@bbuwoo etc]$ rm -rf /home/httpd/html/MRTG-data/*.*

 삭제를 할때 *으로 삭제를 하면 기본적인 icon까지 삭제가 되므로
 꼭 *.* 으로 삭제를 하기 바란다.

 [root@bbuwoo etc]$ mrtg log
  Rateup WARNING: rateup could not read the primary log file for router_1
  Rateup WARNING: rateup The backup log file for router_1 was invalid as well
  Rateup WARNING: rateup Can't remove router_1.old updating log file
  Rateup WARNING: rateup Can't rename router_1.log to router_1.old updating log file
  Rateup WARNING: rateup could not read the primary log file for router_2
  Rateup WARNING: rateup The backup log file for router_2 was invalid as well
  Rateup WARNING: rateup Can't remove router_2.old updating log file
  Rateup WARNING: rateup Can't rename router_2.log to router_2.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work
  Rateup WARNING: rateup The backup log file for work was invalid as well
  Rateup WARNING: rateup Can't remove work.old updating log file
  Rateup WARNING: rateup Can't rename work.log to work.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_eth0
  Rateup WARNING: rateup The backup log file for work_eth0 was invalid as well
  Rateup WARNING: rateup Can't remove work_eth0.old updating log file
  Rateup WARNING: rateup Can't rename work_eth0.log to work_eth0.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_load
  Rateup WARNING: rateup The backup log file for work_load was invalid as well
  Rateup WARNING: rateup Can't remove work_load.old updating log file
  Rateup WARNING: rateup Can't rename work_load.log to work_load.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_httpd
  Rateup WARNING: rateup The backup log file for work_httpd was invalid as well
  Rateup WARNING: rateup Can't remove work_httpd.old updating log file
  Rateup WARNING: rateup Can't rename work_httpd.log to work_httpd.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_disk
  Rateup WARNING: rateup The backup log file for work_disk was invalid as well
  Rateup WARNING: rateup Can't remove work_disk.old updating log file
  Rateup WARNING: rateup Can't rename work_disk.log to work_disk.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_mem
  Rateup WARNING: rateup The backup log file for work_mem was invalid as well
  Rateup WARNING: rateup Can't remove work_mem.old updating log file
  Rateup WARNING: rateup Can't rename work_mem.log to work_mem.old updating log file
  Rateup WARNING: rateup could not read the primary log file for work_swap
  Rateup WARNING: rateup The backup log file for work_swap was invalid as well
  Rateup WARNING: rateup Can't remove work_swap.old updating log file
  Rateup WARNING: rateup Can't rename work_swap.log to work_swap.old updating log file

  mrtg log 명령을 처음 실행하면 위와 같이 현란한 에러 메세지들이 출력이 될것이다.
  하지만 당황하지 말자. 그냥 나오는 메세지 들이다. 3 번째 명령 부터는 에러가 없어
  질 것이다. 단순히 log file의 backup file이 존재하지 않기 때문에 발생하는 에러일
  뿐이다.

 [root@bbuwoo etc]$ mrtg index

  mrtg index 명령은 mrtg log 명령으로 log file 들과 결과물들을 생성한 후에 index
  page를 생성을 한다

 [root@bbuwoo etc]$
위의 process 를 마친 후면 web browser로 http://domain.com/MRTG-data/ 로 들어가서
확인을 할수가 있다. 이까지의 작업을 마쳤으면 다음 부터는 아무것도 할 필요가 없이
그냥 나두면 cron daemon 이 알아서 계속 측정을 하게 된다.



출처 : http://oops.org/?&t=lecture&sb=mrtg&n=3

?

공부 게시판

공부에 도움되는 글을 올려주세요.

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 [공지] 공부 게시판 입니다. 처누 2003.08.18 950260
194 유닉스/리눅스 [Rocky Linux 9] /home 용량 줄이고 /root 용량 늘리기 YooN 2026.04.03 49
193 유닉스/리눅스 [Rocky Linux] LVM 환경에서 /root 파티션 공간 부족 해결 YooN 2026.04.03 36
192 유닉스/리눅스 [Linux/Rocky] SSH Root 로그인하는 방법 (root 접속 허용) YooN 2026.04.01 38
191 유닉스/리눅스 리눅스 서버 설치 중 에러 "Failed to find a suitable stage1 device" YooN 2025.10.03 892
190 유닉스/리눅스 Linux 11 . Linux 설치 시 lvm 수동설정 YooN 2025.10.03 798
189 유닉스/리눅스 [Rocky Linux] 누구나 쉽게 따라하는 Rocky Linux 9.0 OS 다운로드 및 설치 방법~!! YooN 2025.10.03 764
188 유닉스/리눅스 Linux/Rocky Linux Rocky Linux : Composer 설치 YooN 2025.09.29 1032
187 유닉스/리눅스 [Rocky Linux] 록키 리눅스 최신 업데이트 적용 방법 YooN 2025.09.29 948
186 유닉스/리눅스 rocky linux 커널 업데이트 YooN 2025.09.29 802
185 유닉스/리눅스 Clonezilla(클론질라) 백업파일 하드디스크로 복구 방법 YooN 2025.09.28 886
184 유닉스/리눅스 클론질라 사용 방법 - OS 이미지 백업 CloneZilla YooN 2025.09.28 912
183 유닉스/리눅스 [Linux / Rocky] FTP 접속 관련 설정 실습 예제 YooN 2025.09.23 947
182 유닉스/리눅스 Could not reliably determine the server's fully qualified domain name YooN 2025.09.23 1005
181 유닉스/리눅스 [아파치] 아파치 웹서버에 .htaccess 파일 설정하는 방법 YooN 2025.09.23 905
180 유닉스/리눅스 [Linux] Apache web server의 rewrite module 사용하기 [출처] [Linux] Apache web server의 rewrite module 사용하기|작성자 g00dmoney YooN 2025.09.23 1236
179 유닉스/리눅스 록키 리눅스 9.1에서 apache, mysql, PHP 설치 YooN 2025.09.23 890
178 유닉스/리눅스 [권한문제] 라이믹스 Fatal error: Uncaught Rhymix\Framework\Exception: Cannot write template cache file YooN 2025.09.23 842
177 유닉스/리눅스 라이믹스 php 에러 표시 YooN 2025.09.23 626
176 유닉스/리눅스 Rocky Linux - 라이믹스(Rhymix) 설치하기 YooN 2025.09.23 763
175 유닉스/리눅스 라이믹스(Rhymix) 매뉴얼 YooN 2025.09.23 1025
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 Next
/ 10


즐겨찾기 (가족)

JAESOO's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

숭실대 컴퓨터 통신연구실 (서창진)

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

아스가르드 좋은사람/나쁜사람

JServer.kr

제이서버 메타블로그

재수 티스토리


즐겨찾기 (강의, 커뮤니티)

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너