= System Monitoring With Nagios HowTo = [[TableOfContents]] == Nagios System Software Environment == * nagios * nagios-plugin * nagiosweb * apache * php * mysql, php-mysql * net-snmp, net-snmp-utils, net-snmp-libs * net-snmp-perl, perl-Net-SNMP * perl * perl-usd-snmp * freedts == Contact Info == nagios 설치 매뉴얼로 만든 것인데 올려봅니다. 틀린점있으시면 메일 주세요 :) 심승준 ( ftfuture at hitel.net) == INSTALL == === OS Setting.. === * fedora core5 linux 설치 * gcc, g++ 설치 * apache, php, mysql 설치 * net-snmp, net-snmp-utils, net-snmp-libs 설치 * net-snmp-perl, perl-Net-SNMP(yum upgrade 이후 설치가능) 설치 * perl 설치 * perl-ucd-snmp 설치 * gd 설치 * php-mysql 설치 ' * 팁 : yum install '패키지이름' 으로 설치한다. ' * 설치후 yum upgrade 로 시스템을 업데이트 한다. === nagios install === * nagios.org 에서 nagios를 다운로드 받는다. (wget http://jaist.dl.sourceforge.net/sourceforge/nagios/nagios-2.3.1.tar.gz) * 압축을 푼후 nagios 디렉토리로 이동 * shell에서 ./configure --with-nagios-group=apache 실행 * 한글 패치 - Conatact name, Service Name등에 한글쓰면 에러가 나는데.. 이것을 패치한다. base/util.c 를 연다. int contains_illegal_object_chars(char *name){ ... register unsigned int ch; (unsigned 를 추가한다.) * make all * make install * make install-config * make install-init * make install-commandmode * "nagios root directory"/etc/sample-config/httpd.conf 파일을 "apache cfg directory"/conf.d/nagios.conf 로 symbolic link 설정 (sample-config가 없을경우 소스 디렉토리에서 복사한다.) * htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (새로생성, 추가시에는 -C옵션을 뺀다.) * 주의 : iptables가 설정되어있으면 끈다. * 주의 : selinux 주의 === nagios-plugin install === * nagios.org 에서 nagios-plugin을 다운로드 받는다. (wget http://jaist.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.3.tar.gz) * nagios-plugins 디렉토리로 이동한다. * ./configure --with-nagios-group=apache 실행 * make 실행 * make install 실행 * 루트 계정에서 make install-root 실행 === external nagios-plugin install === * www : http://www.nagiosexchange.org/SNMP.51.0.html * check_snmp_load.pl (http://www.nagiosexchange.org/SNMP.51.0.html?&tx_netnagext_pi1[p_view]=51&tx_netnagext_pi1[page]=30%3A10) * check_snmp_mem.pl (http://www.nagiosexchange.org/SNMP.51.0.html?&tx_netnagext_pi1[p_view]=52&tx_netnagext_pi1[page]=40%3A10) * check_snmp_storage.pl (http://www.manubulon.com/nagios/) === nagiosweb install === * www : http://sourceforge.net/projects/nagiosweb/ * nagiosweb2-1.3.tar.gz을 다운받는다. (wget http://jaist.dl.sourceforge.net/sourceforge/nagiosweb/nagiosweb2-1.3.tar.gz) * nagiosweb 폴더로 이동 * 웹폴더인 nagiosweb 폴더를 웹루트로 복사(예 : /var/www/html) * mysql에 nagiosweb 데이터베이스 생성(예: mysqladmin -u root -p create nagiosweb) * mysql에 nagios 사용자 생성, nagioweb DB에 대한 권한 부여 #> mysql -u root -p grant all on nagiosweb.* to nagios@localhost identified by 'password'; flush privileges; * nagiosweb.sql의 내용을 nagiosweb DB에 입력(예: mysql -u nagios -p nagiosweb < nagiosweb.sql) * dbconfig.php 수정.. 웹폴더에 있음(예: /var/www/html/nagiosweb/dbconfig.php) $db = mysql_connect("localhost", "사용자명", "패스워드 "); <----- 사용자명과 패스워드 수정 * nagios 기본폴더(예: /usr/local/nagios/share/side.html) share/side.html 수정.. README 파일 참조 {{{ Configuration table 아래에 추가한다. Hosts Ho st Groups Serv ices Service Groups Cont acts Contact Groups T ime Periods Check Commands Notif y Commands Write Config }}} * 참고 : php.ini 에 register_globals 옵션을 On 시킨다. * 참고 : service group 지정문제는 nagios-*.sql 상위 버젼도 적용시키면 해결된다. === perl & perl-usd-install === *http://www.manubulon.com/nagios/faq.html#FAQ1 참조 *Net::SNMP 모듈 설치 *sms를 위한 python sybase 모듈 설치 (http://www.python.or.kr/pykug/freetds) === 참고:freedts install(python으로 mssql디비에 접근하실때 설치) === 참고: sms 전송시 mssql db를 사용하는 경우에 한해 설정한다. 다른 방법일 경우 다르게 설정 export SYBASE=/usr/local/freetds 환경변수 설정 가. FreeTDS 설치 1. ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz 다운로드 2. ./configure --prefix=/usr/local/freetds && make && make install 3. freetds.conf DSN을 적절히 수정 4. /etc/ld.so.conf에 /usr/local/freetds/lib 추가 그리고 ldconfig 나. Sybase Module for python 설치 1. http://www.object-craft.com.au/projects/sybase/ 2. python setup.py build_ext -D HAVE_FREETDS -U WANT_BULKCOPY install (redhat의 경우 python-devel 패키지가 설치되어 있어야 한다) \ === linux snmp configuration === * snmpd 설치 * /etc/snmp/snmpd.conf 수정 * 기본설정 수정 (syslocation, syscontact, sysservice ..) 매뉴얼 참조 * Access Control Setup 항목을 수정한다.(중요!) {{{ # rwuser: a SNMPv3 read-write user # arguments: user [noauth|auth|priv] [restriction_oid] rwuser snmpuser noauth # # Unknown directives read in from other files by snmpconf # com2sec local localhost private com2sec local1 127.0.0.1 public com2sec mynetwork 192.168.2.21 public com2sec mynetwork 192.168.2.23 public # 커뮤니티네임과 시큐리티네임을 정한다. # First, map the community name "public" into a "security name" # sec.name source community com2sec notConfigGroup default public # Second, map the security name into a group name; # groupName securityModel securityName group notConfigGroup v1 public group notConfigGroup v2c public }}} * snmpd 를 시작한다. === windows snmp configuration === * snmp service 를 설치하고 시작한다. * 속성창을 연다. '''attachment:snmp_security.png''' * 커뮤니티 이름과 snmp에 접근할수 있는 ip를 입력한다. == Configuration == * Hosts : 모니터링할 서버에 대한 정보를 관리한다. * Host Groups : 모니터링 할 서버를 그룹별로 관리한다. * Services : 모니터링할 서버에 감시할 서비스를 관리한다. * Service Groups : 감시할 서비스를 그룹별로 관리한다. * Contacts : 관리자들의 이메일, SMS등 연결정보를 관리한다. * Contact Groups : contact 데이터를 그룹별로 관리한다. * Time Periods : 감시할 시간대를 관리한다. * Check Commands : 서비스를 감시하는 명령들을 관리한다. * Notify Commands : 관리자들에게 이벤트를 통보하는 명령들을 관리한다. * Write Config : 설정을 mysql DB에 저장, 복원 혹은 nagios configuration 파일에 쓴다. == Structure == '''attachment:nagios_monitoring_structure.png''' == 사용법 설명 == == 관련 자료 == * nagios : http://www.nagios.org * nagios-web : http://nagiosweb.sourceforge.net * NAS - Network Audio System * rplay project * freetds : http://database.sarang.net/database/freetds/freetds.html , http://database.sarang.net/database/freetds/faq/faq.html http://www.freetds.org , http://www.python.or.kr/pykug/freetds