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

The installation and configuration method of nagios Monitoring Server

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "the installation and configuration of nagios monitoring server". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "nagios monitoring server installation and configuration method" it!

NAGIOS server installation

1. Main software package:

1. Nagios-3.0.x.tar.gz main program

2. Nagios-plugins-1.4.x.tar.gz plug-in

3. Nrpe_2.8.x.tar.gz external components

4. Pnp-0.4.X graphical tool

Second, basic installation:

Package preparation:

Server installation:

Rpm-q gcc glibc glibc-common gd gd-devel xinetd openssl-devel httpd

Installation steps:

2.1 set up an account:

Useradd nagios

Passwd nagios

Usermod-G nagios nagios

Usermod-G nagios apache

2.2 install nagios-3.0.x.tar.gz

. / configure (without parameters, it is installed at / usr/local/nagios by default)

After configuration, follow the prompts to install.

Make all

=

Make install

=

Make install-init

=

Make install-config

=

Make install-commandmode

=

Make install-webconf # apache configuration for rpm apache,source package is shown below

Set the address of the recipient

Vi / usr/local/nagios/etc/objects/contacts.cfg

Change the EMail information in the contact definition information of email address nagiosadmin to your EMail message to receive the alarm content.

/ usr/local/apache/bin/htpasswd-c / usr/local/nagios/etc/htpasswd nagiosadmin

Enter the password (this step is important)

2.3 install the Nagios plug-in

2.3.1 nagios-plugins-1.4.X.tar.gz

. / configure-with-nagios-user=nagios-with-nagios-group=nagios

Make

Make install

Chkconfig-add nagios

Chkconfig nagios on

2.3.2 nrpe_2.8.x.tar.gz

. / configure

Make all

Make install-plugins

Make install-daemon

Make install-daemon-config

Make install-xinetd

Third, detailed configuration:

3.1 Host definition:

Vi / usr/local/nagios/etc/objects/hosts.cfg

Basic template:

Define host {

Use linux-server # nagios server-name

Host_name Hostnam

Alias alias

Address X.X.X

}

Example:

Define host {

Host_name CentOS

Use linux-server,host-pnp

Alias nagios server

Address 192.168.1.44

Contact_groups nagcmd

Check_command check-host-alive

Max_check_attempts 5

Notification_interval 10

Notification_period 24x7

Notification_options d,u,r

}

3.2 Host group definition:

Vi / usr/local/nagios/etc/objects/hostgroup.cfg

Basic template:

Define hostgroup {

Hostgroup_name group name

Alias PAY-web

Members hostname 1, hostname 2 # must be defined

}

3.3 Service definition:

Define service {

Use generic-service; Name of service template to use

Hostgroup_name host group 1, host group 2

Service_description Swap Usage

Check_command check_nrpe!check_swap

}

Example: define service {

Host_name CentOS

Use local-service,srv-pnp

Service_description CPU

Check_period 24x7

Max_check_attempts 4

Normal_check_interval 1

Retry_check_interval 1

Contact_groups nagcmd

Notification_interval 10

Notification_period 24x7

Notification_options w,u,c,r

Check_command check_nrpe!check_cpu

}

Fourth, the graphics of NAGIOS (PNP)

# based on LAMP platform

PNP is based on PHP and PERL, and uses rrdtool to chart the data collected by Nagios.

Package list:

Perl

Rrdtool 1.2.*

Pnp-0.3.3.tar.gz

4.1 install rrdtool-1.4.4.*

Tar-xvf rrdtool-1.4.4*

. / configure for configuration-- prefix=/usr/local/rrdtool

Make;make install is then compiled and installed

Ls / usr/local/rrdtool-1.4.4.* check to see if the installation directory has

You should have these directories before the rrdtool installation is successful

4.2 install pnp

Tar xzvf pnp-X.r.gz decompresses pnp

Cd pnp-X enters the pnp directory

. / configure-with-rrdtool=/usr/local/rrdtool/bin/rrdtool-with-perfdata-dir=/usr/local/nagios/share/perfdata/

Make all

Make install

Make install-config

4.2.1 related Settings

The first step is to modify the relevant configuration in the main configuration file nagios.cfg of Nagios:

Process_performance_data=1

Service_perfdata_command=process-service-perfdata # this sentence is commented out by default

If you want to chart a monitoring object, you need to include the following definition in the corresponding host or service definition (usually written in the hosts.cfg or services.cfg file):

Process_perf_data 1

4.3 access to the chart

Http://IP/nagios/pnp/

It is troublesome to visit like this.

Add in service, host

1. Commands.cfg defines these two commands in the object directory:

# 'process-host-perfdata' command definition

Define command {

Command_name process-host-perfdata

# command_line / usr/bin/printf "% b"$LASTHOSTCHECK$\ tasking host $\ tasking host $\ tasking host _ MPT$\ tasking host _ ETYPE$\ _ checking host _ IMEE$\ tasking host _ UTIME$\ tasking host _ UTUT$\ tshipping host _ data $\ n" > > / usr/local/nagios/var/host-perfdata.out

Command_line / usr/local/nagios/libexec/process_perfdata.pl

}

# 'process-service-perfdata' command definition

Define command {

Command_name process-service-perfdata

# command_line / usr/bin/printf "% b"$LASTSERVICECHECK$\ TERVICEDESC$\ TERVICESTATE$\ TERVICESTATMPT$\ TERVICESTETYPE$\ usr/local/nagios/var/service-perfdata.out SERVICEEXECTIONTIME$\ TERVICEUTUTUTUT$\ TERVICEPERTATA $\ n" >

Command_line / usr/local/nagios/libexec/process_perfdata.pl

}

Then add host-pnp and srv-pnp to hosts.cfg and services.cfg

Restart nagios after adding it, and then go to web to see

At this point, I believe that everyone on the "nagios monitoring server installation and configuration method" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report