Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nagios under CentOS

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to install Nagios under CentOS", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to install Nagios under CentOS" this article.

Install Nagios, see an article and add your own notes for later study.

Environmental installation

# yum install-y gcc glibcglibc-common gd gd-devel xinetd openssh-devel httpd php

Settings for 2.selinux

Selinux:SELinux is a mandatory access control (MAC) system provided in version 2.6 of the Linux kernel. For the currently available Linux security module, SELinux is the most comprehensive and well-tested, and it is based on 20 years of MAC research. SELinux incorporates multi-level security or an optional multi-class policy in the type enforcement server and adopts the concept of role-based access control. )

① views the status of SELinux:

# / usr/sbin/sestatus-v # # selinux status: enabled is enabled

② shuts down SELinux: (divided into temporary shutdown, modified configuration file closed)

Temporary shutdown (no need to restart the machine)

# setenforce 0 # # set selinux to permissive mode, that is, display as Current mode: permissive

# # setenforce 1 sets selinux to enforcing mode

Modify the configuration (need to restart)

That is, modify the / etc/selinux/config file and change selinux=enforcing to selinux=disable. # # enforce mandatory mode, permissive tolerance mode (on behalf of selinux in operation, only warnings but actual restrictions) disabled, off (selinux does not work)

3. Establish users and user groups

# useradd-s / sbin/nologin nagios

# mkdir / usr/local/nagios

# chown-R nagios.nagios / usr/local/nagios

Add nagios and apache users to the nagcmd group to ensure that nagios and apache have permissions

# groupadd nagcmd

# usermod-G nagcmd nagios

# usermod-G nagcmd apache

4. Compile and install nagios

# tar-zxvf nagios-4.3.1.tar.gz

# cd nagios-4.3.1

Initialize and establish a compiled environment

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

# make all

# make install # install binaries

# make install-init # initialization steps

# make install-config # instance configuration file

# make install-commandmode # set directory permissions

After the installation is completed, you can see bin etc libexec sbin share var in the directory / usr/local/nagios, indicating that the installation is successful.

# make install-webconf # install web configuration file for nagios

5. Use apache to create a basic authentication method for web pages

Create a web page that admin users use to log in to nagiso

# htpasswd-c / usr/local/nagios/etc/hpasswd.users admin

6. Nagios plug-in nagios-plugins-2.1.4 installation

The Nagios main program is only a control center, and nagios plug-ins need to be installed to perform functions such as service detection and system detection.

# cd/root/Downloads

# tar-zxvf nagios-plugins-2.1.4

# cd nagios-plugins-2.1.4

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

# make

# make install

7. Check the configuration file and test

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

If no error is reported, the configuration is successful.

# service nagios star

Then visit http://localhost/nagios and you can see the following screen

Click hosts to view the details of local monitoring. If the following error occurs

# vi/usr/local/nagios/etc/cgi.cfg

Find use_authentication=1, change 1 to 0, and save

# service nagios restart

# service httpd restart

Show normal

The above is all the contents of the article "how to install Nagios under CentOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report