Configuration Summary for Nagios

Source: Internet
Author: User

All of them are Yum installed:

    1. # vim/etc/nagios/nagios.cfg

To add a host profile to a master configuration file

Cfg_file=/etc/nagios/objects/localhost.cfg

Cfg_file=/etc/nagios/objects/172.16.1.1.cfg

2. # vim/etc/nagios/objects/commands.cfg

Add Check_nrpe command to Commands.cfg

Define Command{

Command_name Check_nrpe

Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$

}

3. Host configuration Template:

# Cat 172.16.10.134.cfg

Define Host{

Use Linux-server

HOST_NAME 172.16.1.1

Alias 172.16.1.1

Address 172.16.1.1

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description check_ping

Check_command check_ping!100.0,20%!200.0,50%

Max_check_attempts 5

Normal_check_interval 1

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Check_ssh

Check_command Check_ssh

Max_check_attempts 5

Normal_check_interval 1

Notification_interval 60

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description check_http

Check_command check_http

Max_check_attempts 5

Normal_check_interval 1

Notification_interval 60

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Root Partition

Check_command check_local_disk!20%!10%!/

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Current Users

Check_command check_local_users!20!50

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Total Processes

Check_command check_local_procs!450!500! Rszdt

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Current Load

Check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Swap Usage

Check_command check_local_swap!20!10

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Check_load

Check_command Check_nrpe!check_load

Max_check_attempts 5

Normal_check_interval 1

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description check_disk_opt

Check_command check_nrpe!check_opt

Max_check_attempts 5

Normal_check_interval 1

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Port 145

Check_command check_tcp!145

}


Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Port 110

Check_command check_tcp!110

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Port 106

Check_command check_tcp!106

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Port 107

Check_command check_tcp!107

}

Define Service{

Use Generic-service

HOST_NAME 172.16.1.1

Service_description Check_mem

Check_command Check_nrpe!check_mem

Max_check_attempts 5

Normal_check_interval 1

}

[Email protected] objects]#


Client:

[Root[email protected] plugins]# vim/etc/nagios/nrpe.cfg

Command[check_users]=/usr/lib64/nagios/plugins/check_users-w 5-c 10

Command[check_load]=/usr/lib64/nagios/plugins/check_load-w 15,10,5-c 30,25,20

Command[check_hda1]=/usr/lib64/nagios/plugins/check_disk-w 20%-C 10%-p/dev/hda1

Command[check_opt]=/usr/lib64/nagios/plugins/check_disk-w 20%-C 10%-p/dev/mapper/all--data-data01

Command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs-w 5-c 10-s Z

Command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs-w 150-C 200

Command[check_mem]=/usr/lib64/nagios/plugins/check_mem.sh-w 150-C 100


# cat/usr/lib64/nagios/plugins/check_mem.sh

#!/bin/bash

Total= ' Free-m | Head-2 |tail-1 |gawk ' {print $} '

# Free Memory

Free= ' Free-m | Head-2 |tail-1 |gawk ' {print $4} '

# to calculate free percent

# Use the expression free * 100/total

freetmp= ' expr $FREE \* 100 '

percent= ' expr $FREETMP/$TOTAL '

echo "$FREE MB ($PERCENT%) Free Memory "

Exit 0


Configuration Summary for Nagios

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.