질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

NetSaint

작성자 정보

  • 관리자 작성
  • 작성일

컨텐츠 정보

본문

NetSaint

t.gif
t.gif
NetSaint는 모니터링도구이다.
일부는 이것을 보안툴이라고 하는데, 그렇게 우기고 싶으면 본인은 할 말없다.
본인(전두환같군..)이 보기에는 공짜로 제공되는 시스템 모니터링도구중 이렇게 훌륭한 툴은
거의 없을 것 같다. 간단히, NetSaint로 할 수 있는 것은 다음과 같다.

일단 어떻게 생긴 놈인지 직관적인 예제가 있다.
NetSaint에 대한 ScreenShot을 보면 대충 어떤 프로그램인지 알 수 있을 것이다.
네트웍 서비스 모니터링(SMTP, POP3, HTTP, NNTP, PING, etc.)
서버의 리소스 모니터링(processor load, disk and memory usage, running processes, log files, etc.)
심플한 플러그인 설계(사용자들이 그들만의 서비스에 대한 체크를 쉽게 할 수 있게 한다.)
병렬화된 서비스 체크
parent호스트를 사용해 네트웍 호스트 구조를 정의, 호스트가 다운/Unreachable된 것을 감지
서비스나 서버에 문제가 발생했을때 알림(삐삐,메일,..)
서로 다른 그룹을 지정하여 서비스,서버의 상태를 escalation
서비스,호스트에 이상발생시 미리 정의된 해결방법에 대한 이벤트핸들러 지정
자동적인 로그 rotation(오라클의 로그 스위치가 생각나죠?)
서버에 대한 중복/분산된 모니터링 지원
현재 네트웍의 status, notification, problem history, 로그파일등을 웹을 통해 볼 수 있음
웹을 통해 모니터링시 사용자에 대한 심플한 인증방법제공
프로그램 재시작에도 호스트/서비스의 상태 보유

NetSaint 설치
NetSaint는 www.netsaint.org에서 구할 수 있다.
현재 netsaint는 여기에서 배포되고 있으나, netsaint-plug은 SourceForge에서 진행되고 있다.
2001년 6월 20일 현재 최신버전은 0.0.7b5(http://www.netsaint.org/download/netsaint-0.0.7b5.tar.gz)이다.

netsaint유저등록
mkdir /usr/local/netsaint
adduser -d /usr/local/netsaint
chown -R netsaint /usr/local/netsaint

netsaint 컴파일&설치
./configure         (configure netsaint)
make all            (compile netsaint)
make install        (install binaries and html)
make install-config (install cfg file)
make install-init   (runlevel 에 netsaint 추가, 데몬으로 하려면 make install-daemon)

[root@ns netsaint-0.0.7b5]# cd /usr/local/netsaint/
[root@ns netsaint]# l
total 5
drwxrwxr-x    2 netsaint netsaint     1024 Jun 18 17:23 bin/
drwxrwxr-x    2 netsaint netsaint     1024 Jun 19 01:14 etc/
drwxrwxr-x    2 netsaint netsaint     1024 Jun 18 17:23 sbin/
drwxrwxr-x    6 netsaint netsaint     1024 Jun 18 17:23 share/
drwxrwxr-x    3 netsaint netsaint     1024 Jun 18 17:23 var/


Sub-Directory   Contents
bin/            NetSaint core program
etc/            Main, host, resource, and CGI configuration files (netsaint.cfg, hosts.cfg, resource.cfg, and nscgi.cfg respectively)
sbin/           CGIs
share/          HTML files (for web interface and online documentation)
var/            Empty directory for the log file

NetSaint Plugin 설치

netsaint가 제 기능을 하기 위해서 plugin을 설치해 줘야 한다.
이전 버전에는 netsaint와 통합되어있었으나, 현재는 분리되어 있다.
현재 플러그인은 소스포지에서 별도로 진행된다.
plugin은 보통 libexec디렉토리에 설치된다.

현재(2001/06/19) 버전은 다음과 같다.
http://prdownloads.sourceforge.net/netsaintplug/netsaint-plugins-1.2.9-4.tar.gz

[root@ns netsaint-plugins-1.2.9-4]# ./configure
[root@ns netsaint-plugins-1.2.9-4]# make all; make install


NetSaint 설정
웹인터페이스를 위한 설정
아파치의 설정파일 httpd.conf에 다음과 같이 netsaint를 위한 Alias를 추가후, 아파치 restart
    
    Alias /icons/ "/usr/local/apache/icons/"
    Alias /netsaint/ "/usr/local/netsaint/share/"

    <Directory "/usr/local/apache/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    <Directory "/usr/local/apache/icons">
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>
    
    ScriptAlias /cgi-bin/netsaint/ "/usr/local/netsaint/sbin/"
    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

    <Directory "/usr/local/netsaint/sbin">
        AllowOverride AuthConfig
        Options ExecCGI
        Order allow,deny
        Allow from all
    </Directory>

    <Directory "/usr/local/apache/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
        
위와 같이 하면, http://dbakorea.pe.kr/netsaint/로 /usr/local/netsaint/share/로 접근할 수 있다.
참고)만일 도메인부분이 redirect되는 주소라면, 이 사항은 적용되지 않는다.


Authentication

다음과 같은 .htaccess파일을 /usr/local/netsaint/share, /usr/local/netsaint/sbin에 두고,
패스워드를 설정한다. 이를 위해선 nscgi.cfg파일에 use_authentication=1로 되어 있어야 한다.

AuthName "NetSaint Access"
AuthType Basic
AuthUserFile /usr/local/netsaint/etc/htpasswd.users
require valid-user

[netsaint@ns etc]$ /usr/local/apache/bin/htpasswd -c /usr/local/netsaint/etc/htpasswd.users netsaintadmin


netsaint의 설정은 주요한 3가지 파일로 구성된다.

main(netsaint.cfg) 매뉴얼
메인설정파일, 설정사항은 이 파일부터 시작하여 나머지 설정파일등을 지정하는 역활을 한다.
디폴트 상태로 사용했다.

host(hosts.cfg) 매뉴얼
hosts, host groups, contacts, contact groups, commands, time periods, and services을 정의
이 파일에서 실제 설정을 할 일이 많을 것이다.

명규가 수정한 사항
TIME PERIOD CONFIGURATION: 디폴트 사용

HOST CONFIGURATION: 예제를 주석 처리하고 다음줄 하나만 설정
host[dbakorea]=DBAKOREA Server;dbakorea.pe.kr;;check-host-alive;10;120;24x7;1;1;1;

HOST GROUP CONFIGURATION: 역시 예제들은 주석처리하고 다음줄 하나만 설정
hostgroup[linux-boxes]=All Linux Servers;linux-admins;dbakorea

COMMAND CONFIGURATION: 디폴트 사용

CONTACT CONFIGURATION: 예제들은 주석처리 다음줄들 설정
contact[netsaint]=Netsaint User;24x7;24x7;1;1;1;1;1;1;notify-by-email;host-notify-by-email;netsaint;
contact[kang]=kang myung gyu;workhours;workhours;1;1;0;1;1;0;notify-by-email;host-notify-by-email;kang@dbakorea.pe.kr;

CONTACT GROUP CONFIGURATION: 예제들은 주석처리 다음줄들 설정
contactgroup[linux-admins]=Linux Administrators;netsaint,kang

SERVICE CONFIGURATION: 예제들은 주석처리 다음줄들 설정
service[dbakorea]=PING;0;24x7;3;5;1;linux-admins;240;24x7;1;1;0;;check_ping
service[dbakorea]=HTTP;0;24x7;3;2;1;linux-admins;240;24x7;1;1;1;;check_http
service[dbakorea]=Current Users;0;24x7;3;5;2;linux-admins;240;24x7;1;1;1;;check_users!75!150
service[dbakorea]=Zombie Processes;0;24x7;3;5;2;linux-admins;240;24x7;1;1;1;;check_procs!5!10!Z
service[dbakorea]=Total Processes;0;24x7;3;5;2;linux-admins;240;24x7;1;1;1;;check_procs!150!200
service[dbakorea]=Drive Free Space;0;24x7;3;5;1;linux-admins;120;24x7;1;1;1;;check_disk!/dev/hda2

나머지 부분 변경없음


CGI(nscgi.cfg) 매뉴얼
웹인터페이스에서 사용되는 설정
실제 웹을 통해 관리할 때 중요한 설정들이 있으므로 웹을 사용한다면, 꼭! 잘 봐둬야 한다.
보안을 위해서인지 CGI설정들이 디폴트로 주석처리되어 있어서 이를 자신의 환경에 맞게 설정해준다.

명규가 수정한 사항
PROCESS CHECK COMMAND: 보통 주석처리만 해제해 주면 된다.(check_netsaint)
netsaint_check_command=/usr/local/netsaint/libexec/check_netsaint /usr/local/netsaint/var/status.log 5 '/usr/local/netsaint/bin/netsaint'

SYSTEM/PROCESS INFORMATION ACCESS: 말그대로 시스템/프로세스에 대한 정보에 접근할 수 있는 사용자를 지정한다.(extinfo.cgi)
authorized_for_system_information=netsaintadmin

CONFIGURATION INFORMATION ACCESS: hosts.cfg, commands.cfg등의 설정파일의 정보를 볼 수 있는 사용자 지정
authorized_for_configuration_information=netsaintadmin

SYSTEM/PROCESS COMMAND ACCESS: command CGI(cmd.cgi)를 통해 NetSaint에게 명령의 shutdown, restart를 할 수 있는 사용자 지정
authorized_for_system_commands=netsaintadmin

GLOBAL HOST/SERVICE VIEW ACCESS: 모니터링되고 있는 서비스, 서버의 리스트를 볼수 있는 사용자 지정
authorized_for_all_services=netsaintadmin
authorized_for_all_hosts=netsaintadmin

GLOBAL HOST/SERVICE COMMAND ACCESS: 모니터링되고 있는 모든 서비스,서버에 대해 command CGI(cmd.cgi)를 통해 서버/서비스에 관련된 명령에를 실행할 수 있는 사용자 지정
authorized_for_all_service_commands=netsaintadmin
authorized_for_all_host_commands=netsaintadmin

# EXTENDED HOST INFORMATION: 서버의 위치를 그래픽으로 쉽게 파악할 수 있게 한다.(statusmap and statuswrl CGIs), 3D로 보기위해선 VRML plugin이 필요하다
hostextinfo[dbakorea]=http://dbakorea.pe.kr/serverinfo.html;linux40.gif;linux40.jpg;linux40.gd2;Linux Intel Server Kernel 2.4.4;100,50;3.5,0.0,-1.5;

나머지 부분 변경없음


추가적인 설정파일
commands(commands.cfg)
* hosts.cfg파일의 commands부분을 별도관리한다.(필수사항은 아니고 권장사항임)
디폴트 상태로 사용했다.

resource(resource.cfg)
plugin, eventhandler에 대한 경로를 지정한다. commands.cfg파일에서 참조한다.
디폴트 상태로 사용했다.


설정시 주의사항
주석은 #, 설정은 라인의 1번째 컬럼부터 해야 함, 대소문자 가림

설정 검사
[netsaint@ns bin]$ ./netsaint -v ../etc/netsaint.cfg

실행
포그라운드로 실행
[netsaint@ns bin]$ ./netsaint ../etc/netsaint.cfg
데몬으로 실행
[netsaint@ns bin]$ ./netsaint -d ../etc/netsaint.cfg

실행상태
netsaint홈/var/netsaint.log에 로그가 저장된다.
netsaint홈/var/status.log에는 현재 모니터링되고 있는 것들을 표시한다.

모니터링
브라우저에서 http://dbakorea.pe.kr/netsaint/주소로 간다.
dbakorea.pe.kr부분은 자신의 도메인 부분으로 변경해야 한다.
Authentication을 걸어두었으므로 모니터링은 암호없인 볼수 없다.

컴퓨터 다운시 예제
컴퓨터가 다운다면 hosts.cfg에서 지정한 메일주소로 메일이 날라온다.
실제 서버를 다운시키고 난 뒤, 전송된 메일은 다음과 같다.

***** NetSaint 0.0.7 *****

Notification Type: PROBLEM
Host: dbakorea
State: DOWN
Address: dbakorea.pe.kr
Info: CRITICAL - Plugin timed out after 10 seconds

Date/Time: Wed Jun 20 14:38:17 KST 2001

This article comes from dbakorea.pe.kr (Leave this line as is)

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,032 명
  • 현재 강좌수 :  35,772 개
  • 현재 접속자 :  128 명