nagios
Hiển thị các bài đăng có nhãn nagios. Hiển thị tất cả bài đăng

Giải pháp giám sát hạ tầng mạng miễn phí

Chào các bạn,

Tiếp theo loại bài về GIẢI PHÁP GIÁM SÁT HẠ TẦNG MẠNG MIỄN PHÍ với:

  • Nagios
  • PNP4nagios
  • Check_mk
  • ....
Trong bài viết này, tôi sẽ giới thiệu về việc Tích hợp các dữ liệu monitoring vào database.

Để thực hiện việc này, chúng ta sử dụng một addon có tên là NDOUtils
Sau đây là các bước tích hợp:

  • Cài đặt & cấu hình MySQL
  • Thay đổi các thông số kernel
  • Cài đặt và cấu hình ndoutils-2.1.3
  • Khai báo Ndoutils vào Nagios
  • Kiểm tra

how to install rrdtool 1.7.0 centos

Hệ thống monitoring Nagios (kết hợp check_mk, pnp4nagios) sử dụng rrdtool để vẽ biểu đồ thông tin hệ thống.


Trong một trường hợp tôi tình cờ phát hiện graph theo dõi băng thông trên một vài interfaces bị lỗi không thể hiển thị:


Sau khi kiểm tra, tôi đã fix lỗi thành công:


Nguyên nhân là do rrdtool v1.3.8 không tương thích với một vài tính năng trên Nagios core, check_mk core, pnp4nagio mới nhất.

Trong bài viết này, tôi chia sẻ các bước cài đặt rrdtool v1.7.0 (mới nhất hiện nay 2017.06.05).

Download rrdtool v1.7.0 : http://martybugs.net/linux/rrdtool/


Cài đặt các gói cần thiết: 
yum install glib
yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel 
yum install perl-devel
yum install perl-CPAN

./configure --disable-tcl
----------------------------------------------------------------
Config is DONE!
          With MMAP IO: yes
          With Locking: yes
       Build rrd_graph: yes
     Build rrd_restore: yes
       Static programs: no
          Perl Modules: perl-piped perl-shared
           Perl Binary: /usr/bin/perl
          Perl Version: 5.10.1
          Perl Options: PREFIX=/opt/rrdtool-1.7.0 INSTALL_BASE= LIB=/opt/rrdtool-1.7.0/lib/perl/5.10.1
          Ruby Modules:
           Ruby Binary: no
          Ruby Options: sitedir=/opt/rrdtool-1.7.0/lib/ruby
    Build Lua Bindings: no
    Build Tcl Bindings: no
 Build Python Bindings: no
        Build examples: yes
       Build rrdcached: yes
          Build rrdcgi: yes
       Build librrd MT: yes
           Use gettext: yes
           With libDBI: no
         With librados: no
          With libwrap: no
      With systemd dir:
             Libraries: -lpng -lm  -lglib-2.0   -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lxml2
Type 'make' to compile the software and use 'make install' to
install everything to: /opt/rrdtool-1.7.0.
       ... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.
                               -- Tobi Oetiker <tobi@oetiker.ch>
----------------------------------------------------------------


make
make install

TCL is disabled, as compilation of some of the TCL components for RRDTool 1.2.12 will otherwise fail on RedHat 9.
Run ./configure --help for more information on configuration options.

The default installation location is /usr/local/rrdtool-VERSION, so make some symbolic links to the executables:

ln -sf /opt/rrdtool-1.7.0/bin/rrdtool /usr/bin/rrdtool
ln -sf /opt/rrdtool-1.7.0/bin/rrdupdate /usr/bin/rrdupdate
ln -sf /opt/rrdtool-1.7.0/bin/rrdcgi /usr/bin/rrdcgi

The RRDTool Perl library simplifies things when using RRDTool from a Perl script, so to compile and install the Perl library for RRDTool:

make site-perl-install

----------------!
service nagios restart
service httpd restart
cmk -R 

Giải pháp giám sát hạ tầng mạng miễn phí với Nagios - update2

 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. :)

Giải pháp giám sát hạ tầng mạng miễn phí với Nagios - update1

 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 với Nagios core:

  •     Monitor your entire IT infrastructure
  •     Spot problems before they occur
  •     Know immediately when problems arise
  •     Share availability data with stakeholders
  •     Detect security breaches
  •     Plan and budget for IT upgrades
  •     Reduce downtime and business losses
 Trong bài viết này tôi chia sẻ các bước cập nhật hệ thống giám sát lên phiên bản mới nhất gồm các thành phần: Nagios core, nagios plugin check_mk, pnp4nagios:


Đầu tiên là chúng ta cần tải các file trên bỏ vào /tmp, sau đó tiến hành nâng cấp hệ thống:

Nagios Core 4:
tar xvzf nagios-4.3.1.tar.gz
cd nagios-4.3.1
./configure --with-command-group=nagcmd
make all
make install

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

service nagios restart

Nagios plugin:

tar xvzf nagios-plugins-2.1.4.tar.gz
cd nagios-plugins-2.1.4
./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
make
make install
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart

Check_MK:
tar xvzf check_mk-1.2.8p18.tar.gz
cd check_mk-1.2.8p18
./setup
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service httpd restart
service nagios restart
cmk -R

Hoàn thành quá trình nâng cấp Nagios core, nagios plugin, check_MK.

Chúc các bạn thành công.

Bài viết tiếp theo tôi sẽ hướng dẫn nâng cấp PNP4NAGIOS - một add-on  tuyệt vời cho Nagios, dựa vào RRD (Round Robin Databases) để thu thập dữ liệu, từ đó view những dữ liệu thu thập được thành chart/graph cho người quản trị có cái nhìn trực quan hơn về các host/service trong hệ thống.



Giải pháp giám sát hạ tầng mạng với Nagios core

Nhân tiện đang nâng cấp hệ thống giám sát hạ tầng mạng cho khách hàng nên tôi cập nhật lại bài viết "IT Infrastructure Monitoring" trước đây từng chia sẻ trên http://www.lecuong.info, http://blog.banbeit.com và một số site khác.
Tham khảo các bài viết cũ tại:

Bài viết này sẽ giới thiệu thêm và hướng dẫn nâng cấp hệ thống giám sát trên nền tảng Nagios lên phiên bản mới nhất.


Với Nagios Core (open source) hoàn toàn miễn phí, chúng ta có thể làm được rất nhiều thứ:
  • System Monitoring: complete monitoring of desktop and server operating systems – including system metrics, service states, process states, performance counters, event logs, applications (IIS, Exchange, Apache, MySQL, etc), and services (Active Directory, DHCP, Sendmail, etc). Nagios supports monitoring of Windows, Linux, Unix, Solaris, AIX, HP-UX, and Mac OS/X operating systems.
  • Protocol Monitoring (SNMP, HTTP, SSH, FTP, SMTP, Protocol TCP/UDP)....: complete monitoring of network protocols – including TCP/IP and UDP protocols. Implementing effective network protocol monitoring with Nagios offers increased server, services, and application availability, as well as fast detection of network outages and protocol failures.
  • Application Monitoring: complete monitoring of applications and application state – including Windows applications, Linux applications, Unix applications, and Web applications. Implementing effective application monitoring with Nagios offers the following benefits: increased server, services, and application availability, fast detection of network outages and protocol failures, and fast detection of failed services, processes and batch jobs.
  • Database Monitoring: complete monitoring of database servers and databases – including availability, database and table sizes, cache ratios, and other key metrics. Implementing effective database monitoring with Nagios offers increased application availability, increased database performance, fast detection of database outages, failures, and table corruption, predictive analysis of storage requirements and index performance.
  • Log Monitoring
  • Bandwidth Monitoring
----------

Một số hình ảnh về hệ thống giám sát phiên bản nâng cấp:

Tối ưu hóa hiệu suất hệ thống, tốn ít tài nguyên:



Giao diện trực quan, theo dõi & report chi tiết hơn:




Theo dõi chi tiết thông tin thiết bị mạng:


Theo dõi chi tiết trạng thái process:


Các bạn quan tâm, có thể tham khảo thêm về Nagios tại đây.


Trong bài viết tiếp theo, tôi sẽ hướng dẫn nâng cấp hệ thống Nagios cũ lên phiên bản mới. :)