[Linux] Nagios 모니터링 결과값 그래프 생성 (nagiosgraph)

   조회 396   추천 0    

http://ehostidc.co.kr/center/EH050402.php?no=141532&page=7&choose=tit… (22)
https://blog.naver.com/goethe1/221642889788 (8)

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. 결과 확인








www.ehostidc.co.kr ( 이호스트ICT )
짧은글 일수록 신중하게.




PDS
제목Page 1/57
2015-12   12184   백메가
2014-05   2828858   정은준1
16:31   71   무한도전
09-21   118   무한도전
09-20   144   무한도전
09-19   174   무한도전
09-18   291   무한도전
09-17   299   무한도전
09-17   243   광주까나리
09-16   249   무한도전
09-13   419   무아
09-16   195   FOXBI
09-10   423   무한도전
09-09   397   무한도전
09-07   485   스캔l민현기
09-06   414   무한도전
09-06   395   유정호샤콘느
09-04   524   무한도전
09-04   416   김황중
09-03   476   무한도전
08-31   790   앙드레준
08-30   573   무한도전