現在監控軟件非常多,nagios,zbbiax什麼數不勝數,不過現在最多的還是nagios和zbbiax、cacti監控工具。
下面我們就來說一下,如果使用nagios來監測dell服務器的硬件,這樣你就可以像監控服務那樣監控服務器的各種硬件狀態了!
準備工作:
1、服務器端
服務端我這邊使用的centos6.3的系統,運行nagios最高的版本(這個版本其實是無所謂的),因爲資源的原因,我服務端用的虛擬機。
2、被檢測端
這個一定要使用一臺dell的實體機,具體是R410是12代的什麼服務器俺就不管了
開始部署:
1、服務器端
我這裏提前安裝了nagios,如果你不知道怎麼搭建nagios的話,建議你去google上面搞明白在了過來看這裏,反正文多檔的是!
下載check_openmanage這個腳本程序,把他放在nagios的libexec插件庫中,然後到/nagios/etc/objects/目錄中修改commands.cfg
添加如下信息:
1 define command{
2 command_name omsa_status
3 command_line $USER1$/check_openmanage -H $HOSTADDRESS$
4 }
5 #對mosa進行整體檢測
6 define command{
7 command_name omsa_cpu
8 command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only cpu -p
9 }
10 #檢測cpu硬件
11 define command{
12 command_name omsa_temp
13 command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only temp -w $ARG1$ -c $ARG2$ -P
14 }
15 #對服務器的溫度進行監控,同時自定義閥值
16 define command{
17 command_name omsa_storage
18 command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only srotage -p
19 }
20 #對存儲設備進行監控
21 define command{
22 command_name omsa_intrusion
23 command_line $USER1$/check_openmanage -H $HOSTADDRESS$ --only intrusion -p
24 }
25 #對服務器機箱鎖狀態進行監控
26 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
下面添加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管理組件。我們就是通過這個玩意來監控服務器的硬件的。
安裝步驟如下:
官方網址:http://linux.dell.com/repo/hardware/
安裝方法(centos linux 6.3x64):
被監控服務器:使用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的性能損耗,不過我沒有測試過!