[Linux] Nagios ¸ð´ÏÅ͸µ °á°ú°ª ±×·¡ÇÁ »ý¼º (nagiosgraph)

   Á¶È¸ 6262   Ãßõ 0    

http://ehostidc.co.kr/center/EH050402.php?no=141532&page=7&choose=tit¡¦ (312)
https://blog.naver.com/goethe1/221642889788 (292)

1. 목적 : Nagios 모니터링은 모니터링과 모니터링 알람만 설정

해당 결과값을 그래프로 기록 되도록 추가 모듈 설치

2. 프로그램 설치

a. 프로그램 다운로드

[root@nagios opt]# yum -y install perl-GD php-gd rrdtool-perl rrdtool-php rrdtool perl-CGI perl-Time-HiRes

[root@nagios opt]# wget https://sourceforge.net/projects/nagiosgraph/files...

[root@nagios opt]# tar -zxvpf nagiosgraph-1.5.2.tar.gz

[root@nagios opt]# cd ./nagiosgraph-1.5.2

b. 프로그램 의존성 확인

[root@nagios nagiosgraph-1.5.2]# ./install.pl --check-prereq

checking required PERL modules
Carp...1.26
CGI...3.63
Data::Dumper...2.145
Digest::MD5... ***FAIL***
File::Basename...2.84
File::Find...1.20
MIME::Base64...3.13
POSIX...1.30
RRDs...1.4008
Time::HiRes...1.9725
checking optional PERL modules
GD...2.49
Nagios::Config... ***FAIL***
checking nagios installation
found nagios exectuable at /usr/sbin/nagios
checking web server installation
found apache executable at /usr/sbin/httpd

*** one or more problems were detected!

c. 의존성 패키지 설치

[root@nagios nagiosgraph-1.5.2]# yum install perl-Digest-MD5 perl-Nagios-Plugin perl-CPAN

[root@nagios nagiosgraph-1.5.2]# perl -MCPAN -e shell

cpan[4]> install Module::Build
Running install for module "Module::Build"
Running make for L/LE/LEONT/Module-Build-0.4224.tar.gz
Fetching with HTTP::Tiny:
http://mirror.intergrid.com.au/cpan/authors/id/L/L...
Fetching with HTTP::Tiny:
http://mirror.intergrid.com.au/cpan/authors/id/L/L...
Checksum for /root/.cpan/sources/authors/id/L/LE/LEONT/Module-Build-0.4224.tar.gz ok
---- Unsatisfied dependencies detected during ----

cpan[4]> install Nagios::Config

d. 프로그램 설치

[root@nagios01 nagiosgraph-1.5.2]# ./install.pl --layout overlay --prefix /usr/local/nagiosgraph

configuration:
ng_prefix /usr/local/nagiosgraph
ng_etc_dir /etc/nagios/nagiosgraph/
ng_bin_dir /usr/local/nagiosgraph/libexec
ng_cgi_dir /usr/local/nagiosgraph/sbin
ng_doc_dir /usr/local/nagiosgraph/docs/nagiosgraph
ng_examples_dir /usr/local/nagiosgraph/docs/nagiosgraph/examples
ng_www_dir /usr/local/nagiosgraph/share
ng_util_dir /usr/local/nagiosgraph/docs/nagiosgraph/util
ng_var_dir /var/nagios
ng_rrd_dir /var/nagios/rrd
ng_log_dir /var/nagios
ng_log_file /var/nagios/nagiosgraph.log
ng_cgilog_file /var/nagios/nagiosgraph-cgi.log
ng_url /nagiosgraph
ng_cgi_url /nagiosgraph/cgi-bin
ng_css_url /nagiosgraph/nagiosgraph.css
ng_js_url /nagiosgraph/nagiosgraph.js
nagios_cgi_url /nagios/cgi-bin
nagios_perfdata_file /tmp/perfdata.log
nagios_user nagios
www_user apache
modify_nagios_config n
nagios_config_file 
nagios_commands_file 
modify_apache_config y
apache_config_dir /etc/httpd/conf.d
apache_config_file 
Continue with this configuration? [y] y

3. 환경설정 파일 수정

a. /etc/nagios/nagios.cfg 파일에 설정 추가

# process nagios performance data using nagiosgraph
process_performance_data=1
service_perfdata_file=/tmp/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph

b. /etc/nagios/objects/commands.cfg 설정 추가

# command to process nagios performance data for nagiosgraph
define command {
command_name process-service-perfdata-for-nagiosgraph
command_line /usr/local/nagiosgraph/libexec/insert.pl
}

c. /etc/nagios/objects/templates.cfg

define service {
name graphed-service
action_url /nagios/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$" onMouseOver="showGraphPopup(this)" onMouseOut="hideGraphPopup()" rel="/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+450+-j
register 0
}

d. client 호스트 파일에 해당 서비스 적용

- 그래프를 원하는 모든 서비스에 추가 필요

define service{
use generic-service,graphed-service ; Name of service template to use
host_name ehostidc.co.kr
service_description Current User
check_command check_nrpe!check_users!5!10
}

e. httpd 설정

[root@nagios conf.d]# vi /etc/httpd/conf.d/nagios.conf 

# enable nagiosgraph CGI scripts
ScriptAlias /nagiosgraph/cgi-bin "/usr/local/nagiosgraph/sbin/"

Options ExecCGI
AllowOverride None
= 2.3>

Require all granted
# Require host 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user



Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user


# enable nagiosgraph CSS and JavaScript
Alias /nagiosgraph "/usr/local/nagiosgraph/share"

Options None
AllowOverride None
= 2.3>

Require all granted
# Require host 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user



Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user


f. nagios 설정 파일 확인

[root@nagios nagios]# nagios -v /etc/nagios/nagios.cfg

4. 결과 확인








https://www.aiocp.co.kr/ ( 딥러닝,머신러닝 서버 판매 ,컨설팅) https://bigbangcloud.co.kr/ ( GPU 클라우드 서비스) ::: AI 서버의 모든것 ::: 인공지능의 시작~ (주)이호스트ICT
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.


PDS
Á¦¸ñPage 22/77
2015-12   1556493   ¹é¸Þ°¡
2014-05   5021152   Á¤ÀºÁØ1
2013-12   68721   ¿ÀÀçÈ£
2018-01   23254   ¶Ç¸®±º
2013-12   40102   ÇöÁø
2014-05   29899   inoree
2018-01   18382   ¶Ç¸®±º
2013-12   26674   ±èȲÁß
2018-01   25836   catstyle
2013-12   19072   ȲÁø¿ì
2014-01   18454   ¾Æ¸§´Ù¿î³ëÀ»
2014-01   19257   theÃ̳ð
2014-01   21713   ±èȲÁß
2014-01   37237   ±èȲÁß
2014-01   38425   ȸ¿øK
2014-01   41319   stone92±è°æ¹Î
2014-01   40607   ±èȲÁß
2014-01   70938   ±èȲÁß
2014-01   63264   ȸ¿øK
2014-01   54822   ȸ¿øK
2014-01   53726   ¿¥ºê¸®¿À
2014-01   51219   ±èȲÁß