centos7安裝nagios

來源:互聯網
上載者:User

標籤:ali   檢查   oca   roc   使用者   efi   chmod   check   objects   

一、服務端配置:

  1. 安裝軟體:
    yum  -y  install  nagios  nagios-plugins  nagios-plugins-all  nagios-plugins-nrpe  nrpe
  2. 修改nagios主設定檔:vim /etc/nagios/nagios.cfg
    cfg_dir=/etc/nagios/conf.d  #確保其中有這行代碼

  3. 修改cgi設定檔,添加使用者:vim /etc/nagios/cgi.cfg
    authorized_for_system_information=nagiosadmin,leeauthorized_for_configuration_information=nagiosadmin,leeauthorized_for_system_commands=nagiosadmin,leeauthorized_for_all_services=nagiosadmin,leeauthorized_for_all_hosts=nagiosadmin,leeauthorized_for_all_service_commands=nagiosadmin,leeauthorized_for_all_host_commands=nagiosadmin,lee

  4. 修改命令設定檔command.cfg:vim /etc/nagios/objects/commands.cfg
    #添加define command{command_name  check_nrpecommand_line  $USER1/check_nrpe  -H  $HOSTADDRESS  -c  $ARG1}

  5. 修改連絡人設定檔:vim /etc/nagios/objects/contacts.cfg
    define contact{    contact_name                    nagiosadmin     use             generic-contact         alias                           Nagios Admin            email                           [email protected]    }define contactgroup{    contactgroup_name       admins    alias                   Nagios Administrators    members                 nagiosadmin    }
  6. 添加遠程主機的監控指令(可以用本地設定檔/etc/nagios/objects/localhost.cfg作為模板):
    cp -arf /etc/nagios/objects/localhost.cfg /etc/nagios/conf.d/lee.cfg
    vim /etc/nagios/conf.d/lee.cfg
    define host{    use                     linux-server                host_name               lee    alias                   lee    address                 192.168.8.82    }#去掉這組定義#define hostgroup{#        hostgroup_name  linux-servers #        alias           Linux Servers #        members         lee     #        }define service{    use                             local-service             host_name                       lee    service_description             PINGcheck_command           check_ping!100.0,20%!500.0,60%    }define service{    use                             local-service             host_name                       lee    service_description             Root Partitioncheck_command           check_local_disk!20%!10%!/    }define service{    use                             local-service             host_name                       lee    service_description             Current Userscheck_command           check_local_users!20!50    }define service{    use                             local-service             host_name                       lee    service_description             Total Processescheck_command           check_local_procs!250!400!RSZDT    }define service{    use                             local-service             host_name                       lee    service_description             Current Loadcheck_command           check_local_load!5.0,4.0,3.0!10.0,6.0,4.0    }define service{    use                             local-service             host_name                       lee    service_description             Swap Usagecheck_command           check_local_swap!20!10    }define service{    use                             local-service             host_name                       lee    service_description             SSHcheck_command           check_sshnotifications_enabled       0    }define service{    use                             local-service             host_name                       lee    service_description             HTTPcheck_command           check_httpnotifications_enabled       0    }
  7. 檢查設定檔文法:
    nagios -v /etc/nagios/nagios.cfg
  8. 修改nagios相關目錄許可權:
    chown  nagios.nagios  /etc/logrotate.d/nagioschmod  g+w  /etc/logrotate.d/nagioschown  -R  nagios.nagios  /etc/nagios
  9. 設定apache賬戶密碼:
    htpasswd  -c  /etc/nagios/passwd  lee
  10. 啟動服務:
    systemctl  start  httpdsystemctl  start  nagios

    二、用戶端配置:

  11. 安裝軟體:
    yum  -y  install  nagios-plugins  nagios-plugins-nrpe  nrpe
  12. 修改 nrpe 主設定檔:vim /etc/nagios/nrpe.cfg
    #添加服務端ipallowed_hosts=127.0.0.1,192.168.8.81

  13. 啟動nrpe服務:
    systemctl  start  nrpe

    三、測試:

centos7安裝nagios

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.