CẬP NHẬT NAGIOS CORE, NAGIOS PLUGIN CHECK_MK, PNP4NAGIOS
Chào các bạn,
Tiếp theo bài giới thiệu về "Giải pháp giám sát hạ tầng mạng miễn phí với Nagios - update1".
Trong bài viết nà, tôi sẽ hướng dẫn update PNP4NAGIO và kiểm tra lại các thông số cấu hình để thu thập dữ liệu tạo chart/graph
1/ Tải file: https://sourceforge.net/projects/pnp4nagios/files/latest/download?source=files
2/ Quăng file pnp4nagios-0.6.25.tar.gz vào /tmp
3/ Thực hiện update:
cd /tmp
tar xvxf pnp4nagios-0.6.25.tar.gz
cd pnp4nagios-0.6.25
./configure
make all
make fullinstall
*** Configuration summary for pnp4nagios-0.6.25 03-01-2015 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.3.8
RRDs Perl Modules: FOUND (Version 1.3008)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options:
------------------------- -------------------
HTML URL: http://localhost/pnp4nagios
Apache Config File: /etc/httpd/conf.d/pnp4nagios.conf
*** Main program, Scripts and HTML files installed ***
Enjoy.
[root@vnsysadmin.com pnp4nagios-0.6.25]#
Kiểm tra thử url sau xem chạy không: http://<ip>/pnp4nagios/graph
Nếu mọi thứ OK hết thì xóa file cài đặt:
rm -rf /usr/local/pnp4nagios/share/install.php
4/ Kiểm tra lại các file cấu hình:
Bước này cực kỳ quan trọng:
Verify config:
# wget http://verify.pnp4nagios.org/verify_pnp_config
# perl verify_pnp_config --mode bulk --config=/usr/local/nagios/etc/nagios.cfg --pnpcfg=/usr/local/pnp4nagios/etc
Nếu như thông báo như trên thì lỗi rồi đấy ^^!
5/ Sửa các thông số trên Nagios để cho phép pnp4nagios thu thập dữ liệu:
vim /usr/local/nagios/etc/nagios.cfg
process_performance_data=1
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$
host_perfdata_file_mode=a
service_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
service_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
service_perfdata_file_processing_command=process-service-perfdata-file
vim /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name process-service-perfdata-file
command_line $USER1$/process_perfdata.pl --bulk=/usr/local/nagios/var/serviceperfdata
}
define command{
command_name process-host-perfdata-file
command_line $USER1$/process_perfdata.pl --bulk=/usr/local/nagios/var/hostperfdata
}
vim /usr/local/nagios/etc/objects/templates.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
define host {
use linux-server,host-pnp
host_name ubuntu
alias ubuntu
address 127.0.0.1
}
define service {
use local-service,srv-pnp
host_name ubuntu
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
cp /usr/local/pnp4nagios/etc/rra.cfg-sample /usr/local/pnp4nagios/etc/rra.cfg
service nagios restart.
Chúc các bạn thành công. :)