트레픽 모니터링 으로는 mrtg 만한게 없다
쓰기에는 정말 좋다
우선 mrtg 설치 방법인다.
# yum install -y mrtg*
#cfgmaker –global ‘WorkDir: /ft/mrtg/’ –global ‘Language: korean’ –global ‘Options[_]: bits,growright’ -output /etc/mrtg/mrtg.cfg [snmp에 설정한 sec.name]@[서버 아이피]
그 후 mrtg.cfg 에서
# for UNIX
WorkDir: /var/www/mrtg --> 주석 해제 및 경로 지정
Language: korean --> 언어 설정
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bits --> 주석 해제
EnableIPv6: no --> 주석 해제
위와 같이 설정 해주면 된다.
#indexmaker --title [타이틀이름] --output /var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
그 후 인덱스 파일 생성
그 후 서버 접속 하면 설치가 된다.
snmp 설정 방법 (centos)
# sec.name source community
com2sec abc default public
com2sec abc [허용할 IP] public
####
# Second, map the security name into a group name:
# groupName securityModel securityName
group abcGroup v1 abc
group abcGroup v2c abc
group abcGroup usm abc
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1 80
view systemview included .1.3.6.1.2.1.25.1.1 80
view all included .1 80
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access abcGroup "" any noauth exact systemview none none
access abcGroup "" any noauth exact all all all
빨간 글씨로 써져 있는 부분 설정 변경 하면 된다.
snmp 설정 방법 (ubuntu)
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161 --> 주석 해제
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/lib/snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# Full access from the local host
rocommunity public localhost
# Default access to basic system info
#rocommunity public default -V systemonly
rocommunity public [허용할 IP] --> 추가
그 후 서비스 재시작
#service snmpd restart
#snmpwalk -v1 -c public [해당 서버 IP] ifEntry
명령어 쳐서 쭉~ 나오면 된다.
mrtg.cfg 파일 수정
#[abc]
Target[traffic]: 2:public@[IP] --> 빨간 부분 CID 값
SetEnv[traffic]: MRTG_INT_IP="123.123.123.123" MRTG_INT_DESCR="eth0" --> 서버 정보 적어주면 된다.
MaxBytes[traffic]:104857600
Title[traffic]: abc SERVER
PageTop[traffic]: <h1>abc SERVER</h1>
YLegend[traffic]: Traffic
XSize[traffic]: 500
YSize[traffic]: 100
서버 여러대 추가 할때는
Target[traffic]: 2:public@[IP] + 2:public@[IP] + 2:public@[IP]
반드시 띄어쓰고 + 해주어야 한다.
'리눅스' 카테고리의 다른 글
bash 특정 파일 전부 바꾸기 (0) | 2018.10.25 |
---|---|
우분투 mrtg 용 snmp 설정 방법 (0) | 2018.10.11 |
expect 날짜 넣기 (0) | 2018.10.04 |
grep 명령어 (0) | 2018.10.02 |
심볼릭 링크 걸기 (0) | 2018.10.02 |