Prerequisite: The Nagios monitoring End (202.207.178.7) and the monitored end (202.207.178.6) are already configured, and the HTTP service on the monitored side can be monitored!
Nagios installation configuration See my blog http://10927734.blog.51cto.com/10917734/1884943
First, modify the monitoring side of the configuration file, so that its update time is shortened
# vim/etc/nagios/nagios.cfg
Command_check_interval=10s
# vim/etc/nagios/objects/templates.cfg
Normal_check_interval 1
Ii. Nagios Monitor HTTP keywords (the Web content of the monitored End is it works!)
In the real online environment, if you want to monitor the HTTP, Web, tomcat a URL keyword, monitoring site keywords have been tampered with, if to achieve it?
Here you can use the default monitoring command check_http command + related parameters to implement, as follows:
1, add the following keyword Monitoring command in command.cfg: Check_http_word,
Parameter resolution:-i specifies IP or host name,-u specifies url,-p specified port,-s Specifies the keyword.
# vim/etc/nagios/objects/commands.cfg
Define Command{
Command_name Check_http_word
Command_line $USER 1$/check_http-i $HOSTADDRESS $-U $ $ARG 1$-P $ $ARG 2$-S
$ARG 3$
}
2, check if there is no error
#/usr/local/nagios/bin/nagios-v/etc/nagios/nagios.cfg
3, the server-side command line can execute the following command to do the test, such as the monitoring page does not exist ATM keyword, but the 80 port Web service can be accessed, still send an alarm.
#/usr/local/nagios/libexec/check_http-i 202.207.178.6-u/index.html-p 80-s "ATM"
HTTP critical:http/1.1 ok-string ' ATM ' not found on ' http://202.207.178.6:80/index.html '-263 bytes in 0.005 secon D Response Time |time=0.004836s;;;0. 000000 size=263b;;;0
#/usr/local/nagios/libexec/check_http-i 202.207.178.6-u/index.html-p 80-s "It"
HTTP ok:http/1.1 OK-263 Bytes in 0.004 second response time |time=0.003956s;;;0. 000000 size=263b;;;0
3, in the server-side monitoring host configuration file, reference
# vim/etc/nagios/objects/202.207.178.6.cfg
Define Service{
Use Local-service
HOST_NAME 202.207.178.6
Service_description Httpd-eord-works
Check_command check_http_word!/index.html!80! It
}
Three, Nagios Mail alarm
Using Nagios Alarm, we can use 163 mailbox, the mechanism is Nagios to 163 mailbox send information, then the information will be automatically sent to our bound phone. Bind your phone in 163 in advance. In addition, you can use the SMS cat (charge) device to send an alarm.
The default command.cfg has been configured in the Mail alarm settings, you can use the default configuration, using the system default mail to send mail, you can also define the content sent by the format and send the mail SMTP server-side software.
Here to use the default configuration file, to be able to receive SMS alarm, in addition to the 163 mailbox interface binding 163 mailboxes, but also in the Nagios server-side configuration file to modify the message recipients are as follows:
1. Test whether you can send mail normally
# echo "Test OK" |mail-s "title" [Email protected]
2, modify the e-mail address, is your own mailbox can receive mail
# vim/etc/nagios/objects/contacts.cfg
Define Contact{
Contact_Name Nagiosadmin
Use Generic-contact
Alias Nagios Admin
email [email protected]
}
3. Restart the Nagios service to start testing!
This article is from the "10917734" blog, please be sure to keep this source http://10927734.blog.51cto.com/10917734/1885352
Nagios Advanced Configuration