自学Zabbix3.5.6-监控项item-Value mapping值映射

点击返回:自学Zabbix之路

点击返回:自学Zabbix4.0之路

点击返回:自学zabbix集锦


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

NameValue mapUsed 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 映射对.
   

posted on 2017-12-21 17:28  CARLOS_KONG  阅读(2554)  评论(0编辑  收藏  举报

导航