zabbix為了顯示更人性化的數據,在使用過程中,我們可以將獲取到得數據映射為一個字符串。比如,我們寫腳本監控MySQL是否在運行中, 一般返回0表示數據庫掛了,1表示數據庫正常,還有各種各樣的監控都是返回0,1,2,3這樣的數據,監控頁上顯示的都是數據字,完全不知道是什么意思。 這個時候我們可以使用zabbix的值映射,例如這邊的MySQL架空0映射為”離線”,1映射為“在線”或者用於備份的監控,做如下映射:
- 'F' → 'Full'
- 'D' → 'Differential'
- 'I' → 'Incremental'
在配置zabbix item表單中,我們可以看到如下:

zabbix value mapping
點擊show value mappings
Name | Value map | Used in items | |
---|---|---|---|
APC Battery Replacement Status | 1 ⇒ unknown 2 ⇒ notInstalled 3 ⇒ ok 4 ⇒ failed 5 ⇒ highTemperature 6 ⇒ replaceImmediately 7 ⇒ lowCapacity |
||
APC Battery Status | 1 ⇒ unknown 2 ⇒ batteryNormal 3 ⇒ batteryLow |
||
Cisco enviorment status | 1 ⇒ normal 2 ⇒ warning 3 ⇒ critical 4 ⇒ shutdown 5 ⇒ notPresent 6 ⇒ notFunctioning |
Yes | |
Dell Open Manage System Status | 1 ⇒ Other 2 ⇒ Unknown 3 ⇒ OK 4 ⇒ NonCritical 5 ⇒ Critical 6 ⇒ NonRecoverable |
||
F5 ltmPoolStatusAvailState | 0 ⇒ Pool Error (code 0) 1 ⇒ Pool available (code 1) 2 ⇒ Pool member(s) are currently not available (code 2) 3 ⇒ Pool member(s) are down (code 3) 4 ⇒ Pool availability is unknown (code 4) 5 ⇒ Pool unlicensed (code 5) |
Yes | |
gtmVsEnabled | 0 ⇒ disable 1 ⇒ enable |
||
Host availability | 0 ⇒ not available 1 ⇒ available 2 ⇒ unknown |
||
HP Insight System Status | 1 ⇒ Other 2 ⇒ OK 3 ⇒ Degraded |
||
HTTP response status code | 100 ⇒ Continue 101 ⇒ Switching Protocols 102 ⇒ Processing 200 ⇒ OK 201 ⇒ Created 202 ⇒ Accepted 203 ⇒ Non-Authoritative Information 204 ⇒ No Content 205 ⇒ Reset Content 206 ⇒ Partial Content 207 ⇒ Multi-Status 208 ⇒ Already Reported 226 ⇒ IM Used 300 ⇒ Multiple Choices 301 ⇒ Moved Permanently 302 ⇒ Found 303 ⇒ See Other 304 ⇒ Not Modified 305 ⇒ Use Proxy 306 ⇒ Switch Proxy 307 ⇒ Temporary Redirect 308 ⇒ Permanent Redirect/Resume Incomplete 400 ⇒ Bad Request 401 ⇒ Unauthorized 402 ⇒ Payment Required 403 ⇒ Forbidden 404 ⇒ Not Found 405 ⇒ Method Not Allowed 406 ⇒ Not Acceptable 407 ⇒ Proxy Authentication Required 408 ⇒ Request Timeout 409 ⇒ Conflict 410 ⇒ Gone 411 ⇒ Length Required 412 ⇒ Precondition Failed 413 ⇒ Payload Too Large 414 ⇒ Request-URI Too Long 415 ⇒ Unsupported Media Type 416 ⇒ Requested Range Not Satisfiable 417 ⇒ Expectation Failed 418 ⇒ I'm a Teapot 419 ⇒ Authentication Timeout 420 ⇒ Method Failure/Enhance Your Calm 421 ⇒ Misdirected Request 422 ⇒ Unprocessable Entity 423 ⇒ Locked 424 ⇒ Failed Dependency 426 ⇒ Upgrade Required 428 ⇒ Precondition Required 429 ⇒ Too Many Requests 431 ⇒ Request Header Fields Too Large 440 ⇒ Login Timeout 444 ⇒ No Response 449 ⇒ Retry With 450 ⇒ Blocked by Windows Parental Controls 451 ⇒ Unavailable for Legal Reasons/Redirect 494 ⇒ Request Header Too Large 495 ⇒ Cert Error 496 ⇒ No Cert 497 ⇒ HTTP to HTTPS 498 ⇒ Token Expired/Invalid 499 ⇒ Client Closed Request/Token Required 500 ⇒ Internal Server Error 501 ⇒ Not Implemented 502 ⇒ Bad Gateway 503 ⇒ Service Unavailable 504 ⇒ Gateway Timeout 505 ⇒ HTTP Version Not Supported 506 ⇒ Variant Also Negotiates 507 ⇒ Insufficient Storage 508 ⇒ Loop Detected 509 ⇒ Bandwidth Limit Exceeded 510 ⇒ Not Extended 511 ⇒ Network Authentication Required 520 ⇒ Unknown Error 598 ⇒ Network Read Timeout Error 599 ⇒ Network Connect Timeout Error |
||
Maintenance status | 0 ⇒ normal 1 ⇒ in maintenance 2 ⇒ no data collection |
||
Service state | 0 ⇒ Down 1 ⇒ Up |
Yes | |
SNMP device status (hrDeviceStatus) | 1 ⇒ unknown 2 ⇒ running 3 ⇒ warning 4 ⇒ testing 5 ⇒ down |
||
SNMP interface status (ifAdminStatus) | 1 ⇒ up 2 ⇒ down 3 ⇒ testing |
Yes | |
SNMP interface status (ifOperStatus) | 1 ⇒ up 2 ⇒ down 3 ⇒ testing 4 ⇒ unknown 5 ⇒ dormant 6 ⇒ notPresent 7 ⇒ lowerLayerDown |
Yes | |
Value cache operating mode | 0 ⇒ Normal 1 ⇒ Low memory |
Yes | |
VMware status | 0 ⇒ gray 1 ⇒ green 2 ⇒ yellow 3 ⇒ red |
||
VMware VirtualMachinePowerState | 0 ⇒ poweredOff 1 ⇒ poweredOn 2 ⇒ suspended |
||
Windows service startup type | 0 ⇒ Automatic 1 ⇒ Automatic delayed 2 ⇒ Manual 3 ⇒ Disabled 4 ⇒ Unknown |
||
Windows service state | 0 ⇒ Running 1 ⇒ Paused 2 ⇒ Start pending 3 ⇒ Pause pending 4 ⇒ Continue pending 5 ⇒ Stop pending 6 ⇒ Stopped 7 ⇒ Unknown 255 ⇒ No such service |
||
Zabbix agent ping status | 1 ⇒ Up | Yes |
zabbix value mapping
選擇我們需要的映射即可。
在zabbix 2.2之前只有數字(無符號)數據item才能使用值映射,在之后支持浮點數和字符類型。
如何定義值映射:
- Go to: Administration (管理)→ General(常規)
- 導航欄的右側,下拉選擇“Value mapping”
- 點擊 Create value map (創建值映射)

zabbix value mapping
參數說明:
參數 | 描述 |
---|---|
Name | 值映射名稱,唯一. |
Mapping | 映射對. |
|