Basic configuration of Nagios memo

Source: Internet
Author: User

######################################## Server ####################################### #

#Ls/usr/loca/Nagios

CGI. cfg --> CGI configuration file
Htpasswd. Users --> Apache authentication Password File
Nagios. cfg --> main configuration file of Nagios
Objects --> Monitoring object, definition file directory
Resource. cfg --> Nagios resource configuration file

#Grep '^ pai_file'/usr/local/Nagios/etc/Nagios. cfg
Export _file =/usr/local/Nagios/etc/objects/commands. cfg
// Monitoring script configuration file
Export _file =/usr/local/Nagios/etc/objects/contacts. cfg
// Contact/group configuration file
Export _file =/usr/local/Nagios/etc/objects/timeperiods. cfg
// Monitoring time period configuration file
Export _file =/usr/local/Nagios/etc/objects/templates. cfg
// Monitoring Service, alarm Configuration
Export _file =/usr/local/Nagios/etc/objects/localhost. cfg
// Local configuration file

#PWD
/Usr/local/Nagios/etc/objects
# Touch hosts. cfg services. cfg
# Chown Nagios: Nagios hosts. cfg services. cfg

#Vim/usr/local/Nagios/etc/Nagios. cfg// Add the following to the monitoring host and service configuration file
Export _file =/usr/local/Nagios/etc/objects/hosts. cfg

Export _file =/usr/local/Nagios/etc/objects/services. cfg

#CAT/usr/local/Nagios/etc/objects/hosts. cfg// Add monitoring host
Define host {
Host_name Client1
Address 192.168.1.18
Alias Client1
Use Linux-Server
}

Commands. cfg// Add nrpe

Define command {
Command_name check_nrpe
Command_line $ user1 $/check_nrpe-h $ hostaddress $-C $ arg1 $
}

Commands. cfg// If you need to add a custom command to speed up the MySQL service status
Bytes ---------------------------------------------------------------------------------------
Define command {
Command_name check_mysql
Command_line $ user1 $/check_mysql-h $ hostaddress $-P 3306-u Nagios-D Nagios-P 123
}
Bytes ---------------------------------------------------------------------------------------

######################################## Server ####################################### #

Client:

You need to grant permissions to the monitored host in MySQL:

Check_mysql --> Add MySQL detection for Nagios

Mysql>Create Database Nagios;
Query OK, 1 row affected (0.02 Sec)

Mysql>Grant select on Nagios. * To Nagios @ '%' identified by '123 ';
Query OK, 0 rows affected (0.02 Sec)

Mysql>Flush privileges;
Query OK, 0 rows affected (0.00 Sec)

Mysql>

##################################### ### server #################################### ####
services. CFG // some monitoring service examples
usage
define service {
use local-service
host_name Client1
service_description check_user
check_command check_nrpe! Check_users
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_load
check_command check_nrpe! Check_load
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_total_procs
check_command check_nrpe! Check_total_procs
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check _/
check_command check_nrpe! Check _/
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_swap
check_command check_nrpe! Check_swap
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_zombie_procs
check_command check_nrpe! Check_zombie_procs
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_http
check_command check_http
icationications_enabled 1
}

define service {
use local-service
host_name Client1
service_description check_ssh
check_command check_ssh
icationications_enabled 1
}

Define Service {
Use local-Service
Host_name Client1
Service_description check_mysql
Check_command check_mysql
Notifications_enabled 1
}
Bytes ---------------------------------------------------------------------------------------

######################################## Server ####################################### #


Client:

Not all commands are available in the preceding service examples. Some of them need to be configured on the nrpe of the client.

#Grep '^ command \ ['/usr/local/Nagios/etc/nrpe. cfg
Command [check_users] =/usr/local/Nagios/libexec/check_users-W 5-C 10
Command [check_load] =/usr/local/Nagios/libexec/check_load-W 15,10, 5-C 30,25, 20
Command [Check _/] =/usr/local/Nagios/libexec/check_disk-W 20%-C 10%-P/dev/sda1
Command [check_swap] =/usr/local/Nagios/libexec/check_disk-W 20%-C 10%-P/dev/sda3
Command [check_zombie_procs] =/usr/local/Nagios/libexec/check_procs-W 5-C 10-s Z
Command [check_total_procs] =/usr/local/Nagios/libexec/check_procs-W 150-C 200
// The partitions of different machines may be different, so here I modified a monitoring of the/and swap partitions, and the monitoring of system resources is implemented through nrpe, services such as SSH and MySQL do not need to rely on nrpe

The above is a configuration memo for the basic services and system resources monitored by Nagios, and a configuration for the Nagios timeperiods. cfg, contacts. cfg, and monitoring host group and Service Group will be available later.

Attach a Monitoring Chart

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.