Nagios Monitoring basic Configuration (ii)

Source: Internet
Author: User

I. Configuring Nagios Services

The Nagios service is run in the main profile nagios.cfg, the monitoring plug-in is called in the configuration file, the operator can set the monitoring plug-in monitoring threshold value (warning value error value); The Nagios service's plug-in compares the monitored data to the monitoring thresholds, showing the monitoring status according to the comparison results:

Monitored data < warning values display OK

Monitored data > warning values < error values display warning

Monitored data > Error values display critical

Problem with Unknown configuration

Pending is getting data


Using the Monitor plugin

[[email protected] nagios-4.2.4]# cd/usr/local/nagios/libexec/> enter the monitoring plugin directory


[[email protected] libexec]#./check_users--help > View Help information

Usage: > Plugin format

Check_users-w <users>-C <users>


Several common plug-in configurations

Current load CPU load check_load ./check_load-w 1.00,3.0 0,6,00-c 2.00,5.00,11.00

Current users log in to the system check_users./check_users-w 1-c 3

HTTP Web service run status check_http ./check_http-h 127.0.0.1

PING Test connectivity check_ping./check_ping-h 192.168.4.254- W 5,10%-C 10,15%

Root Partition root partition check_disk./check_disk-w 50%-C 25%-P/

Swap Usage swap partition check_swap ./check_swap-w 20%-C 10%

Total Processes number of processes Check_procs./check_procs-w 50-c 51-s R

Note: Use of other plugins is required to view Help

[[email protected] libexec]#./check_ Plugin name--help


Ii. Description of the configuration file

[Email protected] libexec]# cd/usr/local/nagios/etc/

/usr/local/nagios/etc/nagios.cfg > master configuration file

/usr/local/nagios/etc/cgi.cfg > Access Permissions Directory

/USR/LOCAL/NAGIOS/ETC/RESOURCE.CFG > macro Definition File

[Email protected] nagios]# vim/usr/local/nagios/etc/resource.cfg

$USER 1$=/usr/local/nagios/libexec > Plugins directory


[[email protected] etc]# ls objects/commands.cfg > Define commands for monitoring

[Email protected] objects]# vim commands.cfg

"Define a keyword for a command"

Define Command{

Command_name command name

Command_line Path/Plugin Name parameter

58}


Check for configuration file statements with no errors

[Email protected] etc]#/usr/local/nagios/bin/nagios-v/usr/local/etc/commands.cfg



Set up an email address to receive alert messages

[Email protected] objects]# vim/usr/local/nagios/etc/objects/contacts.cfg

email [email protected] > Specify user to receive alarm information

Define a template for monitoring time

[[Email protected] objects] #vim/usr/local/nagios/etc/objects/timeperiods.cfg

Defining the Monitor Template

[Email protected] objects]# vim/usr/local/nagios/etc/objects/templates.cfg

Defining Monitoring commands

[Email protected] nagios]# vim/usr/local/nagios/etc/objects/commands.cfg

Defining Monitoring objects

[Email protected] nagios]# vim/usr/local/nagios/etc/objects/localhost.cfg

Define Host{

Use linux-server > template name

host_name localhost > host Name

Alias localhost > aliases Name

Address 127.0.0.1 > Monitored host addresses

Define hostgroup{ > host Group

}

Define service{ > Defining Resources for Host monitoring

Use local-service > template Name

HOST_NAME > host Name

Service_description > Monitoring Resources Description Information

Check_command > Command name

}

Adding new monitoring items to monitor the boot partition of this machine

[[email protected] nagios]# vim/usr/local/nagios/etc/objects/commands.cfg > Define monitoring commands

Define Command {

Command_name Check_local_boot

Command_line/usr/local/nagios/libexec/check_disk-w 50%-C 25%-p/boot/

}

[Email protected] objects]# vim localhost.cfg

157 define service{> Configuring monitored Services

158 use Local-service > Digital Host Monitor Template

159 host_name localhost > Target host name

Service_description Boot > Service Description information

161 Check_command Check_local_boot > use of monitoring commands

162}


[[email protected] objects]# Checknagios > Verify that the syntax is correct

[[email protected] objects]#/etc/init.d/nagios stop > Close

Stopping Nagios (via Systemctl): [OK]

[[email protected] objects]#/etc/init.d/nagios start > Open

Starting Nagios (via Systemctl): [OK]


View in Login screen (default 5 minute refresh)

[[Email protected] Desktop]# Firefox http://192.168.4.21/nagios


Nagios Monitoring basic Configuration (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.