基于Zabbix IPMI監(jiān)控服務(wù)器硬件狀況

公司有多個分部铜异,且機(jī)房沒有專業(yè)值班趾盐,機(jī)房等級不夠久窟。在這種情況下本缠,又想實(shí)時監(jiān)控機(jī)房環(huán)境,于是使用IPMI方式來達(dá)到目的匾灶。由于之前已經(jīng)部署了Zabbix監(jiān)控系統(tǒng)哩治,本次將結(jié)合Zabbix自帶的IPMI,完成服務(wù)器溫度及風(fēng)扇轉(zhuǎn)速等的監(jiān)控。

1.環(huán)境說明

被監(jiān)控端服務(wù)器型號:Dell PowerEdge R510
規(guī)劃分配的IPMI地址: 10.103.1.100

2.Zabbix監(jiān)控平臺說明

Zabbix版本: 3.2.1妖啥,在安裝時怀读,未使用--with-openipmi
Zabbix網(wǎng)絡(luò)接口可以連通10.103.1.100

3.前置學(xué)習(xí)

維基百科IPMI: http://zh.wikipedia.org/wiki/IPMI
IBM DeveloperWorks -- 使用ipmitool實(shí)現(xiàn)Linux系統(tǒng)下對服務(wù)器的ipmi管理: http://www.ibm.com/developerworks/cn/linux/l-ipmi/
Dell -- Managing Dell PowerEdge Servers Using IPMItool:http://www.dell.com/downloads/global/power/ps4q04-20040204-Murphy.pdf
Zabbix IPMI checks:https://www.zabbix.com/documentation/2.0/manual/config/items/itemtypes/ipmi
使用IPMITOOL實(shí)現(xiàn)終端重定向(課外讀物):http://docs.linuxtone.org/ebooks/Dell/ipmitool.pdf

4.配置IPMI

4.1.配置IPMI地址

可以參考前置推薦中的《Managing Dell PowerEdge Servers Using IPMItool》在服務(wù)器啟動時進(jìn)行IPMI地址的配置啤誊,并開啟IPMI Over LAN稚瘾。
也可以使用Dell的iDRAC開啟IPMI功能,具體可以查看文章最后的參考資料。


QQ截圖20161116003506.png

4.2.獲取傳感器信息

登錄Zabbix服務(wù)器,通過ipmitool遠(yuǎn)程訪問Dell服務(wù)器傳感器信息

# ipmitool -I lan -H 10.103.1.100 -U root -P calvin -L user sensor list
# ipmitool -I lan -H 10.103.1.100 -U root -P calvin -L user sensor get "FAN MOD 1B RPM"
Paste_Image.png
Paste_Image.png

4.3.安裝IPMItool軟件包

# yum -y install OpenIPMI OpenIPMI-devel ipmitool freeipmi

4.4.配置Zabbix

注:為了支持IPMI,需要在zabbix server/proxy安裝時增加--with-openipmi參數(shù)

服務(wù)器端配置zabbix IPMI pollers
zabbix_server.conf/zabbix_proxy.conf

# sed -i '/# StartIPMIPollers=0/aStartIPMIPollers=5' zabbix_server.conf
# service zabbix-server restart

4.5.導(dǎo)入監(jiān)控模板

下面提供DELL的2個型號的IPMI模板:
template-ipmi-dell-poweredge-r510
template-ipmi-dell-poweredge-2950
添加監(jiān)控主機(jī),關(guān)聯(lián)上本模板熄捍,并在IPMI頁面碟贾,設(shè)置Authentication algorithmDefault, Privilege levelUser, Usernamesensor, Passwordsensor_pass,保存即可搀暑。
使用此種方法獲取數(shù)據(jù)的結(jié)果就是效率很差桐罕,基本沒什么數(shù)據(jù)。

5.使用Zabbix External checks自定義IPMI

本來是選擇nagios的IPMI插件:check_ipmi_sensor桂敛,文件是:check_ipmi_sensor_v3-v3.9.tar.gz
具體使用方法詳見:http://www.thomas-krenn.com/en/wiki/IPMI_Sensor_Monitoring_Plugin

5.1.安裝perl-IPC-Run模塊

yum -y install perl-IPC-Run perl-Getopt-Long

5.2.使用check_ipmi_sensor查看效果

但是發(fā)現(xiàn)報錯薪伏,顯示格式又不友好蚂斤。

# ./check_ipmi_sensor -f ipmi.cfg -H 10.103.1.100 -vvv
------------- debug output for sel (-vvv is set): ------------
  /usr/sbin/ipmi-sel was executed with the following parameters:
    /usr/sbin/ipmi-sel -h 10.103.1.100 --config-file ipmi.cfg --driver-type=LAN_2_0 --output-event-state --interpret-oem-data --entity-sensor-names
  output of FreeIPMI:
ID  | Date        | Time     | Name                                        | Type                     | State    | Event
1   | Apr-08-2011 | 06:42:13 | System Board SEL                            | Event Logging Disabled   | Nominal  | Log Area Reset/Cleared
2   | Jan-01-1970 | 08:00:31 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
3   | Jan-01-1970 | 08:00:36 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
4   | Aug-15-2011 | 23:09:53 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
5   | Aug-16-2011 | 11:38:25 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
6   | Aug-16-2011 | 11:38:25 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
7   | Aug-16-2011 | 11:38:55 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
8   | Jun-10-2012 | 22:41:13 | System Board Ambient Temp                   | Temperature              | Warning  | Upper Non-critical - going high ; Sensor Reading = 45.00 C ; Threshold = 45.00 C
9   | Jun-11-2012 | 02:53:53 | System Board Ambient Temp                   | Temperature              | Nominal  | Upper Non-critical - going high ; Sensor Reading = 43.00 C ; Threshold = 45.00 C
10  | Nov-05-2012 | 21:56:42 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
11  | Nov-14-2012 | 21:53:58 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
12  | Nov-14-2012 | 21:53:58 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
13  | Nov-14-2012 | 21:54:19 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
14  | Nov-15-2012 | 16:12:03 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
15  | Nov-17-2012 | 17:14:34 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
16  | Nov-17-2012 | 17:14:34 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
17  | Nov-17-2012 | 17:15:40 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
18  | Nov-19-2012 | 20:47:57 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
19  | Nov-19-2012 | 20:50:04 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
20  | Jan-01-1970 | 08:00:33 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
21  | Jan-01-1970 | 08:00:38 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
22  | Jun-27-2014 | 17:27:38 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
23  | Jun-27-2014 | 17:27:53 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
24  | Jan-01-1970 | 08:00:31 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
25  | Jan-01-1970 | 08:00:36 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
26  | Oct-31-2016 | 05:48:35 | System Board Ambient Temp                   | Temperature              | Warning  | Lower Non-critical - going low ; Sensor Reading = 8.00 C ; Threshold = 8.00 C
27  | Oct-31-2016 | 09:00:38 | System Board Ambient Temp                   | Temperature              | Nominal  | Lower Non-critical - going low ; Sensor Reading = 10.00 C ; Threshold = 8.00 C
------------- debug output for sensors (-vvv is set): ------------
  script was executed with the following parameters:
    ./check_ipmi_sensor -f ipmi.cfg -H 10.103.1.100 -vvv
  check_ipmi_sensor version:
    3.9
  FreeIPMI version:
    ipmi-sensors - 1.2.9
  FreeIPMI was executed with the following parameters:
    /usr/sbin/ipmi-sensors -h 10.103.1.100 --config-file ipmi.cfg --quiet-cache --sdr-cache-recreate --interpret-oem-data --output-sensor-state --ignore-not-available-sensors --driver-type=LAN_2_0 --output-sensor-thresholds
  FreeIPMI return code: 0
  output of FreeIPMI:
Record ID | Sensor Name | Sensor Group | Monitoring Status | Sensor Units | Sensor Reading
5 | Ambient Temp | Temperature | Nominal | C | 28.000000
7 | CMOS Battery | Battery | Nominal | N/A | 'OK'
8 | VCORE PG | Voltage | Nominal | N/A | 'State Deasserted'
9 | VCORE PG | Voltage | Nominal | N/A | 'State Deasserted'
10 | 0.75 VTT PG | Voltage | Nominal | N/A | 'State Deasserted'
11 | 0.75 VTT PG | Voltage | Nominal | N/A | 'State Deasserted'
12 | CPU VTT PG | Voltage | Nominal | N/A | 'State Deasserted'
13 | 1.5V PG | Voltage | Nominal | N/A | 'State Deasserted'
14 | 1.8V PG | Voltage | Nominal | N/A | 'State Deasserted'
15 | 5V PG | Voltage | Nominal | N/A | 'State Deasserted'
16 | MEM CPU2 FAIL | Voltage | Nominal | N/A | 'State Deasserted'
17 | 5V Riser PG | Voltage | Nominal | N/A | 'State Deasserted'
18 | MEM CPU1 FAIL | Voltage | Nominal | N/A | 'State Deasserted'
19 | VTT CPU2 FAIL | Voltage | Nominal | N/A | 'State Deasserted'
20 | VTT CPU1 FAIL | Voltage | Nominal | N/A | 'State Deasserted'
21 | 0.9V PG | Voltage | Nominal | N/A | 'State Deasserted'
22 | CPU2 1.8 PLL PG | Voltage | Nominal | N/A | 'State Deasserted'
23 | CPU1 1.8 PLL PG | Voltage | Nominal | N/A | 'State Deasserted'
24 | 1.1 FAIL | Voltage | Nominal | N/A | 'State Deasserted'
25 | 1.0 LOM FAIL | Voltage | Nominal | N/A | 'State Deasserted'
26 | 1.0 AUX FAIL | Voltage | Nominal | N/A | 'State Deasserted'
27 | Heatsink Pres | Entity Presence | Nominal | N/A | 'Entity Present'
28 | iDRAC6 Ent Pres | Entity Presence | Critical | N/A | 'Entity Absent'
29 | USB Cable Pres | Entity Presence | Nominal | N/A | 'Entity Present'
31 | Riser Presence | Entity Presence | Nominal | N/A | 'Entity Present'
32 | FAN MOD 1A RPM | Fan | Nominal | RPM | 3480.000000
34 | FAN MOD 2A RPM | Fan | Nominal | RPM | 3480.000000
36 | FAN MOD 3A RPM | Fan | Nominal | RPM | 3480.000000
39 | FAN MOD 4A RPM | Fan | Nominal | RPM | 3480.000000
40 | Presence | Entity Presence | Nominal | N/A | 'Entity Present'
41 | Presence | Entity Presence | Nominal | N/A | 'Entity Present'
42 | Presence | Entity Presence | Nominal | N/A | 'Entity Present'
43 | Presence | Entity Presence | Nominal | N/A | 'Entity Present'
44 | Presence  | Entity Presence | Nominal | N/A | 'Entity Present'
45 | Status | Processor | Nominal | N/A | 'Processor Presence detected'
46 | Status | Processor | Nominal | N/A | 'Processor Presence detected'
47 | Status | Power Supply | Nominal | N/A | 'Presence detected'
48 | Current | Current | Nominal | A | 0.400000
49 | Current | Current | Nominal | A | 0.400000
50 | Voltage | Voltage | Nominal | V | 218.000000
51 | Voltage | Voltage | Nominal | V | 218.000000
52 | Status | Power Supply | Nominal | N/A | 'Presence detected'
53 | Status | Cable/Interconnect | Nominal | N/A | 'Cable/Interconnect is connected'
54 | OS Watchdog | Watchdog 2 | Nominal | N/A | 'OK'
56 | Intrusion | Physical Security | Nominal | N/A | 'OK'
57 | PS Redundancy | Power Supply | Nominal | N/A | 'Fully Redundant'
58 | Fan Redundancy | Fan | Nominal | N/A | 'Fully Redundant'
60 | System Level | Current | Nominal | W | 168.000000
61 | Power Optimized | OEM Reserved | Nominal | N/A | 'Good'
62 | Drive | Drive Slot | Nominal | N/A | 'Drive Presence'
65 | Cable SAS A | Cable/Interconnect | Nominal | N/A | 'Cable/Interconnect is connected'
66 | Cable SAS B | Cable/Interconnect | Nominal | N/A | 'Cable/Interconnect is connected'
67 | DKM Status | OEM Reserved | N/A | N/A | 'OEM Event = 0000h'
119 | FAN MOD 5A RPM | Fan | Nominal | RPM | 3480.000000

--------------------- end of debug output ---------------------
IPMI Status: Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 737.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 738.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 749.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in concatenation (.) or string at ./check_ipmi_sensor line 750.
Use of uninitialized value in string ne at ./check_ipmi_sensor line 759.
Critical [iDRAC6 Ent Pres = Critical ('Entity Absent'), System Board Intrusion = Critical (Physical Security), System Board Intrusion = Critical (Physical Security), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), System Board Ambient Temp = Warning (Temperature), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), Disk Drive Bay 1 Drive 2 = Critical (Drive Slot), System Board Intrusion = Critical (Physical Security), System Board Intrusion = Critical (Physical Security), System Board Intrusion = Critical (Physical Security), System Board Intrusion = Critical (Physical Security), System Board Ambient Temp = Warning (Temperature)] | 'Ambient Temp'=28.000000;:;: 'FAN MOD 1A RPM'=3480.000000;:;: 'FAN MOD 2A RPM'=3480.000000;:;: 'FAN MOD 3A RPM'=3480.000000;:;: 'FAN MOD 4A RPM'=3480.000000;:;: 'Current'=0.400000;:;: 'Current'=0.400000;:;: 'Voltage'=218.000000;:;: 'Voltage'=218.000000;:;: 'System Level'=168.000000;:;: 'FAN MOD 5A RPM'=3480.000000;:;:
Ambient Temp = 28.000000 (Status: Nominal)
CMOS Battery = 'OK' (Status: Nominal)
VCORE PG = 'State Deasserted' (Status: Nominal)
VCORE PG = 'State Deasserted' (Status: Nominal)
0.75 VTT PG = 'State Deasserted' (Status: Nominal)
0.75 VTT PG = 'State Deasserted' (Status: Nominal)
CPU VTT PG = 'State Deasserted' (Status: Nominal)
1.5V PG = 'State Deasserted' (Status: Nominal)
1.8V PG = 'State Deasserted' (Status: Nominal)
5V PG = 'State Deasserted' (Status: Nominal)
MEM CPU2 FAIL = 'State Deasserted' (Status: Nominal)
5V Riser PG = 'State Deasserted' (Status: Nominal)
MEM CPU1 FAIL = 'State Deasserted' (Status: Nominal)
VTT CPU2 FAIL = 'State Deasserted' (Status: Nominal)
VTT CPU1 FAIL = 'State Deasserted' (Status: Nominal)
0.9V PG = 'State Deasserted' (Status: Nominal)
CPU2 1.8 PLL PG = 'State Deasserted' (Status: Nominal)
CPU1 1.8 PLL PG = 'State Deasserted' (Status: Nominal)
1.1 FAIL = 'State Deasserted' (Status: Nominal)
1.0 LOM FAIL = 'State Deasserted' (Status: Nominal)
1.0 AUX FAIL = 'State Deasserted' (Status: Nominal)
Heatsink Pres = 'Entity Present' (Status: Nominal)
iDRAC6 Ent Pres = 'Entity Absent' (Status: Critical)
USB Cable Pres = 'Entity Present' (Status: Nominal)
Riser Presence = 'Entity Present' (Status: Nominal)
FAN MOD 1A RPM = 3480.000000 (Status: Nominal)
FAN MOD 2A RPM = 3480.000000 (Status: Nominal)
FAN MOD 3A RPM = 3480.000000 (Status: Nominal)
FAN MOD 4A RPM = 3480.000000 (Status: Nominal)
Presence = 'Entity Present' (Status: Nominal)
Presence = 'Entity Present' (Status: Nominal)
Presence = 'Entity Present' (Status: Nominal)
Presence = 'Entity Present' (Status: Nominal)
Presence = 'Entity Present' (Status: Nominal)
Status = 'Processor Presence detected' (Status: Nominal)
Status = 'Processor Presence detected' (Status: Nominal)
Status = 'Presence detected' (Status: Nominal)
Current = 0.400000 (Status: Nominal)
Current = 0.400000 (Status: Nominal)
Voltage = 218.000000 (Status: Nominal)
Voltage = 218.000000 (Status: Nominal)
Status = 'Presence detected' (Status: Nominal)
Status = 'Cable/Interconnect is connected' (Status: Nominal)
OS Watchdog = 'OK' (Status: Nominal)
Intrusion = 'OK' (Status: Nominal)
PS Redundancy = 'Fully Redundant' (Status: Nominal)
Fan Redundancy = 'Fully Redundant' (Status: Nominal)
System Level = 168.000000 (Status: Nominal)
Power Optimized = 'Good' (Status: Nominal)
Drive = 'Drive Presence' (Status: Nominal)
Cable SAS A = 'Cable/Interconnect is connected' (Status: Nominal)
Cable SAS B = 'Cable/Interconnect is connected' (Status: Nominal)
FAN MOD 5A RPM = 3480.000000 (Status: Nominal)

不過根據(jù)它的提示(其實(shí)插件也是調(diào)用如下命令)构韵,可以使用

/usr/sbin/ipmi-sel -h 10.103.1.100 --config-file ipmi.cfg --driver-type=LAN_2_0 --output-event-state --interpret-oem-data --entity-sensor-names

執(zhí)行結(jié)果是:

# /usr/sbin/ipmi-sel -h 10.103.1.100 --config-file ipmi.cfg --driver-type=LAN_2_0 --output-event-state --interpret-oem-data --entity-sensor-names
ID  | Date        | Time     | Name                                        | Type                     | State    | Event
1   | Apr-08-2011 | 06:42:13 | System Board SEL                            | Event Logging Disabled   | Nominal  | Log Area Reset/Cleared
2   | Jan-01-1970 | 08:00:31 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
3   | Jan-01-1970 | 08:00:36 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
4   | Aug-15-2011 | 23:09:53 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
5   | Aug-16-2011 | 11:38:25 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
6   | Aug-16-2011 | 11:38:25 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
7   | Aug-16-2011 | 11:38:55 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
8   | Jun-10-2012 | 22:41:13 | System Board Ambient Temp                   | Temperature              | Warning  | Upper Non-critical - going high ; Sensor Reading = 45.00 C ; Threshold = 45.00 C
9   | Jun-11-2012 | 02:53:53 | System Board Ambient Temp                   | Temperature              | Nominal  | Upper Non-critical - going high ; Sensor Reading = 43.00 C ; Threshold = 45.00 C
10  | Nov-05-2012 | 21:56:42 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
11  | Nov-14-2012 | 21:53:58 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
12  | Nov-14-2012 | 21:53:58 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
13  | Nov-14-2012 | 21:54:19 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
14  | Nov-15-2012 | 16:12:03 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
15  | Nov-17-2012 | 17:14:34 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
16  | Nov-17-2012 | 17:14:34 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Critical | Drive Fault ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
17  | Nov-17-2012 | 17:15:40 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
18  | Nov-19-2012 | 20:47:57 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
19  | Nov-19-2012 | 20:50:04 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
20  | Jan-01-1970 | 08:00:33 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
21  | Jan-01-1970 | 08:00:38 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
22  | Jun-27-2014 | 17:27:38 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
23  | Jun-27-2014 | 17:27:53 | Disk Drive Bay 1 Drive 2                    | Drive Slot               | Nominal  | Drive Presence ; OEM Event Data2 code = 01h ; OEM Event Data3 code = 02h
24  | Jan-01-1970 | 08:00:31 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
25  | Jan-01-1970 | 08:00:36 | System Board Intrusion                      | Physical Security        | Critical | General Chassis Intrusion ; Intrusion while system Off
26  | Oct-31-2016 | 05:48:35 | System Board Ambient Temp                   | Temperature              | Warning  | Lower Non-critical - going low ; Sensor Reading = 8.00 C ; Threshold = 8.00 C
27  | Oct-31-2016 | 09:00:38 | System Board Ambient Temp                   | Temperature              | Nominal  | Lower Non-critical - going low ; Sensor Reading = 10.00 C ; Threshold = 8.00 C

5.3編寫Zabbix外部檢查(External checks)腳本

[root@HN-zabbix-proxy13 externalscripts]# pwd
/usr/local/zabbix/share/zabbix/externalscripts
[root@HN-zabbix-proxy13 externalscripts]# cat check_ipmi 

下面是腳本內(nèi)容

#!/bin/bash
#用于檢測ipmi相關(guān)信息
#Create on 2016-011-18
#@author: Chinge_Yang

args="$*"
echo $(date +%F-%T) $args >> /tmp/check_ipmi.debug

check_ipmi_dir=/usr/local/zabbix/shell/check_ipmi_sensor
check_ipmi_bin=$check_ipmi_dir/check_ipmi_sensor

ipmi_sensors=/usr/sbin/ipmi-sensors
ipmi_cfg=$check_ipmi_dir/ipmi.cfg

#$check_ipmi_bin -f $ipmi_cfg -v $args
#${ipmi_sel} $args --config-file $ipmi_cfg --driver-type=LAN_2_0 --output-event-state --interpret-oem-data --entity-sensor-names 
options="--quiet-cache --sdr-cache-recreate --interpret-oem-data --output-sensor-state --ignore-not-available-sensors --driver-type=LAN_2_0 --output-sensor-thresholds"

function usage(){
    echo "Usage: `basename $0` options (-h HOST|-n NAME)"
}

function check(){
    $ipmi_sensors -h $host --config-file $ipmi_cfg $options|grep "$name"|awk -F"| " '{print $NF}'
}

if [ $# -lt 4 ]  
then
    usage
    exit 55     
fi  

# 用法: scriptname -options
# 注意: 必須使用破折號 (-) 
# 參數(shù)后接冒號,表示必須接值
while getopts ":h:n:" Option;do
  case $Option in
    h)
    host=$OPTARG
    ;;
    n)
    name=$OPTARG
    ;;
    *)
    usage
    ;;   # 默認(rèn)情況的處理
  esac
done

shift $(($OPTIND - 1))
#  (譯者注: shift命令是可以帶參數(shù)的, 參數(shù)就是移動的個數(shù))
#  將參數(shù)指針減1, 這樣它將指向下一個參數(shù).
#  $1 現(xiàn)在引用的是命令行上的第一個非選項(xiàng)參數(shù),
#+ 如果有一個這樣的參數(shù)存在的話.

check

exit 0

添加執(zhí)行權(quán)限

chmod a+x check_ipmi

5.4新建自定義模板

這里就不詳細(xì)介紹內(nèi)容了趋艘,其實(shí)就是改改上文中的模板而來疲恢,一張圖看完內(nèi)容:


Paste_Image.png

給2張圖看看效果:

Paste_Image.png

Paste_Image.png

好吧,最后發(fā)現(xiàn)瓷胧,就算是自定義腳本显拳,仍然是獲取數(shù)據(jù)艱難,腳本執(zhí)行ipmi的命令都timeout搓萧。杂数。。瘸洛。
參考資料:
http://pengyao.org/zabbix-monitor-ipmi-1.html
http://zh.community.dell.com/techcenter/w/techcenter_wiki/189.idrac-7
http://www.weibo.com/p/1001603921723593500304
http://www.thomas-krenn.com/en/wiki/IPMI_Sensor_Monitoring_Plugin

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末揍移,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子反肋,更是在濱河造成了極大的恐慌那伐,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,372評論 6 498
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件石蔗,死亡現(xiàn)場離奇詭異罕邀,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)养距,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,368評論 3 392
  • 文/潘曉璐 我一進(jìn)店門诉探,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人棍厌,你說我怎么就攤上這事肾胯。” “怎么了定铜?”我有些...
    開封第一講書人閱讀 162,415評論 0 353
  • 文/不壞的土叔 我叫張陵阳液,是天一觀的道長。 經(jīng)常有香客問我揣炕,道長帘皿,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,157評論 1 292
  • 正文 為了忘掉前任畸陡,我火速辦了婚禮鹰溜,結(jié)果婚禮上虽填,老公的妹妹穿的比我還像新娘。我一直安慰自己曹动,他們只是感情好斋日,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,171評論 6 388
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著墓陈,像睡著了一般恶守。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上贡必,一...
    開封第一講書人閱讀 51,125評論 1 297
  • 那天兔港,我揣著相機(jī)與錄音,去河邊找鬼仔拟。 笑死衫樊,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的利花。 我是一名探鬼主播科侈,決...
    沈念sama閱讀 40,028評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼炒事!你這毒婦竟也來了臀栈?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,887評論 0 274
  • 序言:老撾萬榮一對情侶失蹤挠乳,失蹤者是張志新(化名)和其女友劉穎挂脑,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體欲侮,經(jīng)...
    沈念sama閱讀 45,310評論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡崭闲,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,533評論 2 332
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了威蕉。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片刁俭。...
    茶點(diǎn)故事閱讀 39,690評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖韧涨,靈堂內(nèi)的尸體忽然破棺而出牍戚,到底是詐尸還是另有隱情,我是刑警寧澤虑粥,帶...
    沈念sama閱讀 35,411評論 5 343
  • 正文 年R本政府宣布如孝,位于F島的核電站,受9級特大地震影響娩贷,放射性物質(zhì)發(fā)生泄漏第晰。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,004評論 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望茁瘦。 院中可真熱鬧品抽,春花似錦、人聲如沸甜熔。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽腔稀。三九已至盆昙,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間焊虏,已是汗流浹背弱左。 一陣腳步聲響...
    開封第一講書人閱讀 32,812評論 1 268
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留炕淮,地道東北人。 一個月前我還...
    沈念sama閱讀 47,693評論 2 368
  • 正文 我出身青樓跳夭,卻偏偏與公主長得像涂圆,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子币叹,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,577評論 2 353

推薦閱讀更多精彩內(nèi)容