2016년 11월 29일 화요일

Predictive Failure 란?

HP 서버중 한대에서 디스크 에러가 났다.
physicaldrive 1I:1:7 (port 1I:box 1:bay 7, SAS, 300 GB, Predictive Failure)
physicaldrive 1I:1:8 (port 1I:box 1:bay 8, SAS, 300 GB, OK)

 

Predictive Failure

문구 자체가 참 애매하다. 에러가 난 것도 아니고

에러가 날 거란 걸 예측해 주는 거라는 데, 그 원리가 무엇인지 궁금했다.

 

영문 위키에서 찾을 수 있었다.
he drive firmware compares the measured parameters against predefined thresholds and evaluates the health status of the drive.

드라이브의 측정 된 값과 사전정의 된 임계값과 비교하여 상태를 평가한다고 되어 있다.
 
참고 : http://comfix.kr/162
 

2016년 11월 25일 금요일

logrotate가 안될 때...

오랜만에 서버 점검을 하니 messages 로그가 비정상으로 크다.

무려 1.8G!
-rw-------. 1 root root 1915638280 2016-11-25 09:01 messages

 

접근 시도가 많은 것으로 알고 failer들 차단하고 나섰는 데, 뭔가 이상하다.

로그 파일이 messages밖에 없다. 기본적으로 rotate가 돌아서 messages.1이나

messages-날짜, 이런 형식으로 있어야 되는 데, 없다.

 

rotate가 안되고 있다!!.
 
아래 명령어로 확인. -d 옵션이 debug 모드.
/usr/sbin/logrotate -d /etc/logrotate.conf

출력 내용중 아래와 같이 이상점 발견
considering log /var/log/messages
log needs rotating

로테이트가 필요없다고!? 2G에 육박하고 있는 데 무슨 소리야.

 

logrotate는 /var/lib/logrotate.status 파일의 내용을 참조하여 rotate를 한다.

해당 파일을 살펴보니 내용이 없다.
#비정상(문제서버)
[root@localhost log]# cat /var/lib/logrotate.status
logrotate state -- version 2

#정상(비교대상 서버)
[root@localhost log]# cat /var/lib/logrotate.status
logrotate state -- version 2
"/var/log/yum.log" 2016-1-1
"/var/log/cups/error_log" 2016-10-9
"/var/named/data/named.run" 2016-11-20
"/var/log/sssd/*.log" 2015-1-6
"/var/log/dracut.log" 2016-1-1
"/var/log/wtmp" 2015-1-6
"/var/log/spooler" 2016-11-20
"/var/log/btmp" 2016-11-1
"/var/log/xferlog" 2016-11-20
"/var/log/maillog" 2016-11-20
"/var/log/cups/*_log" 2015-1-6
"/var/log/secure" 2016-11-20
"/var/log/messages" 2016-11-20
"/var/account/pacct" 2015-1-6
"/var/log/cron" 2016-11-20
"/var/log/vsftpd.log" 2015-1-7

 

열심히 검색 했으나, 원인은 찾을 수가 없다.

 

해결법은 아래 명령어로 rotate를 강제 적용 하는 것이다.
/usr/sbin/logrotate -f /etc/logrotate.conf

위와 같이 하면 /var/lib/logrotate.status 내용이 정상 서버와 같이 만들어지고,
아래와 같이 로테이트 된다. 기존 파일을 분할하는 건 아니다.
-rw------- 1 root root 148 2016-11-25 09:58 messages
-rw-------. 1 root root 1915641841 2016-11-25 09:58 messages-20161125

2016년 11월 16일 수요일

PPS cfgmaker

mrtg로 pps 를 체크하는 것에 대해서 글을 썼는데,
cfgmaker로 만들고 그걸 다시 수정하는 게 번거로웠다.

cfgmaker는 perl 로 작성되어 있어서 수정이 가능하다.

그래서 target 관련 부분만 수정해서 ppscfgmaker를 만들었다.

diff로 비교해 보면 알지만 한개 라인만 수정하였다.
[root@localhost bin]# diff cfgmaker ppscfgmaker 
730c730
< my $default_target_directive = "Target[$target_name]: $if_ref:$router_connect";
---
> my $default_target_directive = "Target[$target_name]: ifInUcastPkts.$if_ref&ifOutUcastPkts.$if_ref:$router_connect + ifInNUcastPkts.$if_ref&ifOutNUcastPkts.$if_ref:$router_connect";

ppscfgmaker
확장자가 없으면 업로드가 안되서 .txt를 추가했다.
.txt 부분만 지우고 사용하면 된다.

2016년 11월 9일 수요일

MRTG PPS(packet per second) 설정

MRTG는 기본 BPS 외에 파라미터를 통해서 여러가지 그래프를 그릴 수 있다.

그 중에서 PPS 를 그려보자.

MRTG 사이트를 보면 MIB 리스트가 있는데, 거기에 보면 여러가지 OID 값이 있다.

그 중 패킷 관련 아래의 4가지만 적용한다.
#유니캐스트
ifInUcastPkts
ifOutUcastPkts

#NON 유니캐스트
ifInNUcastPkts
ifOutNUcastPkts

MRTG 적용 방법은 아래 처럼 하면 된다.

기존 cfgmaker 로 생성한 Target 정보를 아래처럼 변경하면 된다.

BPS 적용(cfgmaker 로 생성된 내용.)
Target[SWITCH_pps]: 86:public@111.111.222.222:::::2

PPS 적용
Target[SWITCH_pps]: ifInUcastPkts.86&ifOutUcastPkts.86:public@111.111.222.222:::::2+ ifInNUcastPkts.86&ifOutNUcastPkts.86:public@111.111.222.222:::::2



다른 블로그 글을 보니 ifInUcastPkt 와 ifOutUcastPkts 만 적용하는 하는 글도 보았는데,
여기서는 NON 유니캐스트도 포함시킨 것에 주의 하자.

2016년 11월 8일 화요일

시스코 스위치 로그 날짜 변경 및 ntp 설정

시스코 스위치에서 로그를 볼 때, 날짜 부분이 아래와 같이 UPTIME으로 나오기 때문에 보기에 불편하다.
5w1d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

 

날짜로 변경하자.
#conf t
(config)#service timestamps debug datetime localtime
(config)#service timestamps log datetime localtime

 

아래 명령어로 현재 시간을 확인 가능하다.
#sh clock
*17:26:25.762 UTC Mon Jul 9 2001

시간이 맞지 않는다. ntp 설정을 해주어야 겠다.
(config)#ntp server time.bora.net
Translating "time.bora.net"...domain server (8.8.8.8) [OK]

동기화 상태 확인
#sh ntp status
Clock is synchronized, stratum 3, reference is 203.248.240.140

상태가 unsynchronized 로 나오는 경우가 있는 데, 5분정도 지나서 다시 확인 하면 적용 되어 있다.
time.bora.net 에서 계속해서 요청 못하도록 막은 것 같다.

time.bora.net lookup을 못하면 네임서버 설정을 해 준다.(KT 아이피임.)
(config)#ip name-server 168.126.63.1