In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how Redhat configures nagios. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Configure the monitored computer
This article is about Redhat configuring nagios. Return to the outline.
Configure linux monitored machine (client)
Gcc, openssl and openssl-devel need to be installed first.
Add a user first
[root@localhost ~] # useradd nagios [root@localhost ~] # passwd nagios / / 123456
Changing password for user nagios.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
Passwd: all authentication tokens updated successfully.
Install nagios-plugins-1.4.15.tar.gz
[root@localhost ~] # tar-zxvf nagios-plugins-1.4.15.tar.gz [root@localhost ~] # cd nagios-plugins-1.4.15 [root@localhost nagios-plugins-1.4.15] #. / configure-- prefix=/usr/local/nagios [root@localhost nagios-plugins-1.4.15] # make [root@localhost nagios-plugins-1.4.15] # make install [root@localhost nagios-plugins-1.4.15] # chown nagios.nagios / usr/local/nagios [root@localhost nagios-plugins-1.4.15] # chown-R nagios.nagios / usr/local/nagios/libexec
Install nrpe
[root@localhost ~] # tar-zxvf nrpe-2.8b1 [root@localhost ~] # cd nrpe-2.8b1 [root@localhost nrpe-2.8b1] #. / configure [root@localhost nrpe-2.8b1] # make all [root@localhost nrpe-2.8b1] # make install-plugin [root@localhost nrpe-2.8b1] # make install-daemon [root@localhost nrpe-2.8b1] # make install-daemon-config
Edit nrpe.cfg
[root@localhost ~] # vi / usr/local/nagios/etc/nrpe.cfg
Look for the following plus the nagios server ip address
Allowed_hosts=127.0.0.1,10.155.2.65
After saving, start nrpe and add to boot with the following command
/ usr/local/nagios/bin/nrpe-c / usr/local/nagios/etc/nrpe.cfg-d echo'/ usr/local/nagios/bin/nrpe-c / usr/local/nagios/etc/nrpe.cfg-d & > / dev/null' > > / etc/rc.local
Verification
[root@localhost etc] # / usr/local/nagios/libexec/check_nrpe-H localhost
NRPE v2.8b1
[root@localhost etc] # netstat-atulnp | grep 'nrpe'
Tcp 0 0 0.0.0.0 5666 0.0.0.015 * LISTEN 24823/nrpe
If it is not normal, see the problem and solution in the article (1)
Here, the configuration of the client has been completed, and you can configure command.cfg monitoring to the nagios server. But here is another way to edit the nrpe.cfg configuration command. The nagios server will call the nrpe command of the client.
Vi / 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 15vi 10 zombie_procs 5-c 30 command 25 command 20 command [check _ total_procs] = / usr/local/nagios/libexec/check_procs-w 5-c 10-s Z command [check _ total_procs] = / check-w 150-c 200 command [check _ swap] = / usr/local/nagios/libexec/check_swap-w 20%-c 10%
The following one is added by yourself.
Command [check _ ping81] = / usr/local/nagios/libexec/check_ping-H 10.155.0.1-w 100.0Ligue 20-c 500.0 hda1 60% # command [check _ hda1] = / usr/local/nagios/libexec/check_disk-w 20-c 10-p / command # command [command name] = command definition
For specific use, please see help.
[root@localhost nagios] # ls bin etc include libexec share [root@localhost nagios] # pwd / usr/local/nagios [root@localhost nagios] # libexec/check_ping-h check_ping v1.4.15 (nagios-plugins 1.4.15) Copyright (c) 1999 Ethan Galstad Copyright (c) 2000-2007 Nagios Plugin Development Team Use ping to check connection statistics for a remote host.Usage: check_ping-H-w,%-c % [- p packets] [- t timeout] [- 4 |-6] Options:-h,-- help Print detailed help screen-V,-- version Print version information-4,-- use-ipv4 Use IPv4 connection-6,-- use-ipv6 Use IPv6 connection-H,-- hostname=HOST host to ping-w,-- warning=THRESHOLD warning threshold pair-c,-- critical=THRESHOLD critical threshold pair-p -packets=INTEGER number of ICMP ECHO packets to send (Default: 5)-L,-- link show HTML in the plugin output (obsoleted by urlize)-t,-- timeout=INTEGER Seconds before connection times out (default: 10)
After you configure nrpe.cfg, you must restart nrpe. Restart method (kill the process, restart), otherwise the change will not take effect
[root@localhost ~] # ps aux | grep nrpe nagios 3327 0.0 4880 924? Ss Sep02 0:03 / usr/local/nagios/bin/nrpe-c / usr/local/nagios/etc/nrpe.cfg-d root 22293 0.0 3908 648 pts/0 R + 11:07 0:00 grep nrpe [root@localhost ~] # / usr/local/nagios/bin/nrpe-c / usr/local/nagios/etc/nrpe.cfg-d
Server side
Test the connection with the client, which is normal as follows
[root@localhost nrpe-2.8b1] # / usr/local/nagios/libexec/check_nrpe-H 10.155.2.81 NRPE v2.8b1
The following is abnormal, see problem and solution (2)
[root@localhost nrpe-2.8b1] # / usr/local/nagios/libexec/check_nrpe-H 10.155.2.81 Connection refused by host
Configure nagios.cfg to add a record
[root@localhost ~] # vi / usr/local/nagios/etc/nagios.cfg cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg cfg_file=/usr/local/nagios/etc/objects/commands.cfg; this has been set before
Configure nagios.cfg to add a record
Vi / usr/local/nagios/etc/objects/commands.cfg # add the following at the end: # check nrpedefine command {command_name check_nrpecommand_line $USER1 $/ check_nrpe-H $HOSTADDRESS$-c $ARG1 $} mylinux
.cfg is not in the directory. You need to add it yourself.
[root@localhost ~] # touch / usr/local/nagios/etc/objects/mylinux.cfg
#-this section defines the host--
Define host {use linux-server host_name 10.155.2.81-cacti alias mylinux address 10.155.2.81}
#-- define the server, that is, the monitoring item--
Define service {use generic-service host_name 10.155.2.81-cacti service_description Swap Usage check_command check_nrpe!check_swap} define service {use generic-service host_name 10.155.2.81-cacti service_description Current Load check_command check_nrpe!check_load} define service {use generic-service host_name 10.155.2.81-cacti service_description Partition Usage check_command check_nrpe!check_hda1 } define service {use generic-service host_name 10.155.2.81-cacti service_description Current Users check_command check_nrpe!check_users} define service {use generic-service host_name 10.155.2.81-cacti service_description Total Processes check_command check_nrpe!check_total_procs} define service {use generic-service host_name 10.155.2.81-cacti service_description PING check_command check_nrpe!check_ping81}
Restart nagios,ie browsing (figure 3)
Thank you for reading! This is the end of this article on "how to configure nagios for Redhat". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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
Server.c#include # include int main (int
© 2024 shulou.com SLNews company. All rights reserved.