Nagios Deployment Configuration Process
Nagios Service side:
1. Deploy Nagios Server (refer to Nagios official deployment documentation), Nagios-plugin, PHP, apache2
2, need to add/etc/hosts in the service side of the resolution
3. Configuration file Description
Configure the host directory to be monitored in nagios.cfg dir_cfg=path/to/somewhere files under this path are named with the hostname, ending with. cfg
Commands.cfg
Configure accept Nrpe command required in COMMANDS.CFG configuration, the template is as follows:
# ' Check_nrpe ' command definition
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$
}
#配置邮箱报警, Alarm
Define Command {
Command_name SendEmail
Command_line $USER 1$/sendemail/sendemail.pl-f "[email protected]"-T $CONTACTEMAIL $-S Smtp.mxhichina.com:80-u "* * $HOS tname$--$HOSTNAME $ $HOSTSTATE $ * * "-xu [email protected]-xp ' [email protected] '-M ' * * * * * New_nagios Notification *****\ N\nnotification type: $NOTIFICATIONTYPE $\n\nservice: $SERVICEDESC $\nhostname: $HOSTALIAS $\nip$hostname$\nstatus: $ Servicestate$\n\ntime: $LONGDATETIME $\n\nserviceoutput:\n\n$serviceoutput$ "}
Define Command {
Command_name wei_baojing
Command_line $USER 1$/wei_baojing.py "notification type: $NOTIFICATIONTYPE $<br><br> service: $SERVICEDESC $<br> Host: $ Hostalias$<br>ip Address: $HOSTNAME $<br> Status: $SERVICESTATE $<br><br> datetime: $LONGDATEME $<br> <br> Additional information:<br><br> $SERVICEOUTPUT $ "
}
Templates.cfg templates that need to be configured for monitoring
Define Service {
Service_description GENERIC-ZZCBJ
Name GENERIC-ZZCBJ
Contacts ZZCBJ
Check_period 24x7
Notification_period 24x7
Max_check_attempts 1
Check_interval 3
Retry_interval 1
Notification_interval 5
Notification_options w,u,c,r,f
First_notification_delay 0
Register 0
Active_checks_enabled 1
Passive_checks_enabled 1
Notifications_enabled 1
}
Localhost.cfg Monitoring Native Configuration
Contacts.cfg
#配置 Mail Alerts
Define Contact {
Contact_Name ZZCBJ
Alias ZZCBJ
email [email protected],[email protected]
Pager Admin
Host_notification_period 24x7
Service_notification_period 24x7
Host_notification_options d,u,r,f,s
Service_notification_options w,u,c,r,f,s
Register 1
Host_notification_commands sendemail,wei_baojing
Service_notification_commands sendemail,wei_baojing
#host_notification_commands WEIXIN_YWTS
#service_notification_commands WEIXIN_YWTS
}
You can check the configuration file for problems after configuration file configuration is complete
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Or
/etc/init.d/nagios Configtest
Client: Nrpe nagios-plugins Installation
Monitoring scripts placed in/usr/local/nagios/libexec/
/USR/LOCAL/NAGIOS/ETC/NRPE.CFG configuring Nagios server-side addresses
Script path scripts configured in the/usr/local/nagios/etc/nrpe.cfg file to be monitored from/usr/local/nagios/libexec/
Nagios Deployment Configuration Process