RadarURL

조회 수 706 추천 수 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 927565
2066 하드웨어 베이트레일 셀러론 J1900을 탑재한 기가바이트 GA-J1900N-D3V 보드 file JaeSoo 2015.01.13 350
2065 유닉스/리눅스 아파치서버 동시접속자수에 따른 메모리 산정 (대략) JaeSoo 2015.01.13 414
2064 유닉스/리눅스 데비안 리눅스 로그 관리 JaeSoo 2015.01.13 422
2063 유닉스/리눅스 리눅스 로그파일관리 (logrotate) file JaeSoo 2015.01.13 742
2062 유닉스/리눅스 리눅스 logrotate를 활용한 로그 관리 (compress, lotate) JaeSoo 2015.01.13 562
2061 연애 매일 남편과 섹스해야 하는 5가지 이유 file JaeSoo 2015.01.12 414
2060 모바일 요즘 7,8인치 태블릿 중 살만한 것들 비교 (가격,스펙,성능비교,이북리더기 대용,넥서스7,아이패드미니) file JaeSoo 2015.01.02 1030
2059 연애 애널섹스(anal sex, 항문성교) file JaeSoo 2014.12.26 994
2058 연애 애널 섹스의 위험성 file JaeSoo 2014.12.26 766
2057 유닉스/리눅스 CentOS5 MRTG서버 트래픽 모니터링 file JaeSoo 2014.12.26 790
2056 유닉스/리눅스 SNMP 를 설정해 보자 (CentOS 5.6) JaeSoo 2014.12.26 1070
2055 유닉스/리눅스 [CentOS] MRTG를 설치하여 서버의 대역폭을 기록하자 JaeSoo 2014.12.26 734
2054 유닉스/리눅스 Using MRTG on Debian Stable (Sarge) JaeSoo 2014.12.26 737
2053 유닉스/리눅스 MRTG 구축 JaeSoo 2014.12.26 577
2052 유닉스/리눅스 Usage of MRTG for System Resource #4 - MRTG Script 만들기 JaeSoo 2014.12.26 680
» 유닉스/리눅스 Usage of MRTG for System Resource #3 - MRTG Script 사용법 JaeSoo 2014.12.26 706
2050 유닉스/리눅스 Usage of MRTG for System Resource #2 - mrtg.cfg 설정 JaeSoo 2014.12.26 721
2049 유닉스/리눅스 Usage of MRTG for System Resource #1 - mrtg 설치하기 2 file JaeSoo 2014.12.26 796
2048 유닉스/리눅스 CentOS 5.0에 net-snmpd 설치 JaeSoo 2014.12.26 705
2047 유닉스/리눅스 리눅스로 MRTG 트래픽분석서버 구축 JaeSoo 2014.12.26 705
Board Pagination Prev 1 ... 16 17 18 19 20 21 22 23 24 25 ... 124 Next
/ 124


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

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

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

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

JServer.kr

제이서버 메타블로그

재수 티스토리


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

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너