#配置服务端监控客户端
[Email protected] etc]# CD objects/
[Email protected] objects]# VI hosts.cfg
# Define A host for the Local machine
Define Host{
Use Linux-server
HOST_NAME 1.3-samba
Alias 1.3-samba
Address 10.89.1.3
}
Define Host{
Use Linux-server
HOST_NAME 1.2-nagios
Alias 1.2-nagios
Address 10.89.1.2
}
Define Host{
Use Linux-server
HOST_NAME 1.34-WEB-LNMP
Alias 1.34-web-lnmp
Address 10.89.1.34
}
Define Host{
Use Linux-server
HOST_NAME 1.34-web
Alias 1.34-web
Address 10.89.1.34
}
# Define An optional HostGroup for Linux machines
Define Hostgroup{
Hostgroup_name linux-servers; The name of the HostGroup
Alias Linux Servers; Long Name of the group
Members 1.3-samba,1.2-nagios,1.34-web-lnmp,1.34-web
}
Save exit
Check the syntax, first edit the Nagios file to display the error message
[Email protected] objects]# Vim/etc/init.d/nagios +183
$NagiosBin-V $NagiosCfgFile >/dev/null 2>&1; Modified to:
$NagiosBin-V $NagiosCfgFile
Save exit
Check the syntax if the error is as follows:
[Email protected] objects]#/etc/init.d/nagios checkconfig
Checking Services ...
Error:there is no services defined!
Checked 0 Services.
Workaround:
[Email protected] objects]# VI services.cfg
Define Service {
Use Generic-service
HOST_NAME 1.3-samba
Service_description Disk Partition
Check_command Check_nrpe!check_disk
}
Check grammar again
[Email protected] objects]#/etc/init.d/nagios checkconfig
Total Warnings:1
Total errors:0
Things look okay-no serious problems were detected during the pre-flight check
Ok.
[Email protected] objects]#
If the following error is reported:
Error:service check command ' Check_nrpe ' specified in Service ' Disk Partition ' for
Host ' 10-client01 ' not defined anywhere!
Then edit the commands.cfg file:
[Email protected] objects]# VI commands.cfg
And then the end Plus
# ' Check_nrpe ' command definition
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$
}
Note: command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$ is actually using this command to detect:
[Email protected] objects]#/usr/local/nagios/libexec/check_nrpe-h 10.89.1.3-c Check_disk
Save and exit
Check grammar again
[Email protected] objects]#/etc/init.d/nagios checkconfig
In case of no error:
[Email protected] objects]#/etc/init.d/nagios Reload
Running configuration Check...done.
Reloading Nagios Configuration...done
[Email protected] objects]#
Http://10.89.1.2/nagios
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/E0/wKioL1hblIjRr84hAABeqkBD1sI501.jpg-wh_500x0-wm_3 -wmp_4-s_3414212499.jpg "title=" Login Prompt "alt=" wkiol1hblijrr84haabeqkbd1si501.jpg-wh_50 "/>
If you are prompted with an error after logging in:
It appears as though you don't have permission to view information for any of the hosts you requested ...
If you believe the "an" error, check the HTTP server authentication requirements for accessing this CGI
And check the authorization options in your CGI configuration file.
Edit Cgi.cfg
[Email protected] objects]# CD. /
[Email protected] etc]# VI cgi.cfg
# Physical HTML PATH
# This is the path where the HTML files for Nagios reside. This
# value is used-Locate the logo images needed by the Statusmap
# and STATUSWRL CGIs.
Physical_html_path=/usr/local/nagios/share
: G/nagiosadmin/s//alvin/g #替换nagiosadmin for Alvin, this user was added when I installed the
Save and exit
[Email protected] objects]#/etc/init.d/nagios Reload
This article is from the "Knowledge Change Destiny" blog, please be sure to keep this source http://ahtornado.blog.51cto.com/4826737/1885155
Nagios Monitoring Configuration Introduction (II)