監視軟體之二nagios

來源:互聯網
上載者:User

標籤:nagios

  • Nagios

     Nagios是一款開源的免費網路監視工具,能有效監控Windows、Linux和Unix的主機狀態,交換器路由器等網路裝置,印表機等。在系統或服務狀態異常時發出郵件或簡訊警示第一時間通知網站營運人員,在狀態恢複後發出正常的郵件或簡訊通知。


功能介紹

Nagios 可以監控的功能有:

1、監控網路服務(SMTP、POP3、HTTP、NNTP、PING等);

2、監控主機資源(處理器負荷、磁碟利用率等);

3、簡單地外掛程式設計使得使用者可以方便地擴充自己服務的檢測方法;

4、並行服務檢查機制;

5、具備定義網路分層結構的能力,用"parent"主機定義來表達網路主機間的關係,這種關係可被用來發現和明晰主機宕機或不可達狀態;

6、當服務或主機問題產生與解決時將警示發送給連絡人(通過EMail、簡訊、使用者定義方式);

7、可以定義一些處理常式,使之能夠在服務或者主機發生故障時起到預防作用;

8、自動的日誌滾動功能;

9、可以支援並實現對主機的冗餘監控;

10、可選的WEB介面用於查看當前的網路狀態、通知和故障曆史、記錄檔等;

11、可以通過手機查看系統監控資訊;

12、可指定自訂的事件處理控制器;


Nagios工作原理

  Nagios的功能是監控服務和主機,但是他自身並不包括這部分功能,所有的監控、檢測功能都是通過各種外掛程式來完成的。

  啟動Nagios後,它會周期性的自動調用外掛程式去檢測伺服器狀態,同時Nagios會維持一個隊列,所有外掛程式返回來的狀態資訊都進入隊列,Nagios每次都從隊首開始讀取資訊,並進行處理後,把狀態結果通過web顯示出來。

  Nagios提供了許多外掛程式,利用這些外掛程式可以方便的監控很多服務狀態。安裝完成後,在nagios主目錄下的/libexec裡放有nagios內建的可以使用的所有外掛程式,如,check_disk是檢查磁碟空間的外掛程式,check_load是檢查CPU負載的,等等。每一個外掛程式可以通過運行./check_xxx –h 來查看其使用方法和功能。


Nagios的四種監控狀態

        ok,   warn,   critial,   unknown 


Nagios各狀態監控需要用到的外掛程式

                check_by_ssh

check_nt

check_nrpe

check_nsca

check_snmp

check_xyz          --------->  代表可以自訂名字


=============================================================

                  部署nagios

nagios下載   https://www.nagios.org/downloads/nagios-core/thanks/?t=1503146125


下面以3.2.0版本的示範


部署nagios監控端 


1、安裝nagios核心


1) 安裝nagios依賴軟體 


[[email protected] ~]# yum install -y httpd mariadb-server php php-mysql gd php-gd


[[email protected] ~]# systemctl start httpd

[[email protected] ~]# systemctl enable httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.


[[email protected] ~]# systemctl start mariadb

[[email protected] ~]# systemctl enable mariadb

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.


2) 建立naigos使用者


[[email protected] ~]# groupadd nagcmd

[[email protected] ~]# useradd -G nagcmd nagios

[[email protected] ~]# usermod -aG nagcmd apache


3) 安裝nagios核心


[[email protected] ~]# tar zxf nagios-3.2.0.tar.gz 

[[email protected] ~]# cd nagios-3.2.0

[[email protected] nagios-3.2.0]# ./configure --with-command-group=nagcmd

[[email protected] nagios-3.2.0]# make all

[[email protected] nagios-3.2.0]# make install>>>產生nagios相關的檔案

[[email protected] nagios-3.2.0]# make install-init>>>產生nagios服務指令碼

[[email protected] nagios-3.2.0]# make install-commandmode>>>設定nagios許可權

[[email protected] nagios-3.2.0]# make install-config>>>組建組態檔案

[[email protected] nagios-3.2.0]# make install-webconf>>>產生httpd子設定檔



建立一個登入nagios web頁面的使用者,這個使用者帳號在以後通過web登入nagios時使用


[[email protected] ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password: 

Re-type new password: 

Adding password for user nagiosadmin

[[email protected] ~]# 



nagios目錄介紹:


/usr/local/nagios安裝目錄

/usr/local/nagios/etc設定檔

/usr/local/nagios/libexec外掛程式




2、安裝nagios外掛程式


# tar zxf nagios-plugins-1.5.tar.gz 

# cd nagios-plugins-1.5

# ./configure --with-nagios-user=nagios --with-nagios-group=nagios

# make && make install


通過# ls /usr/local/nagios/libexec/命令可查看到外掛程式表明外掛程式安裝成功


啟動nagios服務,並設定開機自啟動


[[email protected] ~]# /etc/init.d/nagios start

Reloading systemd:                                         [  確定  ]

Starting nagios (via systemctl):                           [  確定  ]

[[email protected] ~]# chkconfig --add nagios

[[email protected] ~]# chkconfig nagios on


[[email protected] ~]# systemctl restart httpd


登入nagios的web介面    http://原生IP/nagios

 








本文出自 “lyw666” 部落格,請務必保留此出處http://lyw666.blog.51cto.com/12823216/1957683

監視軟體之二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.