Implementing Nagios Service on Centos

  

Nagios is an open source free network monitoring tool that effectively monitors Windows
, Linux and Unix host status, switch routers and other network settings, printers, etc. When the system or service status is abnormal, an email or SMS alarm is sent to inform the website operation and maintenance personnel of the first time, and a normal mail or SMS notification is sent after the status is restored. Let's learn how to install this software on CentOS.
Some things after the installation is complete

  • Nagios and plugins will be installed in the /usr/local/nagios directory
  • Nagios will configure several aspects of monitoring the local machine (CPU load, Disk usage, etc.)
  • Nagios can be accessed via http://nagios_ip/nagios/

    Preparation work

    You need to install Nagios as root. Make sure to install the following packages on CentOS:

  • Apache
  • PHP

  • GCC compiler
  • GD development Libraries

    You can do this through yum:

  • #yum install httpd httpd-devel php openssl-devel

    #yum install gcc glibc Glibc-common

    #yum install gd gd-devel


    Start installing Nagios
    Create account

    Create nagios users and create nagcmd user groups to execute from Web interface commands and add nagios and apache users to this user group.

    1. #groupadd nagcmd /*Create group nagcmd*/

      #usermod –G nagcmd apache /*Add user apache to group nagcmd*/

      #useradd -G nagcmd nagios /* create a new user nagios and added to the group nagcmd * /

      #passwd nagios /* modify nagios password * /


      Download Nagios and plug

      create a download store directory:

    2. #mkdir ~ /downloads

    3. #cd ~ /downloads

      from Download http://www.nagios.org/download/to download Nagios (Chinese version of the first-time installation is recommended for students who are not good at English) and plug-ins.

    4. #wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2/download ## Chinese version #wget http://iweb.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz


      Compile and install Nagios

    5. #tar -jxvf nagios-cn-3.2.3.tar.bz2 #cd nagios-cn-3.2.3


      run Nagios configuration script, and Change nagcmd to the group you created earlier.

    6. #./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd


      compiler Source:

    7. #make all

      install binaries, init script, sample configuration file and directory permissions set up an external command.

    8. #make install #make install-init #make install-config #make install-commandmode


      Do now perform nagios, here are some you need to configure .
      Custom Configuration

      The style configuration file has been installed in the /usr/local/nagios/etc directory, modify the contact as the administrator in the next step and change the email address.

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


      configure web interface

      install Nagios Web in the Apache configuration file the conf.d directory:

    10. #make install-webconf


      login Nagios Web interface to create nagiosadmin account. Remember the password you set below, and then log in.

    11. #htpasswd -c /usr/local/nagios/etc/htpasswd.users barlow ## here I use my English name is barlow default administrator


      Restart Apache to make the new configuration take effect.

    12. #service httpd restart

  • Copyright © Windows knowledge All Rights Reserved