1. 程式人生 > >Nagios+OMSA監控dell裝置硬體

Nagios+OMSA監控dell裝置硬體

現在監控軟體非常多,nagios,zbbiax什麼數不勝數,不過現在最多的還是nagios和zbbiax、cacti監控工具。
下面我們就來說一下,如果使用nagios來監測dell伺服器的硬體,這樣你就可以像監控服務那樣監控伺服器的各種硬體狀態了!

準備工作:
1、伺服器端
服務端我這邊使用的centos6.3的系統,執行nagios最高的版本(這個版本其實是無所謂的),因為資源的原因,我服務端用的虛擬機器。

2、被檢測端
這個一定要使用一臺dell的實體機,具體是R410是12代的什麼伺服器俺就不管了。

開始部署:
1、伺服器端
我這裡提前安裝了nagios,如果你不知道怎麼搭建nagios的話,建議你去google上面搞明白在了過來看這裡,反正文多檔的是!

2、下載check_openmanage這個指令碼程式,把他放在nagios的libexec外掛庫中,然後到/nagios/etc/objects/目錄中修改commands.cfg
新增如下資訊:
define command{
command_name omsa_status
command_line $USER1$/check_openmanage -H $HOSTADDRESS$
}
#對mosa進行整體檢測
define command{
command_name omsa_cpu
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ –only cpu -p
}
#檢測cpu硬體
define command{
command_name omsa_temp
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ –only temp -w $ARG1$ -c $ARG2$ -P
}
#對伺服器的溫度進行監控,同時自定義閥值
define command{
command_name omsa_storage
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ –only srotage -p
}
#對儲存裝置進行監控
define command{
command_name omsa_intrusion
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ –only intrusion -p
}
#對伺服器機箱鎖狀態進行監控
define command{
command_name omsa_fans
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ –only fans -p
}

這個是監控記憶體的,only有如下引數:
critical Only output critical alerts. It is possible to use the –check option together with this option to adjust checks.
warning Only output warning alerts. It is possible to use the –check option together with this option to adjust checks.
chassis Only check chassis components, i.e. everything but storage and log content.
storage Only check storage components
memory Only check memory modules
fans Only check fans
power Only check power supplies
temp Only check temperatures
cpu Only check processors
voltage Only check voltage probes
batteries Only check batteries
amperage Only check power usage
intrusion Only check chassis intrusion
sdcard Only check removable flash media
esmhealth Only check ESM log health
esmlog Only check ESM log content
alertlog Only check alertlog content

3、下面新增services.cfg

define service {
use test
host_name test01
service_description omsa_cpu
check_command omsa_cpu
}
我只是列舉了一條,如果你在發現為什麼是omsa_cpu,這個omsa是什麼的話,我們一會兒說到被監控端的時候在詳細說下。
這樣,我們的伺服器端就部署ok,下面來說被監控端。

我在被監控端上面的作業系統同樣是centos6.3,伺服器型號是R410.首先我要做的就是安裝dell的OMSA管理元件。我們就是通過這個玩意來監控伺服器的硬體的。

4、安裝步驟如下:
官方網址:http://linux.dell.com/repo/hardware/
安裝方法(centos linux 6.3×64):
被監控伺服器:使用yum安裝
1) 增加dell的yum庫
wget -q -O – http://linux.dell.com/repo/hardware/OMSA_6.5.2/bootstrap.cgi | bash(這個版本太老了,如果出現問題,dell客服會讓你安裝下面的版本,也是最新的版本)
wget -q -O – http://linux.dell.com/repo/hardware/OMSA_7.3/bootstrap.cgi | bash

2) 安裝srvadmin(這個很重要,所有的元件全在這個裡面,如果系統比較完整,需要安裝42個包;稍微次一點,需要安裝60多個包呢)
Installing OpenManage Server Administrator
yum install srvadmin-all

3)安裝firmware-tools(這個是升級主機板用的,如果你用不到這樣的功能,可以不用安裝,我測試過不安裝不影響服務的)
Installing firmware-tools to manage BIOS and firmware updates
yum install dell_ft_install
這個是你在瀏覽器裡面輸入https://主機ip:1311,你就可以進入OMSA的web介面了,使用者名稱是root,密碼是系統密碼!

這樣,你就可以監控到所有的資訊了!
下面我附上check_openmanage的官方說明:
http://folk.uio.no/trondham/software/check_openmanage.html

有的文章說可以使用nrpe的模式來監控,會降低nagios的效能損耗,不過我沒有測試過!