Nagios monitoring 4 configuration monitoring web Service, port, mysql, and other status instances

Source: Internet
Author: User

Nagios monitoring 4 configuration monitoring web Service, port, mysql, and other status instances

1. monitoring web Services

(1) edit services. cfg to define the service

Define service {

Use generic-service

Host_name 5-nagios-server

Service_description weburl

Check_command check_weburl! -H 5.nagios.com-u/data/

}

(2) edit/etc/hosts and configure local domain name resolution

172.20.10.5 5.nagios.com

172.20.10.6 6.nagios.com

(3) EDIT commands. cfg and define the command

Define command {

Command_name check_weburl

Command_line $ USER1 $/check_http $ ARG1 $-w 10-c 30

/Etc/init. d/nagios checkconfig

/Etc/init. d/nagios reload

2. Active mode monitoring port

(1) vi services. cfg

Define service {

Use generic-service

Host_name 5-nagios-server

Service_description port_80

Check_command check_port! -H 5.nagios.com-p 80

(2) vi commands. cfg

Define command {

Command_name check_port

Command_line $ USER1 $/check_tcp $ ARG1 $-w 10-c 30

}

3. Monitoring port service in passive mode

(1). vi services. cfg

Define service {

Use generic-service

Host_name 6-nagios-client

Service_description port_80_beidong

Check_command check_nrpe! Check_port_80

}

(2) EDIT nrpe. cfg on the client

Command [check_port_80] =/usr/local/nagios/libexec/check_tcp-H 172.20.10.6-p 80

Nagios Return Value

STATE_ OK = 0

STATE_WARNING = 1

STATE_CRITICAL = 2

STATE_UNKNOWN = 3

STATE_DEPENDENT = 4

4. Verify that the/etc/passwd content has been modified.

Md5sum/etc/passwd>/etc/oldboy. md5

[Root @ client01 etc] # cat/usr/local/nagios/libexec/check_passwd

#! /Bin/bash

Char = 'md5sum-c/etc/oldboy. md5 2>/dev/null | grep "OK" | wc-l'

If [$ char-eq 1]; then

Echo "passwd is OK! "

Exit 0

Else

Echo "passwd is changed! "

Exit 2

Fi

Edit nrpe. cfg

Command [check_passwd] =/usr/local/nagios/libexec/check_passwd

Edit services. cfg on the server

Define service {

Use generic-service

Host_name 6-nagios-client

Service_description check_passwd

Check_command check_nrpe! Check_passwd

}

/Etc/init. d/nagios checkconfig

/Etc/init. d/nagios reload

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.