Installation method Please refer to Linux learning Note: Nagios installation
Client
Since my installation is using xinetd This daemon, I need to adjust the relevant configuration file
[[email protected] ~]# vi /etc/xinetd.d/nrpe service nrpe{ flags = Ipv4 socket_type = stream port = 5666 wait = no user = nagios group = nagios server = /usr/local/nagios/bin/nrpe server_args = -c / usr/local/nagios/etc/nrpe.cfg --inetd log_on_failure += USERID disable = no only_from = 127.0.0.1 192.168.5.33} #注意我的flags改为了IPv4, the end of Only_from added the Nagios server-side IP address
After the client's Nrpe has been installed, several commands are available by default
edit [[email protected] nagios]# vi/usr/local/nagios/etc/nrpe.cfg
At the end of this file, several commands have been pre-configured
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_hda1]=/usr/local/nagios/libexec/check_disk-w 20%-C 10%-p/dev/hda1
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
To monitor the capacity of a hard disk, I added a command
Command[check_disk]=/usr/local/nagios/libexec/check_disk-w 10%-C 5%-p/dev/sdb1
Command[check_disk] is a command alias that will be called by the server side
/usr/local/nagios/libexec/check_disk is a real execution program file, the command alias and execution file name can be different
-W for the Check_disk command, the warning warning value for making free space means that a warning is issued when free space is less than or equal to 10%
-C is used to establish a critical alarm critical value for free space, which means that a critical warning is issued when the free space is less than or equal to 5%.
-P for specifying partitions
Self-test to prove that the Nrpe service on the client is open
[Email protected] ~]#/usr/local/nagios/libexec/check_nrpe-h 127.0.0.1-c check_diskdisk ok-free space:/data 148997 M B (31% inode=99%); |/data=329362mb;453563;478761;0;503959
Nrpe comes with a number of execution programs, which are located in
[[email protected] ~]# ls /usr/local/nagios/libexec/check_apt check_disk_smb check_ide_smart check_mrtg check_ntp_time check_rpc check_upscheck_ Breeze check_dns check_ifoperstatus check _mrtgtraf check_nwstat check_sensors check_uptimecheck_by_ssh check_dummy check_ifstatus check_nagios check_oracle check_smtp check_userscheck_clamd check_file_age check_imap check_nntp check_overcr check_ssh &nbsP; check_wavecheck_cluster check_flexlm check_ircd check_nrpe check_ping check_swap negatecheck_dhcp check_ftp check_load check_nt check_pop check_tcp urlizecheck_dig check_http check_log check_ntp check_procs check_time utils.pmcheck_disk Check_icmp check_mailq check_ntp_peer check_real check_udp utils.sh
Each program has different parameters, which can be viewed through the--help.
Several of them are commonly used
Check_nrpe is used to collect local or remote Nrpe information, similar to server-side programs
CHECK_NT information for collecting Windows servers
CHECK_TCP to test whether the TCP link is healthy
The client simply configures the command in the nrpe.cfg, does not need to reboot, and also remembers to configure the firewall.
Server-side
First, the collection test, the success of the next step, the unsuccessful is to check which step is wrong.
[Email protected] ~]#/usr/local/nagios/libexec/check_nrpe-h 192.168.5.34-c check_diskdisk ok-free space:/data 14899 7 MB (31% inode=99%); |/data=329362mb;453563;478761;0;503959
Add a new profile, note that my file path is servers, because I added this directory in my previous installation to make it easier to organize the configuration files. If the default installation does not make any changes, you should change the servers to objects
vi /usr/local/nagios/etc/servers/smb-backup.cfgdefine host{ use linux-server host_name Smb-Backup alias Smb-Backup address 192.168.5.34 normal_check_interval 1 #1 minute } define service{ use generic-service host_name Smb-Backup service_description check disk check_command check_nrpe!check_disk contact_groups admins normal_check_interval 1 #1 minute } #这里上下的host_name必须一致. Check_command behind using Check_nrpe!check_disk, meaning to use the native Check_nrpe program to check the Check_disk command (alias) on the specified host
Note the configuration file must be. cfg end, other suffix nagios is not read
If there is no problem, you can have Nagios check the configuration, the correct words warning and errors are 0, if errors is not 0, you must check where the error occurs, warning can be ignored but not recommended to ignore
[[email protected] ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/ nagios.cfgnagios core 4.1.1copyright (c) 2009-present Nagios Core development team and community contributorscopyright (c) 1999-2009 Ethan galstadlast modified: 08-19-2015license: gplwebsite: https://www.nagios.orgreading configuration data... Read main config file okay... read object config files okay ... Running pre-flight check on configuration data ... checking objects... checked 7 services. Checked 7 hosts. checked 0 host groups. checked 0 service groups. checked 1 contacts. Checked 1 contact groups. checked 27 commands. checked 5 time periods. Checked 0 host escalations. checked 0 service escalations. Checking for circular paths... checked 7 hosts Checked 0 service dependencies Checked 0 host dependencies checked 5 timeperiodschecking global event handlers ... Checking obsessive compulsive procesSor commands ... Checking misc settings ... Total warnings: 0total errors: 0things look okay - no serious problems were detected during the pre-flight check
Reload the configuration file to take effect
[Email protected] ~]#/etc/init.d/nagios reloadrunning Configuration check ... Reloading Nagios Configuration...done
Before reloading, it will be self-checking, just display the information is relatively simple, inconvenient troubleshooting. If you are willing to study, you can modify the/etc/init.d/nagios footsteps, let them check the output details.
You can then view the Nagios Web page on the server
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/4D/wKioL1blcY-Q3UqpAADwPPJHSqM588.png "title=" Qq20160313215352.png "alt=" Wkiol1blcy-q3uqpaadwppjhsqm588.png "/>
Linux Learning Note: Nagios configuration