mrtg 2.16.2 설치관련

-------------------------------------------------------------------------------------------
# yum install -y snmpd* mrtg*
-------------------------------------------------------------------------------------------

 

계정은 /home/ifull/public_html/mrtg2를 기준으로 작성되었다.

 

-------------------------------------------------------------------------------------------
# service snmpd start
-------------------------------------------------------------------------------------------
 snmpd 데몬을 실행을 해줘야함.
 snmpd 자동실행시
 # chkconfig --level 345 snmpd on

 

-------------------------------------------------------------------------------------------
# vi /etc/snmp/snmp.conf

       #com2sec notConfigUser  default       public
  42 com2sec local    localhost        public
  43 com2sec network  192.168.0.123   public

       #group   notConfigGroup v1           notConfigUser
  49 group   notConfigGroup v2c           notConfigUser
  50 group   rwgroup         v1      local
  51 group   rwgroup         v2c     local
  52 group   rwgroup         v1      network
  53 group   rwgroup         v2c     network

       #view    systemview    included   .1.3.6.1.2.1.1
  61 #view    systemview    included   .1.3.6.1.2.1.25.1.1
  62 view    all             included        .1      80
  63 view    systemview      included        system
  64 view    mib2            included        .iso.org.dod.internet.mgmt.mib-2 fc

       #access  notConfigGroup ""      any       noauth    exact  systemview none none
  71 access  rwgroup ""      any     noauth  exact   all     all     all
  72 access  rwgroup ""      any     noauth  exact   systemview      none    none

  앞자리는 대략 라인 설명

 저장 완료
-------------------------------------------------------------------------------------------

 

-------------------------------------------------------------------------------------------
# cfgmaker --global 'WorkDir: /home/ifull/public_html/mrtg' --global 'Language: korean' --global 'Options[_]: bits,growright' --output /home/ifull/public_html/mrtg/cfg/mrtg.cfg public@서버아이피
-------------------------------------------------------------------------------------------
 --global 'Language: korean'   한글로 출력하기

 

 실행시 에러부분
 SNMP Error:
 Received SNMP response with error code
   error status: noSuchName
   index 2 (OID: 1.3.6.1.4.1.2021.10.1.3.3)
 SNMPv1_Session (remote host: "localhost" [서버아이피].161)
       community: "public"
     request ID: 1356710722
     PDU bufsize: 8000 bytes
      timeout: 2s
      retries: 5
      backoff: 1)
  at /usr/local/mrtg/bin/../lib/mrtg2/SNMP_util.pm line 490
 SNMPGET Problem for .1.3.6.1.4.1.2021.10.1.3.2 .1.3.6.1.4.1.2021.10.1.3.3 sysUptime sysName on public@서버아이피::::::v4only
   at /usr/local/mrtg/bin/mrtg line 2035

 

 161 에러는 포트를 열어줘야함. iptables 사용중이면
 # vi /etc/sysconfig/iptables
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 161 -j ACCEPT

 

 v4only 에러는 ipv6를 닫아주면 됨.
  링크로 처리함.
  http://ifull.co.kr/xe/206029
  추가 작성함.

 

  에러숫자에 따라서 처리 방식이 조금씩 다름니다. 확인 해주시면 됩니다.

 


환경파일 생성
-------------------------------------------------------------------------------------------
# indexmaker --title "mailer MRTG" --output /home/ifull/public_html/mrtg/index.htm /home/ifull/public_html/mrtg/cfg/mrtg.cfg
-------------------------------------------------------------------------------------------

 

환경파일로 mrtg정보확인
-------------------------------------------------------------------------------------------
# LANG=C LC_ALL=C /usr/bin/mrtg /home/ifull/public_html/mrtg2/cfg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
2013-08-17 11:29:59, Rateup WARNING: /usr/bin/rateup could not read the primary log file for 서버아이피_2
2013-08-17 11:29:59, Rateup WARNING: /usr/bin/rateup The backup log file for 서버아이피_2 was invalid as well
2013-08-17 11:29:59, Rateup WARNING: /usr/bin/rateup Can't remove 서버아이피_2.old updating log file
2013-08-17 11:29:59, Rateup WARNING: /usr/bin/rateup Can't rename 서버아이피_2.log to 서버아이피_2.old updating log file
-------------------------------------------------------------------------------------------
 처음 실행하면 에러 비슷한 메시지가 출력이 된다. 두~세번째부터는 메시지는 사라짐.


cron에 등록
-------------------------------------------------------------------------------------------
# crontab -e
*/10 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /home/ifull/public_html/mrtg2/cfg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
저장 완료
-------------------------------------------------------------------------------------------

 

홈페이지에서 확인
httpd://도메인/mrtg2/index.htm

 

이미지가 출력이 안되는 경우에는
# cp /var/www/mrtg/*.* /home/ifull/public_html/mrtg2/
복사하면 이미지 출력이 이상없이 정의됨.

 

이상입니다.