인생사는 이야기

[ZABBIX] 자빅스 리눅스 CPU 체크 하기 , iostat 본문

IT/ZABBIX

[ZABBIX] 자빅스 리눅스 CPU 체크 하기 , iostat

채율파파 2012. 5. 2. 02:02
반응형

 

 

 

 

안녕하세요 타이거범입니다. 어흥~ㅋ

 

자빅스 감시 프로그램에 리눅스쪽 CPU 사용률을 Latest에서 볼수있게 iostat을 활용 아이템을 추가 해보도록 하겠습니다.

 

 

iostat 이란??

root#> man iostat

root#> iostat --help 

 도움말 참조 하시고요. 간단히 말씀드리면 디스크 IO 상태를 확인해 주는 명령어 입니다.

이게 CPU랑 무슨 상관 이냐고요??

iostat -c 옵션을 주게되면CPU 사용 률이 나오지요~

root#> iostat -c

 

Linux 2.6.9-78.ELsmp     2012년 05월 02일

avg-cpu:  %user   %nice    %sys     %iowait   %idle
               0.53        0.01    1.12            2.36   95.97

user, nice, system, iowait, idle 이 % 로 나오는데요

이것을 이용하여 자빅스에 감시를 넣어 보도록 하겠습니다.

먼저 자빅스 conf 파일을 찾아 봅시다~

root#> vi /usr/local/zabbix/conf/userparameter.conf

맨 아래 줄로 이동 후 다음과 같이 입력 하시면 됩니다.

#

# CPU Information, TigerBum

UserParameter=cpu.used,iostat -c | tail -2 | sed '2d' | awk 'BIGIN {sum=0} {sum=($1+$2+$3)} END {print sum}'

UserParameter=cpu.user,iostat -c | tail -2 | sed '2d' | awk '{print $1}'

UserParameter=cpu.nice,iostat -c | tail -2 | sed '2d' | awk '{print $2}'

UserParameter=cpu.system,iostat -c | tail -2 | sed '2d' | awk '{print $3}'

UserParameter=cpu.iowait,iostat -c | tail -2 | sed '2d' | awk '{print $4}'

UserParameter=cpu.idle,iostat -c | tail -2 | sed '2d' | awk '{print $5}'

 

※ 빨간 글씨가 key 값이라는건 알고 계셔야 하고요~

 

요렇게 입력 후 저장 나가기

root#> /etc/init.d/zabbix-agentd stop

root#> /etc/init.d/zabbix-agentd start

자빅스 재시작해 주시면 됩니다.

 

자빅스웹페이지를 열어 item 생성을 해주시면 됩니다~

 

 

 

반응형

'IT > ZABBIX' 카테고리의 다른 글

[Zabbix] 윈도우 서버 이벤트 감시  (0) 2012.04.06
[Zabbix] Agent 설치  (0) 2012.03.29
[Zabbix] Zabbix Server 설치.1  (0) 2012.03.29
[Zabbix] Zabbix 1.6 메뉴얼  (1) 2012.03.29
Comments