一起搭建linux監(jiān)控平臺之nagios(四)監(jiān)控端添加服務

 被監(jiān)控端工作已經(jīng)做好了,現(xiàn)在就只要在監(jiān)控端進行操作了;

創(chuàng)新互聯(lián)專注于企業(yè)成都營銷網(wǎng)站建設、網(wǎng)站重做改版、江陵網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、HTML5建站商城網(wǎng)站定制開發(fā)、集團公司官網(wǎng)建設、成都外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為江陵等各大城市提供網(wǎng)站開發(fā)制作服務。

注意一下:被監(jiān)控中MySQL記得要設密碼啊

添加服務類型也是2種:

1.web

  •   
  •  echo "define host{ 
  •          host_name                       $host 
  •          alias                           web-server 
  •          address                         $mysqlip 
  •          check_command                   check-host-alive 
  •          max_check_attempts              5 
  •          check_period                    24x7 
  •          contact_groups                  web-server 
  •          notification_interval           10 
  •          notification_period             24x7 
  •          notification_options            d,u,r 
  •          }" >> /usr/local/nagios/etc/objects/hosts.cfg 
  •  sed -i "11,15{/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          mysql-server              
  •                  }  
  •  define serviceescalation{  
  •                  host_name               $host  
  •                  service_description     Mysql-Listener        
  •                  first_notification      5  
  •                  last_notification       0  
  •                  notification_interval   10  
  •                  contact_groups          mysql-server  
  •                  }  
  •  define serviceescalation{  
  •                  host_name               $host  
  •                  service_description     Mysql-Status        
  •                  first_notification      5  
  •                  last_notification       0  
  •                  notification_interval   10  
  •                  contact_groups          mysql-server  
  •                  } " >> /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   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •          } 
  •  define service{ 
  •          host_name               $host 
  •          service_description     check_disk 
  •          check_command           check_nrpe!check_disk 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •          } 
  •    define service { 
  •          host_name               $host 
  •          service_description     SSH-Listener 
  •          check_command           check_tcp!22 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •          } 
  •  define service { 
  •          host_name               $host 
  •          service_description     Mysql-Listener 
  •          check_command           check_tcp!3306 
  •          max_check_attempts      4 
  •          normal_check_interval   2 
  •          retry_check_interval    1 
  •          check_period            24x7 
  •          notification_interval   2 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •          } 
  •  define service { 
  •          host_name               $host 
  •          service_description     Linux-Memory 
  •          check_command           check_nrpe!check_mem 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-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_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •          } 
  •  define service { 
  •          host_name               $host 
  •          service_description     Linux-total-procs 
  •          check_command           check_nrpe!check_total_procs 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •         } 
  •  define service{ 
  •          host_name               $host 
  •          service_description     Linux-CPU 
  •          check_command           check_nrpe!check_cpu 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-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_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •         } 
  •       define service{ 
  •          host_name               $host 
  •          service_description     Linux-iftraffic 
  •          check_command           check_nrpe!check_iftraffic!"eth0"!50!100!50!m 
  •          max_check_attempts      4 
  •          normal_check_interval   3 
  •          retry_check_interval    2 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          web-server 
  •          } 
  •  define service{ 
  •          host_name               $host 
  •          service_description     threads-connected 
  •          check_command           check_mysql_health!nagios!$nagiospwd!threads-connected!$mysqlip!3306! 
  •          max_check_attempts      4 
  •          normal_check_interval   2 
  •          retry_check_interval    1 
  •          check_period            24x7 
  •          notification_interval   10 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •         } 
  •  define service{ 
  •          host_name               $host 
  •          service_description     Mysql-Status 
  •          check_command           check_mysql 
  •          max_check_attempts      4 
  •          normal_check_interval   2 
  •          retry_check_interval    1 
  •          check_period            24x7 
  •          notification_interval   2 
  •          notification_period     24x7 
  •          notification_options    w,u,c,r 
  •          contact_groups          mysql-server 
  •         } " >> /usr/local/nagios/etc/objects/services.cfg 
  •  echo "###############add mysql services #

    文章題目:一起搭建linux監(jiān)控平臺之nagios(四)監(jiān)控端添加服務
    URL分享:http://muchs.cn/article12/ijcedc.html

    成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、ChatGPT、網(wǎng)頁設計公司、App開發(fā)、服務器托管、網(wǎng)站改版

    廣告

    聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

  • 成都網(wǎng)站建設公司