centos7.3 快速安裝布暑nagios監控環境

來源:互聯網
上載者:User

標籤:nagios   centos7   centos7.3   

    目前越來越多的人都開始使用centos7了,就像win7超越xp一樣,新技術永遠是越來越讓人慢慢接受的。為了快速布暑,全部使用yum安裝。


環境

監控伺服器:192.168.88.21

被監控用戶端:192.168.88.22


關閉防火牆(全部伺服器)

#systemctl stop firewalld#systemctl disable firewalld#setenforce 0#sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config

更新時間同步(全部伺服器)

#yum install ntpdate#ntpdate cn.pool.ntp.org#echo "*/5 * * * * /usr/sbin/ntpdate cn.pool.ntp.org" >>/var/spool/cron/root

安裝epel源(全部伺服器)

#yum install epel-release

-----------------------------------------------------------------------

伺服器端安裝(192.168.88.21)

#yum install mariadb-server mariadb  //預設資料庫#yum install httpd php php-gd      //apache+php環境#yum install nagios nagios-plugins-all nagios-plugins-nrpe nrpe#mysql_secure_install  //初始化資料庫

設定nagios訪問使用者名稱和密碼,使用預設nagiosadmin和預設儲存位置,省心

#htpasswd -c /etc/nagios/passwd nagiosadmin 斷行符號,設定密碼
#systemctl start mariadb#systemctl start httpd#systemctl start nagios

登陸http://192.168.88.21/nagios/ 輸入之前設定的使用者名稱 nagiosadmin  及密碼,就可以登入了。

650) this.width=650;" src="https://s1.51cto.com/wyfs02/M02/91/22/wKioL1j0SomhRffyAAAvN9nqYz8099.jpg-wh_500x0-wm_3-wmp_4-s_3506329305.jpg" title="1.jpg" alt="wKioL1j0SomhRffyAAAvN9nqYz8099.jpg-wh_50" />

----------------------------------------------------------------------

監控伺服器端(192.168.88.21) 配置

添加nrpe的定義

#vi /etc/nagios/objects/commands.cfg
# ‘check_nrpe‘ command definitiondefine command{command_name check_nrpecommand_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$}# ‘check_nrpe_memory‘ command definitiondefine command{        command_name check_nrpe_memory        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mem}

建立監控主機設定檔

#vi /etc/nagios/objects/hosts.cfgdefine host{        use linux-server        host_name 192.168.88.22        alias 192.168.88.22        address 192.168.88.22}

建立監控服務組態檔

#vi /etc/nagios/objects/services.cfgdefine service {        use local-service        host_name 192.168.88.22        service_description check-host-alive        check_command check-host-alive}define service {        use generic-service        host_name 192.168.88.22        service_description Disk Partition        check_command check_nrpe!check_disk}define service {        use generic-service        host_name 192.168.88.22        service_description load        check_command check_nrpe!check_load}define service {        use generic-service        host_name 192.168.88.22        service_description memory        check_command check_nrpe_memory}define service {        use generic-service        host_name 192.168.88.22        service_description swap        check_command check_nrpe!check_swap}
#nagios -v /etc/nagios/nagios.cfg  檢測設定檔是否正確#systemctl restart nagios 重啟一下 nagios

----------------------------------------------------------------------

監控用戶端安裝(192.168.88.22):

安裝被監控的外掛程式及nrpe

#yum install nagios-plugins-nrpe nrpe nagios-plugins-all

配置nrpe

#vi /etc/nagios/nrpe.cfg allowed_hosts=127.0.0.1,192.168.88.21   #允許被伺服器監控command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10%command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%command[check_iostat]=/usr/lib64/nagios/plugins/check_iostat -d sda -w 1000 -c 2000command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w 80 -c 70#echo ‘nrpe:192.168.88.21‘ >>/etc/hosts.allow

check_iostat所需要命令

#yum install sysstat bc

check_mem和check_iostat這二個檢測外掛程式,

請看附件下載,並解壓到/usr/lib64/nagios/plugins 目錄下


啟動nrpe

#systemctl start nrpe

---------------------------------------------------

開啟瀏覽器,查看一下,是否能正常監控到資料了:

650) this.width=650;" src="https://s1.51cto.com/wyfs02/M02/91/26/wKiom1j0VifBej-kAAEe0e08_Js791.jpg-wh_500x0-wm_3-wmp_4-s_2465550235.jpg" title="2.jpg" alt="wKiom1j0VifBej-kAAEe0e08_Js791.jpg-wh_50" />


本文出自 “生命不息 奮鬥不止” 部落格,請務必保留此出處http://shenfly231.blog.51cto.com/12811004/1916641

centos7.3 快速安裝布暑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.