Real-Life Nagios NSCA mode monitoring of Linux system Resource Usage--nagios configuration--Nagios server side

Source: Internet
Author: User

There have been a lot of good summaries about Nrpe's way online, and I'm now talking about how we use NSCA to get the resource usage information for the monitored nodes we need in our system.
Let's talk about the basic configuration of the Nagios server side:

1. Nagios Web GUI access configuration, the system is using the recommended configuration in Nagios core, access to the Nagios web via Apache httpd, when installing Nagios will automatically find the system installed in the httpd, Put the Nagios httpd file in the CONF.D directory of httpd so that you can access the Nagios Web through http://localhost/nagios/as soon as you generate a password for Nagios Web Access.
Htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
2. Add the machines you want to monitor and the services you want to monitor2.1 /usr/local/nagios/etc/nagios.cfg: Increase the object configuration FILEs to be configured
Cfg_file=/usr/local/nagios/etc/objects/localhost.cfgcfg_file=/usr/local/nagios/etc/objects/system_1.cfg 
......
Nagios_user=nagios
Nagios_group=nagios
Lock_file=/usr/local/nagios/var/nagios.lock
status_update_interval=10
2.2 Add the service to be monitored by the Listening node , for example:/usr/local/nagios/etc/objects/system_1.cfg
# # define Hosts
# system_1 Oam_1define host{        use                     linux-server,host-pnp        host_name               system_1_oam_1        address                 <ip>contact_groupssystem_1_admins,systems_admins        }......# system_1 traffic_1define host{use                     Linux-server,host-pnp        host_name               system_1_traffic_1        address                 <ip>contact_ GroupsSystem_1_admins,systems_admins        
# # define Services
#system_1 oam_1Define service{use Passive_service,srv-pnp service_description cpu_status Host_nameSYSTEM_1_OAM_1Contact_groupsSystem_1_admins,systems_admins}define service{use Passive_service,srv-pnp service_description memory_status Host_nameSYSTEM_1_OAM_1Contact_groupsSystem_1_admins,systems_admins}......#system_1 traffic_1Define service{use Passive_service,srv-pnp service_description cpu_status Host_namesystem_1_traffic_1Contact_groupsSystem_1_admins,systems_admins}
Note:
Host-pnp and Srv-pnp is the configuration to be used by Pnp4nagios, and the other configuration of Pnp4nagios is introduced later
3. Add system monitoring administrator to different systems
3.1/usr/local/nagios/etc/objects/contactgroups.cfg
Define contactgroup{        contactgroup_name       system_1_admins        alias                   system_1_admins                 members Oam-1,traffic-1        } ...
3.2/usr/local/nagios/etc/objects/Contacts.cfg
Define contact{Contact_Name oam-1; Short name of the user use generic-contact;                  Inherit default values from Generic-contact template (defined above) alias Oam-1 ;        Full name of the user service_notification_options C host_notification_options d email [email protected]; <<***** change YOUR EMAIL ADDRESS ******}define contact{contact_name Traf Fic-1; Short name of the user use generic-contact;           Inherit default values from Generic-contact template (defined above) alias Traffic-1 ; Full name of user email [email protected];  <<***** change YOUR EMAIL ADDRESS ******} ...
Note:
service_notification_options: This directive was used to define the service states for which notifications can be Sent. Valid options is a combination of one or more of the FOLLOWING:W = notify in WARNING service states, U = notify on Unkno WN service states, C = notify on CRITICAL service states, R = Notify on service recoveries (OK states), and F = Notify whe n the service starts and stopsflapping. If you specify N (none) as a option, the contact would not be receive any type of service notifications.
host_notification_options: This directive was used to define the host States for which notifications can be sent OU T to the contact. Valid options is a combination of one or more of the following: d = notify on-down host states, u = Notif Y on unreachable host states, r = notify on host recoveries (up states), f = notify when the host starts a nd stopsflapping, and s = Send notifications when host or servicescheduled downtime starts and ends. If you specify n (none) as a option, the contact would not be receive any type of host notifications.
4. NSCA If there are no port conflicts and the like, use the default configuration
5 directly. View the newly added host and service in the Nagios GUI already exists, state unknown.
6. Add Pnp4nagios bulk+npcd Mode monitoring System
6.1 modify /usr/local /nagios/etc/ nagios.cfg
#处理performance数据process_performance_data =1#host_perfdata_command=process-host-perfdata#service_perfdata_ Command=process-service-perfdata#performance Data Storage File host_perfdata_file=/usr/local/pnp4nagios/var/ Host-perfdataservice_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata#performance Data storage Format Host_perfdata_ File_template=datatype::hostperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\thostperfdata:: $HOSTPERFDATA $\ Thostcheckcommand:: $HOSTCHECKCOMMAND $\thoststate:: $HOSTSTATE $\thoststatetype:: $HOSTSTATETYPE $service_perfdata_ File_template=datatype::serviceperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\tservicedesc:: $SERVICEDESC $\ Tserviceperfdata:: $SERVICEPERFDATA $\tservicecheckcommand:: $SERVICECHECKCOMMAND $\thoststate:: $HOSTSTATE $\ Thoststatetype:: $HOSTSTATETYPE $\tservicestate:: $SERVICESTATE $\tservicestatetype:: $SERVICESTATETYPE $\ Tserviceoutput:: $SERVICEOUTPUT $ #performance文件存储方式host_perfdata_file_mode =aservice_perfdata_file_mode=a# Performance file processing time interval Host_perfdata_file_processing_interval=15servIce_perfdata_file_processing_interval=15<pre name= "code" class= "plain" > #performance文件处理命令 
Host_perfdata_file_processing_command=process-host-perfdata-fileservice_perfdata_file_processing_command= Process-service-perfdata-file
6.2 Modify/USR/LOCAL/NAGIOS/ETC/OBJECTS/COMMANDS.CFG, add performance File Processing command
Define command{       command_name    process-service-perfdata-file       command_line    /bin/mv/usr/local/ Pnp4nagios/var/service-perfdata/usr/local/pnp4nagios/var/spool/service-perfdata. $TIMET $}define command{       Command_name    process-host-perfdata-file       command_line    /bin/mv/usr/local/pnp4nagios/var/ Host-perfdata/usr/local/pnp4nagios/var/spool/host-perfdata. $TIMET $}
6.3 Modify Nagios.cfg to set how the Pnp4nagios icon is displayed in the Nagios Web GUI

The first method adds the following to the templates.cfg, and only opens the image data in a new window.

define host {  name       host-pnp  action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_  register   0 }define service {  name       srv-pnp  action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$  register   

The second method can be moved to the Pnp4nagios icon when the mouse can be opened to the real-time icon, but the effect is not very good, follow the instructions to add the following:

Copy the Status-header.ssi to the/usr/local/nagios/share/ssi/directory and modify the TEMPLATES.CFG to include the following:

define host {     name       host-pnp     action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_     register   0 }define service {     name       srv-pnp     action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$     register   

Note: Automatic appearance of small window sharpness is bad, I like the first way


Note: This does not involve the configuration of email, remember to notify the design of the time of careful message flooding was complained ...

First article: Nagios Usage Introduction

Article three: Nagios monitored client Configuration and scripting implementation

Real-Life Nagios NSCA mode monitoring of Linux system Resource Usage--nagios configuration--Nagios server side

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.