In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains how the server side of the monitoring software Nagios is installed and configured on the Linux system. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to install and configure the server side of the monitoring software Nagios on the Linux system.
The basic idea of Nagios is that nagios server acquires the relevant information of the monitored node (monitored server) and displays it to the administrator through CGI (Web GUI) or e-mail.
The acquisition of information is mainly divided into active acquisition and passive acquisition, in which the active score is directly taken by the monitored node or the intermediate database node.
If each monitored node is directly fetched, the CPU of the system where nagios resides may not be able to handle it if there are too many machines, so our system uses the passive acquisition of NSCA in the test environment, and may switch to NDOUtils in the future to separate the monitoring end from the monitored end through the database.
The specific working process of NSCA:
1. Data generation: the monitored program regularly collects data and sends it to the Nagios server. The NSCA process of the Nagios server receives the data and puts the data into the specified file (specified in nagios.cfg and nsca.cfg).
two。 Data processing: Nagios processes the specified files in real time and saves the data to queue. At the same time, Nagios will regularly check the queue and do the final processing of the data, such as sending alert mail, logging and so on.
The final mode of the monitoring system: Nagios + NSCA + Pnp4nagios (bulk&npcd).
NSCA is responsible for collecting data. Nagios writes the collected data to spool files according to the format required by Pnp4nagios, and moves the files to the spool folder processed by npcd every 15 minutes. Npcd calls process_perfdata.pl to deal with the files in the spool folder, and finally stores them in rrd. Add pnp4nagios web to the Nagios monitoring page to access url, and you can view the graphical monitoring data.
Next, let's talk about our installation of Nagios.
Nagios Server end installation
A liunx server (CentOS) that installs the corresponding version of the following installation package
1. Basic nagios and Web GUI installation package
The code is as follows:
Httpd-*.tar.gz,php-*.tar.gz, nagios-*.tar.gz, nagios-plugins-*.tar.gz
Installation steps
two。 Graphical performance data installation package
The code is as follows:
Pnp4nagios-*.tar.gz
Installation steps
3. Linux system monitoring plug-in
Active mode: nrpe-*.tar.gz, passive mode: nsca-*.tar.gz
Nsca installation steps
Note: inetd or xinetd are not used in our system
Nagios monitored Clients
For NSCA mode, we use Python script + Cron Job (crontab) to regularly send data to Nagios Server in a format, so as long as Python is installed on the monitored device.
Now let's talk about how to use NSCA to get the resource usage information of the monitored node in our system.
Basic configuration on the Nagios Server side:
1. Nagios web gui access configuration, the system uses the configuration recommended in nagios core. When you access nagios web through apache httpd, when you install nagios, you will automatically find the httpd installed in the system and put the httpd file of nagios in the conf.d directory of httpd. In this way, as long as you generate a password for nagios web access, you can access nagios web through nagios web.
The code is as follows:
Htpasswd-c / usr/local/nagios/etc/htpasswd.users nagiosadmin
two。 Define the machines to monitor and the services to monitor in Nagios
2. 1 define listening nodes and services to be monitored in / usr/local/nagios/etc/objects/, for example:
The code is as follows:
/ usr/local/nagios/etc/objects/system_1.cfg
# # define hosts
# system_1 oam_1
Define host {
Use linux-server,host-pnp
Host_name system_1_oam_1
Address
Contact_groups system_1_admins,systems_admins
}
.
# system_1 traffic_1
Define host {
Use linux-server,host-pnp
Host_name system_1_traffic_1
Address
Contact_groups system_1_admins,systems_admins
}
.
# # define services
# system_1 oam_1
Define service {
Use passive_service,srv-pnp
Service_description CPU_Status
Host_name system_1_oam_1
Contact_groups system_1_admins,systems_admins
}
Define service {
Use passive_service,srv-pnp
Service_description Memory_Status
Host_name system_1_oam_1
Contact_groups system_1_admins,systems_admins
}
.
# system_1 traffic_1
Define service {
Use passive_service,srv-pnp
Service_description CPU_Status
Host_name system_1_traffic_1
Contact_groups system_1_admins,systems_admins
}
Note:
A. Passive_service is the configuration required by NSCA
B. Host-pnp and srv-pnp are configurations for pnp4nagios
2.2 add the defined configuration file to / usr/local/nagios/etc/nagios.cfg
The code is as follows:
Cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
Cfg_file=/usr/local/nagios/etc/objects/system_1.cfg
Cfg_file=/usr/local/nagios/etc/objects/system_2.cfg
.
Nagios_user=nagios
Nagios_group=nagios
Lock_file=/usr/local/nagios/var/nagios.lock
Status_update_interval=10
3. Add system monitoring administrators to different systems
3.1
The code is as follows:
/ usr/local/nagios/etc/objects/contactgroups.cfg
Define contactgroup {
Contactgroup_name system_1_admins
Alias system_1_admins
Members oam-1,traffic-1
}
.
3.2
The code is as follows:
/ usr/local/nagios/etc/objects/contacts.cfg
Define contact {
Contact_name oam-1; Short name of user
Use generic-contact; Inherit default values from generic-contact template (defined above)
Alias oam-1; Full name of user
Service_notification_options c
Host_notification_options d
Email nobody@localhost.com
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.