Otu esi etinye Nagios 4.4.5 na RHEL/CentOS 8/7 na Fedora 30


Nagios bụ ngwa nleba anya Open Source, ọ na-enye gị gburugburu nleba anya zuru oke ka ị na-elele igwe/netwọkụ gị niile ma ị nọ na ebe data gị ma ọ bụ naanị obere ụlọ nyocha gị.

Site na Nagios, ị nwere ike nyochaa ndị ọbịa gị dịpụrụ adịpụ na ọrụ ha na otu windo. Ọ na-egosi ịdọ aka ná ntị ma na-egosi ma ọ bụrụ na ihe adịghị mma na sava gị nke na-emecha nyere anyị aka ịchọpụta nsogbu ụfọdụ tupu ha emee. Ọ na-enyere anyị aka ibelata oge ezumike na mfu azụmahịa.

N'oge na-adịbeghị anya, Nagios wepụtara ụdị ọhụrụ ya Nagios Core 4.4.5 yana ntọhapụ kwụsiri ike kachasị ọhụrụ nke Nagios plugins 2.2.1 na Ọgọst 20, 2019.

Ezubere isiokwu a iji duzie gị ntuziaka dị mfe maka otu esi etinye Nagios Core 4.4.5 kachasị ọhụrụ sitere na isi mmalite (tarball) na RHEL 8/7/6, CentOS 8/7/6 na Fedora 26-30 nkesa.

N'ime nkeji 30 ị ga-enyocha igwe mpaghara gị, ọ nweghị usoro nrụnye dị elu naanị nrụnye bụ isi nke ga-arụ ọrụ 100% na ọtụtụ sava Linux taa.

Biko mara: Edere ntuziaka nwụnye na ebe a dabere na nkesa Linux CentOS 7.5.

Ịwụnye Nagios 4.4.5 na Nagios Plugin 2.2.1

Ọ bụrụ na ịgbaso ntuziaka ndị a nke ọma, ị ga-ejedebe na ozi ndị a.

  1. A ga-etinye Nagios na plugins ya n'okpuru /usr/local/nagios directory.
  2. A ga-ahazi Nagios ka ọ nyochaa ọrụ ole na ole nke igwe mpaghara gị (Usage Disk, Load CPU, User Current, Total Processes, wdg)
  3. Nagios webụ interface ga-adị na http://localhost/nagios

Anyị kwesịrị ịwụnye Apache, PHP na ụfọdụ ọba akwụkwọ dị ka gcc, glibc, glibc-common na GD ọba akwụkwọ na mmepe ya tupu etinye Nagios 4.4.5 na isi iyi. Na ime otú ahụ, anyị nwere ike iji yum ndabere ngwugwu installer.

 yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp

-------------- On Fedora -------------- 
 dnf install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp

Mepụta onye ọrụ nagios ọhụrụ site na iji useradd iwu na akaụntụ otu nagcmd wee tọọ paswọọdụ.

 useradd nagios
 groupadd nagcmd

Na-esote, tinye ma onye ọrụ nagios na onye ọrụ apache na otu nagcmd site na iji iwu usermod.

 usermod -G nagcmd nagios
 usermod -G nagcmd apache

Mepụta ndekọ maka nrụnye Nagios gị yana nbudata ya niile n'ọdịnihu.

 mkdir /root/nagios
 cd /root/nagios

Ugbu a budata Nagios Core 4.4.5 kacha ọhụrụ yana ngwugwu Nagios plugins 2.2.1 nwere iwu wget.

 wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
 wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

Anyị kwesịrị iji iwu tar wepụta ngwugwu ebudatara dị ka ndị a.

 tar -xvf nagios-4.4.5.tar.gz
 tar -xvf nagios-plugins-2.2.1.tar.gz

Mgbe iji iwu tar wepụta tarballs ndị a, nchekwa ọhụrụ abụọ ga-apụta na ndekọ ahụ.

 ls -l
total 13520
drwxrwxr-x 18 root root     4096 Aug 20 17:43 nagios-4.4.5
-rw-r--r--  1 root root 11101966 Aug 20 17:48 nagios-4.4.5.tar.gz
drwxr-xr-x 15 root root     4096 Apr 19 12:04 nagios-plugins-2.2.1
-rw-r--r--  1 root root  2728818 Apr 19 12:04 nagios-plugins-2.2.1.tar.gz

Ugbu a, nke mbụ, anyị ga-ahazi Nagios Core na ime ya, anyị kwesịrị ịga na ndekọ ndekọ Nagios ma mee faịlụ nhazi ma ọ bụrụ na ihe niile na-aga nke ọma, ọ ga-egosi mmepụta na njedebe dị ka mmepụta ihe nlele. Biko hụ n'okpuru.

 cd nagios-4.4.5/
 ./configure --with-command-group=nagcmd
Creating sample config files in sample-config/ ...


*** Configuration summary for nagios 4.4.5 2019-08-20 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /lib/systemd/system
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/bin/traceroute


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

Mgbe configuring, anyị kwesịrị ikpokọta na wụnye niile binaries na-eme ka ihe niile na-eme ka wụnye iwu, ọ ga-etinye niile mkpa ọba akwụkwọ na akụrụngwa gị na anyị nwere ike ịga n'ihu.

 make all
 make install
*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with testing or installing Nagios as follows (type
'make' without any arguments for a list of all possible options):

  make test
     - This runs the test suite

  make install
     - This installs the main program, CGIs, and HTML files

  make install-init
     - This installs the init script in /lib/systemd/system

  make install-daemoninit
     - This will initialize the init script
       in /lib/systemd/system

  make install-groups-users
     - This adds the users and groups if they do not exist

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs *SAMPLE* config files in /usr/local/nagios/etc
       You'll have to modify these sample files before you can
       use Nagios.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

  make install-webconf
     - This installs the Apache config file for the Nagios
       web interface

  make install-exfoliation
     - This installs the Exfoliation theme for the Nagios
       web interface

  make install-classicui
     - This installs the classic theme for the Nagios
       web interface

Iwu na-esote ga-etinye scripts init maka Nagios.

 make install-init

Iji mee ka Nagios rụọ ọrụ site na ahịrị iwu anyị kwesịrị ịwụnye usoro iwu.

 make install-commandmode

Ọzọ, wụnye faịlụ Nagios sample, biko gbasoo iwu.

 make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

*** Config files installed ***

Remember, these are *SAMPLE* config files.  You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

Mepee faịlụ contacts.cfg na nhọrọ nchịkọta akụkọ gị wee tọọ adreesị ozi-e jikọtara na nkọwa kọntaktị nagiosadmin na ịnweta ọkwa email.

# vi /usr/local/nagios/etc/objects/contacts.cfg
###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
       contact_name                    nagiosadmin             ; Short name of user
       use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
       alias                           Nagios Admin            ; Full name of user

       email                           [email      ; *** CHANGE THIS TO YOUR EMAIL ADDRESS ****
       }

Emechara anyị na nhazi niile na azụ azụ, ugbu a, anyị ga-ahazi Interface Weebụ Maka Nagios site na iwu na-esonụ. Iwu dị n'okpuru ga-ahazi interface webụ maka Nagios na a ga-emepụta onye nchịkwa weebụ \nagiosadmin.

 make install-webconf

N'ime usoro a, anyị ga-emepụta paswọọdụ maka \nagiosadmin mgbe ịmechara iwu a, biko nye paswọọdụ ugboro abụọ ma debe ya n'ihi na a ga-eji paswọọdụ a mgbe ịbanye na ntanetị Nagios Web.

 htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Malitegharịa Apache iji mee ka ntọala ọhụrụ ahụ malite.

 service httpd start               [On RHEL/CentOS 6]
 systemctl start httpd.service     [On RHEL/CentOS 7/8 and Fedora]

Anyị ebudatara plugins Nagios na /root/nagios, Gaa ebe ahụ hazie ma wụnye ya dị ka a gwara ya n'okpuru.

 cd /root/nagios
 cd nagios-plugins-2.2.1/
 ./configure --with-nagios-user=nagios --with-nagios-group=nagios
 make
 make install

Ugbu a anyị niile ejirila nhazi Nagios na oge ya iji nyochaa ya na ime ya biko tinye iwu na-esonụ. Ọ bụrụ na ihe niile na-aga nke ọma, ọ ga-apụta dị ka mmepụta n'okpuru.

 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
	Checked 8 services.
	Checked 1 hosts.
	Checked 1 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 24 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 1 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Iji mee ka Nagios rụọ ọrụ gafee reboots, anyị kwesịrị ịgbakwunye nagios na httpd na chkconfig na systemctl iwu.

 chkconfig --add nagios
 chkconfig --level 35 nagios on
 chkconfig --add httpd
 chkconfig --level 35 httpd on
 systemctl enable nagios
 systemctl enable httpd

Malitegharịa Nagios iji mee ka ntọala ọhụrụ ahụ malite.

 service nagios start              [On RHEL/CentOS 6]
 systemctl start nagios.service    [On RHEL/CentOS 7/8 and Fedora]

Nagios gị adịla njikere ịrụ ọrụ, biko meghee ya na ihe nchọgharị gị na \http://Your-server-IP-address/nagios ma ọ bụ http://FQDN/nagios wee nye aha njirimara \nagiosadmin na okwuntughe.

Ekele! Ị wụnyela ma hazie Nagios na ngwa mgbakwunye ya nke ọma. Ị ka malitere njem gị n'ime nlekota oru.

Kwalite Nagios 3.x ka ọ bụrụ Nagios 4.4.5

Ọ bụrụ na ị na-emebu ụdị Nagios ochie, ị nwere ike kwalite ya oge ọ bụla. Iji mee nke a, naanị ị ga-ebudata akwụkwọ ndekọ tar kacha ọhụrụ wee hazie ya dịka egosiri n'okpuru.

 service nagios stop
 wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
 tar -zxvf nagios-4.4.5.tar.gz
 cd nagios-4.4.5
 ./configure
 make all
 make install
 service nagios start

Nke ahụ bụ ya ugbu a, na akụkọ m na-abịanụ, m ga-egosi gị otu esi etinye Linux, Windows, Printer, Switches, na Devices na Nagios monitoring Server. Ọ bụrụ na ị na-enwe nsogbu ọ bụla mgbe ị na-etinye, biko kpọtụrụ anyị site na nkwupụta. Ruo mgbe ahụ nọrọ na nche wee jikọọ na Tecment ma echefula Like na Share anyị ka anyị gbasaa.

Gụkwuo:

  1. Otu esi etinye onye ọbịa Linux na sava Nagios Monitoring
  2. Otu esi etinye onye ọbịa Windows na sava Nagios Monitoring