그리기 툴 두가지…

구글 스케치업(http://www.sketchup.com/)과 잉크스케이프(http://www.inkscape.org/)

구글 스케치업은 무료버젼과 유료버젼이 있으며 잉크스케이프는 완전 오픈소스 소프트웨어다.  가끔 3-D스케치 필요할때 유용하게 사용할 수 있을듯.

rrdtool 사용하기.

rrdtool을 사용하여 시스템과 네트워크를 모니터링 하려고 마음 먹었지만, 막상 rrdtool을 사용하는 방법에 대해서는 자세하게 설명되어 있는 한글 문서를 찾을 수 없었다.  결국, rrdtool을 이해하는데 도움이 되는 다음의 문서를 찾을 수는 있었지만, 문서를 참고하여 원하는 작업을 하기엔 역부족이었다. 

참고문서: http://www.joinc.co.kr/modules.php?name=News&file=article&sid=221&mode=nested

위의 문서에서 rrdtool의 데이타베이스 생성방법과 데이터 입력및 그래프를 생성하는 방법을 알 수 있다. 하지만, 이것만으로 원하는 일을 하려면 많은 수작업이 필요할 것이다. 하여 문서를 검색한 결과, rrdtool을 쉽게 이용할 수 있는 프론트엔드(front-end)프로그램들이 있다는것을 알 수 있었지만, 웬일인지 대부분의 문서들이  HotSaNIC 을 이용하는 방법이나 rrdexec를 사용하는 방법에 관한 문서들이었다.

설정이나 사용을 좀더 쉽게 할 수 있는 frontend를 찾다가 cacti라는 프론트엔드를 찾게 되었다. cacti는 http://cacti.net/index.php 에서 다운로드 받을 수 있고, 페도라를 사용한다면 yum install cacti 만으로 설치가 가능하다. 데비안의 경우는 apt-get install cacti 젠투리눅스의 경우는 emerg cacti 로 간단히 설치할 수 있으며, solaris의 경우는 소스를 받아 컴파일 하면 된다.

cacti를 사용하기위해서는 mysql, php, net-snmp, net-snmp-utils가 설치되어 있어야 한다.

cacti설치후 설정을 자신의 시스템에 맞게 변경한후, http://yourdomain/cacti 에 접속하여 device와 graph를 설정하여 사용하면된다.

solaris swap 공간 늘리기

/tmp 영역이 full 날 경우,

#mkfile 1g /export/home/swap_file

#swap -a /export/home/swap_file

/etc/vfstab화일에 아랫줄 추가

swap    –       /tmp    tmpfs   –       yes     –
/export/home/swap_file       –       –       swap    –       no      –

mysql configure 에러

Fedora core5 에서 mysql 4.0.25 configure시 다음과 같은 에러 발생

checking “LinuxThreads”… “Not found”
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used.  Please install Linuxthreads
(or a new glibc) and try again.  See the Installation chapter in the
Reference Manual for more information.

원인및 해결 방안은?

rsync를 이용한 원격백업

준비물: rsync를 이용할 수 있는 유닉스 박스 두대(box1, box2라 임의로 명하겠음)

참고사이트: http://troy.jdmz.net/rsync/index.html

먼저 box1의 화일을 box2에서 카피하고자 한다면, 다음과 같은 명령을 내려서 테스트 해 보자.

$ rsync -avz -e ssh user@box1:/home/user /home/

rsync가 정상적으로 작동한다면

Warning: the RSA host key for ‘box1’ differs from the key for the IP address ‘xxx.xxx.xxx.xxx’
Offending key for IP in /user/.ssh/known_hosts:1
Matching host key in /user/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)?

요런 메시지를 볼 수 있으며, 비밀번호를 제대로 입력했다면 화일들이 복사되는 모습을 볼 수 있을 것이다.

다음은 자동화를 위한 과정이다. 자동화를 위해서는 비밀번호 부분을 해결해야 한다. 자동화과정중에 비밀번호를 일일이 입력할 수는 없으니까.

box2에서

# ssh-keygen -t dsa

로 키를 생성한다. public key와 public key는 디폴트로 .ssh 디렉토리 아래에 생성되며 각각 id_dsa, id_dsa.pub 이다.

생성된 공개키(id_dsa.pub)를 box1으로 전송한다.

# scp /root/.ssh/id_dsa.pub root@box1:/root/

box1에서는 다음과 같은 작업을 한다.

# mv id_dsa.pub .ssh/

# touch authorized_keys (root/.ssh/에 화일이 없을때. 있으면 생략)
# chmod 600 authorized_keys
# cat id_dsa.pub >> authorized_keys

접속을 확인해서 비밀번호를 묻는지 확인한다. 여기서는 키 생성시 비밀번호를 입력하지 않았기때문에 바로 접속이 되어야 한다.

자, 이제 비밀번호 없이 rsync를 사용할 수 있는지 테스트를 해 보자.

#rsync -avz -e ssh root@box1:/home/source /home/target/

아무 문제가 없다면 target디렉토리 아래에 source디렉토리가 생성되어 화일들이 전송된 것을 볼 수 있다.

이제 이것을 자동화하여 cron에 등록하면 정해진 시간에 백업을 받을 수 있다.

스크립트내용 ====================================

#!/bin/sh
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=/root/.ssh/id_dsa
RUSER=root
RHOST=box1
RPATH=/home
LPATH=/home/backup/

#$RSYNC -az -e “$SSH -i $KEY” $RUSER@$RHOST:$RPATH $LPATH
$RSYNC -az -e $SSH $RUSER@$RHOST:$RPATH $LPATH

end of 스크립트 =========================================

위의 스크립트를 적당한곳에 생성한 후 crontab -e 명령을주고

0 4 * * * /[above script]

를 등록

그러면 매일 4시에 스크립트가 자동으로 실행되며 백업을 실시할 것이다.

linux 커널 메시지.

OS: Fedora core 5 

증상: httpd process가 무수히 많이 생기면서 좀비프로세스가 생김. 이때 메모리와 CPU를 거의 httpd 데몬이 점유하면서 느려짐.

메시지: 아래와 같음 

Out of Memory: Kill process 12558 (httpd) score 84120 and children.
Out of memory: Killed process 12558 (httpd).

원인은 뭘까요????

WRT-54G 펌웨어 관련글

원래 글은 60$짜리 라우터를 600$짜리로 바꾼다는 글. 원래 펌웨어에서 지원하지 않는 신호세기 조정이라든지, QoS를 지원한다든지에 관한 글이다. 잠깐봤는데, VLAN도 있는듯. 하지만 지원되는지는 모르겠다.

참고사이트:

http://kldp.org/node/77332

http://www.wrtrouters.com/guides/upgradetolinux/

http://www.lifehacker.com/software/router/hack-attack-turn-your-60-router-into-a-600-router-178132.php

 

MySQL에 데이타베이스, 사용자추가

기억력이 나빠서.. 할때마다 문서찾기..

그냥 적어 놓으련다.

mysql> CREATE database 디비;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT all privileges on 디비.* TO 사용자@localhost
> IDENTIFIED BY ‘패스워드’;
Query OK, 0 rows affected (0.00 sec)

RedHat 9.0에서 MRTG 구축하기 실습

원문은 bigadmin.org의 운영자인 dk가 작성.

필요한 파일을 다운 받아서 /usr/local/src 로 받아둡니다.
초고속으로 설치할 수 있게.. 간단하게 명령어들만 정리했습니다.
자세한 설명은 저도 잘 모르기 때문에.. 생략했습니다.. ^^;;

1. zlib-1.2.1.tar.gz
2. libpng-1.2.5.tar.gz
3. gd-2.0.15.tar.gz
4. mrtg-2.10.5.tar.gz

1. zlib-1.2.1.tar.gz 설치
# gzip -d zlib-1.2.1.tar.gz; tar xvf zlib-1.2.1.tar
# cd zlib-1.2.1
# ./configure –prefix=/usr/local/zlib
# make
# make test
# make install

2. libpng-1.2.5 설치
# cd ..; gzip -d libpng-1.2.5.tar.gz; tar libpng-1.2.5.tar
# mv libpng-1.2.5/ /usr/local/libpng
# cd /usr/local/libpng/
# cp scripts/makefile.linux ./makefile
# make test
# make install

3. gd-2.0.15 설치
# cd /usr/local/src; gzip -d gd-2.0.15.tar.gz; tar xvf gd-2.0.15.tar
# cd gd-2.0.15/
# ./configure –prefix=/usr/local/gd
# make
# make install

4. mrtg-2.10.5 설치
# cd ..; gzip -d mrtg-2.10.5.tar.gz; tar xvf mrtg-2.10.5.tar
# cd mrtg-2.10.5/
# ./configure –prefix=/usr/local/mrtg \
> –with-gd=/usr/local/gd \
> –with-z=/usr/local/zlib \
> –with-png=/usr/local/libpng
# make
# make install
./configure –help=short 이렇게 하시면.. 간단하게 옵션들 보실 수 있습니다.

5. /etc/snmp/snmp.conf 수정
mrtg를 운영하기 위해선 snmpd 가 돌고 있어야 합니다.
/etc/rc.d/snmpd start 해주세용..
ucd-snmp랑 net-snmp 두가지가 있다고 하는데.. 제 머신에는 net-snmp가 설치되어있습니다.
이 부분에 대해서 잘 아시는분은 좀 알려주세요~~
vi 로 파일을 열어서

####
# First, map the community name “public” into a “security name”
# sec.name source community
#com2sec notConfigUser default public
com2sec local servertnt.com dklee

이런 식으로 수정해주세요.
# /etc/rc.d/snmpd restart

6. mrtg.cfg 파일 만들기
# cd /usr/local/mrtg/bin
# mkdir /usr/local/mrtg/conf
# cfgmaker –global ‘WorkDir:/home1/mrtg/public_html’ \
> –global ‘Options[_]:bits,growright’ \
> –output /usr/local/mrtg/conf/mrtg.cfg \
dklee@servertnt.com

마지막 부분은 snmp.conf 에서 수정한 community와 host입니다.

7. crontab 에서 실행 설정
저는 아래와 같이 작업했습니다.. 참고만 하세요..

/root/bin/mrtg.sh 만들기

#!/bin/sh
env LANG=C /usr/local/mrtg/bin/mrtg /usr/local/mrtg/conf/mrtg.cfg

# crontab -u root -e
0/5 * * * * /root/bin/mrtg.sh

여기 까지 입니닷~~. /etc/snmp/snmp.conf 파일을 수정해도 mrtg.cfg 파일이 정상적으로
생성되지 않을 수 있다고 합니다. snmp.conf 이거 받으셔서 /etc/snmp/snmp.conf로
파일을 올리시고.. 원본파일은 snmp.conf.org 정도로 수정해 놓으세요.
아까 5번 부분에서 설명한 부분만 수정해서 다시 데몬을 올려보세요~~

이것도 영어다

kldp 블로그에 재미있는 글이 있어서.. 이곳에.. 헤에헤..

원문은 여기.. http://blog.kldp.org/node/view/722

Aoccdrnig to a rscheearch at an Elingsh uinervtisy, it deosn’t mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht frist and lsat ltteer is at the rghit pclae. The rset can be a toatl mses and you
can sitll raed it wouthit porbelm. Tihs is bcuseae we do not raed ervey lteter by it slef but the wrod as a wlohe.