The use of Linux monitoring platform Nagios (iv) Monitor-side Add service

Source: Internet
Author: User
Tags linux

The monitoring side of the work has been done, now as long as the monitoring side of the operation;

Note: be monitored MySQL remember to set the password AH

The addition of service types is also 2:

1.web Server

2.mysql Server

The following is a script to add a Web service:

WebServices () {read-p "" Please input the Web server IP: "Webip read-p" please input the Web alias name: "                           Host echo "define host{host_name $host alias Web-server address $webip Check_command Check-hos T-alive max_check_attempts 5 Check_period 24x7 cont             Act_groups Web-server Notification_interval Notification_period 24x7 notification_options D,u,r} ">>/usr/local/nagios/etc/objects/h    
 Osts.cfg sed-i "6,10{/members/s/$/, $host/}"/usr/local/nagios/etc/objects/hostgroups.cfg echo "      Define hostescalation{host_name $host first_notification                  5   
                 Last_notification 0 Notification_interval 10 Contact_groups Web-server} define Serviceescal           
                 ation{host_name $host service_description Nginx-listener     
                 First_notification 5 last_notification 0 Notification_interval contact_groups Web-server} define S erviceescalation{host_name $host service_description linux-     
                 Php-procs first_notification 5 last_notification 0     
 Notification_interval contact_groups Web-server} Define Serviceescalation{host_name $host service_description linux-iftraffic     
                 First_notification 5 last_notification 0 Notification_interval contact_groups Web-server} define S erviceescalation{host_name $host service_description check-     
                 IPs first_notification 5 last_notification 0 Notification_interval contact_groups Web-server} ">&G T               /usr/local/nagios/etc/objects/escalations.cfg echo "Define service{HOST_NAME     
         $host service_description check-host-alive Check_command check-host-alive Max_cheCk_attempts 4 normal_check_interval 3 retry_check_interval 2 Check_period 24x7 Notification_interval Notification_period 24x7 Notificati    
         On_options w,u,c,r contact_groups Web-server} define Service{ HOST_NAME $host service_description disk-/check_command check_loc al_disk!10%!5%!/max_check_attempts 4 normal_check_interval 3 retry_check_in Terval 2 check_period 24x7 Notification_interval Notification_pe    
      Riod 24x7 notification_options w,u,c,r contact_groups Web-server}    
         Define service{host_name $host service_description Ssh-listener Check_command          Check_tcp!22 max_check_attempts 4 normal_check_interval 3 retry_ch Eck_interval 2 check_period 24x7 Notification_interval Notificat    
         Ion_period 24x7 notification_options w,u,c,r contact_groups web-server } define service{host_name $host service_description nginx-list Ener Check_command check_tcp!80 max_check_attempts 4 normal_check_in Terval 2 retry_check_interval 1 check_period 24x7 Notification_inte Rval 2 notification_period 24x7 notification_options w,u,c,r Contact_group S web-server} define service{host_name $host ser Vice_description LinUx-memory Check_command Check_nrpe!check_mem max_check_attempts 4 No Rmal_check_interval 3 retry_check_interval 2 check_period 24x7 Noti    
         Fication_interval notification_period 24x7 Notification_options w,u,c,r    
         Contact_groups Web-server} define service{host_name $host Service_description linux-load Check_command check_nrpe!check_load max_ Check_attempts 4 normal_check_interval 3 retry_check_interval 2 Check_per IoD 24x7 Notification_interval Notification_period 24x7 notific    
         Ation_options w,u,c,r contact_groups Web-server} define Service{          Host_name     $host service_description Linux-total-procs Check_command check_nrpe!check_to    Tal_procs max_check_attempts 4 normal_check_interval 3 Retry_check_interval     2 Check_period 24x7 Notification_interval notification_period    
      24x7 notification_options w,u,c,r contact_groups Web-server}    
         Define service{host_name $host service_description Linux-php-procs Check_command Check_nrpe!check_php_procs max_check_attempts 4 normal_check_ Interval 3 retry_check_interval 2 check_period 24x7 notification_in Terval 5 notification_period 24x7 notification_options w,u,c,r Contact_gro UPS Web-server   
         Define service{host_name $host service_description L Inux-cpu Check_command check_nrpe!check_cpu max_check_attempts 4 nor Mal_check_interval 3 retry_check_interval 2 check_period 24x7 Notif    
         Ication_interval notification_period 24x7 Notification_options w,u,c,r    
         Contact_groups Web-server} define service{host_name $host Service_description linux-user Check_command check_nrpe!check_users max_ Check_attempts 4 normal_check_interval 3 retry_check_interval 2 Check_per IoD 24x7 Notification_interval Notification_period 24x7 notific Ation_options W,u,c,r    
         Contact_groups Web-server} define service{host_name    
         $host service_description check-ips Check_command check_nrpe!check_ips    
         Max_check_attempts 4 Normal_check_interval 2 Retry_check_interval 2    
         Check_period 24x7 Notification_interval 8 Notification_period 24x7 Notification_options w,u,c,r contact_groups web-server} define Service {host_name $host service_description linux-iftraffic Check_comma nd check_nrpe!check_iftraffic! " Eth0 "!50!100!50!m max_check_attempts 4 normal_check_interval 4 retry_check_i    
       Nterval 2 Check_period 24x7 Notification_interval 5  Notification_period 24x7 notification_options w,u,c,r contact_groups web-serve R} ">>/usr/local/nagios/etc/objects/services.cfg echo" ############### Add web-server ser Vices completed ######## "}

Related Article

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.