FreeBSD 下用nagios來監控網路伺服器和網路服務(1)

FreeBSD 下用nagios來監控網路伺服器和網路服務

nagios可以對伺服器進行全面的監控,包括服務(apache、mysql、ntp、dns、disk、qmail和sshd等等)的狀態,伺服器的狀態(up、down等等)。它是一個完全GPL協議的開源軟體包,包含有nagios主程序和它的各個插件,配置非常靈活,可以監視的項目很多,可以自定義shell腳本進行監控服務,非常適合大型網路。

nagios的包含主動監控和被動監控。

主動檢查是通過監控中心的主機發出請求,讓運行在遠程主機上的nrpe守護進程收集信息,然後報告它,它通過web介面把數據顯示在頁面上。

它的工作原理如下:

 

被動監控是當遠程被監控主機處於防火牆之內的時候,只有遠程主機可以訪問到監控中心,防火牆之內可以設置另外一個監控中心,遠程監控中心的nagios收集伺服器信息以後,和nsca報告,由naca客戶端報告naca的伺服器端,然後報告監控中心的nagios,通過web介面顯示監控結果。

nagios的功能非常強大, http://www.nagios.org是它的窩,只有e文、法文和日文,沒有中文,可惜啊。

俺現在引用它的一段文字進行總結一下到底什麼是nagios:

What Is This?

什麼是nagios?

Nagios® is a system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.

Nagios was originally designed to run under Linux, although it should work under most other unices as well.

Some of the many features of Nagios® include:

Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)

Monitoring of host resources (processor load, disk usage, etc.)

Simple plugin design that allows users to easily develop their own service checks

Parallelized service checks

Ability to define network host hierarchy using “parent” hosts, allowing detection of and distinction between hosts that are down and those that are unreachable

Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)

Ability to define event handlers to be run during service or host events for proactive problem resolution

Automatic log file rotation

Support for implementing redundant monitoring hosts

Optional web interface for viewing current network status, notification and problem history, log file, etc.

Nagios是一個監視系統和網路的應用程序。它監視你所指定主機和服務,當監視的內容變好或者變壞時發出警告。Nagios最初是被設計在Linux平台上運行的,然而現在在其他平台上也運行良好。

Nagios的特性包括:

監視網路服務(SMTP, POP3, HTTP, NNTP, PING, 等等)

監視主機資源(處理器負載、磁碟空間等)

容許用戶開發自己的插件去檢查自定義的項目;

通過使用「父主機」,定義網路主機的分層,容許探測主機down掉或者不可到達。

可以定義在主機或服務運行期間,事件發生以後如何處理和解決方式;

自動記錄錯誤日誌;

支持冗餘監視;

可選web介面,通過web頁面查看當前網路狀態,提示和報告故障歷史,日誌文件等;

Nagios的系統要求:

Linux、Unix等

apache

GD庫(1.63以上)

zlib

pnglib

jpeglib

basic icons

等,其中apache的安裝在blog中已經有相關的文章,搜索一下就行;gd、zlib、pnglib和jpeglib安裝比較簡單,步驟:

下載tarball

tar zxvf xxx.tar.gz

cd xxx

./configure

make && make install

———————————————————————-

Nagios的安裝過程(FreeBSD)

———————————————————————-

nagios的安裝比較簡單,複雜的是設置和配置參數的設定。不過你要放鬆一點,畢竟俺們要搞定它,不是嗎?那就開始吧:

1:獲得最新的安裝包,]http://www.nagios.org/download[/url]

2:以root身份登錄伺服器,目前最新的版本是2.5:

1)nagios,版本2.5:

fetch ]http://superb-west.dl.sourceforge.net/sourceforge/nagios/nagios-2.5.tar.gz[/url]

or

wget ]http://superb-west.dl.sourceforge.net/sourceforge/nagios/nagios-2.5.tar.gz[/url]

2)獲得nagios插件,版本1.4.3:

]http://surfnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.3.tar.gz[/url]

以下文章點擊率最高

Loading…

     

如果這文章對你有幫助,請掃左上角微信支付-支付寶,給於打賞,以助博客運營