In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to deploy Nagios on RedHat6.5". In daily operation, I believe many people have doubts about how to deploy Nagios on RedHat6.5. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to deploy Nagios on RedHat6.5"! Next, please follow the editor to study!
Deployment environment: system, RedHat 6.5; components, Nagios
Preparation before deployment: turn off Selinux and firewall (/ etc/init.d/iptables stop); get related software packages.
(including gd-devel mysql-server openssl-devel xinetd;, etc.)
Specific steps:
1. Create Nagios users and nagcmd groups on hosts where Nagios is running
Groupadd nagcmd
Useradd-M-d / usr/local/nagios-G nagcmd nagios
Usermod-G nagcmd apache
two。 Extract the corresponding source code package and plug-in package; and specify the compilation environment and parameters
Cd / guo
Tar jxf nagios-cn-3.2.3.tar.bz2
Cd nagios-cn-3.2.3
# specify that the compilation environment group is "ngcmd"
. / configure-- with-command-group=nagcmd
# start compiling and installing
Make all & & make install
# install startup script
Make install-init
# install WEB configuration file
Make install-webconf
# install configuration file
Make install-config
# set login username and password for Nagios
Htpasswd/usr/local/nagios/etc/htpasswd.users nagiosadmin
# check the correctness of configuration
/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg
Make sure there is no Error or warning.
3. Start related services and test
/ etc/init.d/nagios start
/ etc/init.d/httpd start
4. Install the relevant plug-ins.
Cd / guo
Tar zxf nagios-plugins-2.1.1.tar.gz
Cd nagios-plugins-2.1.1
. / configure
# after execution, make sure that the status after the required function shows "yes". For example, Mysql and ssl protocol encryption is used later; the result at least includes "--with-mysql:yes,--with-openssl:yes".
# plug-ins will be automatically installed to / usr/local/nagios/libexec
Cd / usr/local/nagios/libexec
# adjust and recurse all files in this directory
Chown nagios.nagios. -R
# check the configuration again
/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg
# reload Nagios configuration
/ etc/init.d/nagios reload
5. Edit the relevant configuration file.
Cd / usr/local/nagios/etc/objects/
Cp-p localhost.cfg hosts.cfg
Cp-p localhost.cfg services.cfg
Vim / usr/local/nagios/etc/objects/hosts.cfg
# add the following:
# specify the monitored host and its related information through the hosts.cfg file
Cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
# define which services and resources to monitor through the services.cfg file.
Cfg_file=/usr/local/nagios/etc/objects/services.cfg
# vi hosts.cfg
Definehost {
Use linux-server
Host_name pu_tao.example.com
Alias Manager
Address 172.25.254.18
Icon_p_w_picpath server.gif
Statusmap_p_w_picpath server.gd2
2d_coords 500200
3d_coords 500200100
}
Define hostgroup {
Hostgroup_name linux-servers
Alias Linux Servers
Members *
}
This time, a monitored host is selected for the experiment, and only one service group is written.
Define servicegroup {
Servicegroup_name system load check
Alias load check
Members server2.example.com, total number of processes, server2.example.com user logins, server2.example.com, root partition, server2.example.com, swap space utilization
}
Monitor the situation of ping
Defineservice {
Use local-service
Host_name *
Service_description PING
Check_command checkpoints pingling 100.010% 500.060%
}
Monitor hard disk condition
Defineservice {
Use local-service
Host_name xi_gua.example.com
Service_description root partition
Check_command checkpoints localizations disk20% "10%" /
}
Monitor the number of logged-in users
Defineservice {
Use local-service
Host_name xi_gua.example.com
Number of service_description logged in users
Check_command check_local_users!20!50
}
Monitoring system load
Define service {
Use local-service
Host_name xi_gua.example.com
Service_description system load
Check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
Total number of monitoring processes
Defineservice {
Use local-service
Host_name xi_gua.example.com
Total number of service_description processes
Check_command check_local_procs!250!400!RSZDT
}
Monitor swap space utilization
Define service {
Use local-service
Host_name xi_gua.example.com
Service_description swap space utilization
Check_command check_local_swap!20!10
}
Monitor ssh condition
Define service {
Use local-service
Host_name xi_gua.example.com
Service_description SSH
Check_command check_tcp!22!1.0!10.0
Notifications_enabled 0
}
Monitoring apache
Defineservice {
Use local-service
Host_name xi_gua.example.com
Service_description HTTP
Check_command check_http
Notifications_enabled 0
}
/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg
/ etc/init.d/nagios reload
The picture shows that the monitoring of this machine is successful.
6. Turn on another mainframe. The host name of this experiment is xi_gua.example.com.ip:172.25.254.17;, which also turns off Selinux and firewall.
Install Mysql; on this machine and create a user Nagios and grant certain permissions.
Create database nagdb
Grant select on nagdb.* tonagios@172.25.254.18 identified by 'nagios'
Return the host pu_tao.example.com where the Nagios resides
Cd / usr/local/nagios/libexec
. / check_mysql-H 172.25.254.3-unagios-pnagios
Similar log information should be displayed after execution; if there are any errors, it means that the machine has successfully monitored the peer mysql.
Cd / usr/local/nagios/etc/objects
Add commands to monitor mysql in commands.cfg
# 'check_mysql' command definition
Definecommand {
Command_name check_mysql
Command_line $USER1 $/ check_mysql-H $HOSTADDRESS$-u $ARG1 $- p $ARG2 $
}
Add monitoring mysql to services.cfg
# # check_mysql
Define service {
Use local-service
Host_name xi_gua.example.com
Service_description MYSQL
Check_command check_mysql!nagios!nagios
Notifications_enabled 0
}
Add in hosts.cfg
Define host {
Use linux-server
Host_name xi_gua.example.com
Alias Manager
Parents xi_gua.example.com
Address 172.25.254.17
Icon_p_w_picpath server.gif
Statusmap_p_w_picpath server.gd2
2d_coords 400100
3d_coords 400100100
}
/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg
/ etc/init.d/nagios reload
The figure shows that the mysql on the server3 host was successfully detected.
8. Install Nrpe to enable nagios to monitor multiple hosts; operate on 172.25.254.17 (xi_gua.example.com).
# decompress related components and create nagios users
Tar zxfnrpe-2.15.tar.gz
Tar zxf nagios-plugins-2.1.1.tar.gz
Yum install mysql-devel openssl-devel-y
Useradd-M-d / usr/local/nagios nagios
Cd nagios-plugins-2.1.1
. / configure
Make all & & make install
Cd / usr/local/nagios/libexec/
Chown nagios.nagios. -R
Yum install xinetd
Cd / root/nrpe-2.15
. / configure
Make all & & make install
Make install-plugin
Make install-daemon
Make install-daemon-config
Make install-xinetd
Vim / etc/xinetd.d/nrpe
# set the monitoring host to 172.25.254.18
Only_from = 172.25.254.18
Vim / etc/services
Nrpe 5666/tcp
/ etc/init.d/xinetd start
Cd / usr/local/nagios/etc/
Vim nrpe.cfg
Change command [check _ hda1] = / usr/local/nagios/libexec/check_disk-w 20%-c 10%-p / dev/hda1 to
Command [check _ disk] = / usr/local/nagios/libexec/check_disk-w 20%-c 10%-p / # monitors the root partition
/ etc/init.d/xinetdrestart
Cd / usr/local/nagios/libexec/
Scp check_nrpe root@172.25.254.18:/usr/local/nagios/libexec/ remotely copies check_nrpe to the appropriate directory for pu_tao.exampl.com.
Return 172.25.254.18; do the following
Cd / usr/local/nagios/libexec/
Chown nagios.nagios check_nrpe
# check whether nrpe is available and successfully display the nrpe version number
. / chek_nrpe-H 172.25.254.17
Cd / usr/local/nagios/etc/objcts/
Command to add check_nrpe to commands.cfg
# 'check_nrpe' commanddefinition
Define command {
Command_name check_nrpe
Command_line $USER1 $/ check_nrpe-H $HOSTADDRESS$-c$ARG1 $
}
Add in services.cfg
Define service {
Use local-service
Host_name xi_gua.example.com
Service_description root partition
Check_command check_nrpe!check_disk
}
Define service {
Use local-service
Host_name xi_gua.example.com
Number of service_description logged in users
Check_command check_nrpe!check_users
}
Monitor root partition and logins
/ usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
/ etc/init.d/nagios reload
As shown in the picture, the monitoring is successful.
110Cloud alarm of 9.nagios
Go to the onealter official website to download the software package used here
Alert-agent-4.1.3.1-linux-x64.tar.gz
Add nagios application to onealter web page
Get Application key
In the xi_gua.example.com host:
Tar zxf alert-agent-4.1.3.1-linux-x64.tar.gz
Cp-R alert-agent / usr/local/nagios/libexec/ # put the extracted package into the nagios plug-in directory
Cp alert-agent/plugin/nagios-plugin/nagios / usr/local/nagios/libexec/
Chmod + x / usr/local/nagios/libexec/nagios
Cp alert-agent/plugin/nagios-plugin/110monitor.cfg/usr/local/nagios/etc/objects/ # put 110 configuration files in the nagios configuration file directory
Add Key to the 110monitor.cfg file:
Modify / usr/local/nagios/etc/objects/contacts.cfg to add 110monitor to the default contact group
Define contactgroup {
Contactgroup_name admins
Alias Nagios Administrators
Members nagiosadmin,110monitor
}
Modify / usr/local/nagios/etc/nagios.cfg to add 110monitor.cfg to nagios.cfg
Cfg_file=/usr/local/nagios/etc/objects/110monitor.cfg
/ usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg
/ etc/init.d/nagios reload
At this point, the study on "how to deploy Nagios on RedHat6.5" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.