13 Remote monitoring of Zabbix stats

Overview

It is possible to make some internal metrics of Zabbix server and proxy accessible remotely by another Zabbix instance or a third party tool. This can be useful so that supporters/service providers can monitor their client Zabbix servers/proxies remotely or, in organizations where Zabbix is not the main monitoring tool, that Zabbix internal metrics can be monitored by a third party system in an umbrella-monitoring setup.

Zabbix internal stats are exposed to a configurable set of addresses listed in the new ‘StatsAllowedIP’ server/proxy parameter. Requests will be accepted only from these addresses.

Items

To configure querying of internal stats on another Zabbix instance, you may use two items:

  • zabbix[stats,<ip>,<port>] internal item - for direct remote queries of Zabbix server/proxy. <ip> and <port> are used to identify the target instance.
  • zabbix.stats[<ip>,<port>] agent item - for agent-based remote queries of Zabbix server/proxy. <ip> and <port> are used to identify the target instance.

See also: Internal items, Zabbix agent items

The following diagram illustrates the use of either item depending on the context.

13 Remote monitoring of Zabbix stats - 图1

  • 13 Remote monitoring of Zabbix stats - 图2 - Server → external Zabbix instance (zabbix[stats,<ip>,<port>])
  • 13 Remote monitoring of Zabbix stats - 图3 - Server → proxy → external Zabbix instance (zabbix[stats,<ip>,<port>])
  • 13 Remote monitoring of Zabbix stats - 图4 - Server → agent → external Zabbix instance (zabbix.stats[<ip>,<port>])
  • 13 Remote monitoring of Zabbix stats - 图5 - Server → proxy → agent → external Zabbix instance (zabbix.stats[<ip>,<port>])

To make sure that the target instance allows querying it by the external instance, list the address of the external instance in the ‘StatsAllowedIP’ parameter on the target instance.

Exposed metrics

The stats items gather the statistics in bulk and return a JSON, which is the basis for dependent items to get their data from. The following internal metrics are returned by either of the two items:

  • zabbix[boottime]
  • zabbix[hosts]
  • zabbix[items]
  • zabbix[items_unsupported]
  • zabbix[preprocessing_queue] (server only)
  • zabbix[process,<type>,<mode>,<state>] (only process type based statistics)
  • zabbix[rcache,<cache>,<mode>]
  • zabbix[requiredperformance]
  • zabbix[triggers] (server only)
  • zabbix[uptime]
  • zabbix[vcache,buffer,<mode>] (server only)
  • zabbix[vcache,cache,<parameter>]
  • zabbix[version]
  • zabbix[vmware,buffer,<mode>]
  • zabbix[wcache,<cache>,<mode>] (‘trends’ cache type server only)

Templates

Templates are available for remote monitoring of Zabbix server or proxy internal metrics from an external instance:

  • Remote Zabbix server
  • Remote Zabbix proxy

Note that in order to use a template for remote monitoring of multiple external instances, a separate host is required for each external instance monitoring.

Trapper process

Receiving internal metric requests from an external Zabbix instance is handled by the trapper process that validates the request, gathers the metrics, creates the JSON data buffer and sends the prepared JSON back, for example, from server:

  1. {
  2. "response": "success",
  3. "data": {
  4. "boottime": N,
  5. "uptime": N,
  6. "hosts": N,
  7. "items": N,
  8. "items_unsupported": N,
  9. "preprocessing_queue": N,
  10. "process": {
  11. "alert manager": {
  12. "busy": {
  13. "avg": N,
  14. "max": N,
  15. "min": N
  16. },
  17. "idle": {
  18. "avg": N,
  19. "max": N,
  20. "min": N
  21. },
  22. "count": N
  23. },
  24. ...
  25. },
  26. "queue": N,
  27. "rcache": {
  28. "total": N,
  29. "free": N,
  30. "pfree": N,
  31. "used": N,
  32. "pused": N
  33. },
  34. "requiredperformance": N,
  35. "triggers": N,
  36. "uptime": N,
  37. "vcache": {
  38. "buffer": {
  39. "total": N,
  40. "free": N,
  41. "pfree": N,
  42. "used": N,
  43. "pused": N
  44. },
  45. "cache": {
  46. "requests": N,
  47. "hits": N,
  48. "misses": N,
  49. "mode": N
  50. }
  51. },
  52. "vmware": {
  53. "total": N,
  54. "free": N,
  55. "pfree": N,
  56. "used": N,
  57. "pused": N
  58. },
  59. "version": "N",
  60. "wcache": {
  61. "values": {
  62. "all": N,
  63. "float": N,
  64. "uint": N,
  65. "str": N,
  66. "log": N,
  67. "text": N,
  68. "not supported": N
  69. },
  70. "history": {
  71. "pfree": N,
  72. "free": N,
  73. "total": N,
  74. "used": N,
  75. "pused": N
  76. },
  77. "index": {
  78. "pfree": N,
  79. "free": N,
  80. "total": N,
  81. "used": N,
  82. "pused": N
  83. },
  84. "trend": {
  85. "pfree": N,
  86. "free": N,
  87. "total": N,
  88. "used": N,
  89. "pused": N
  90. }
  91. }
  92. }
  93. }

Internal queue items

There are also another two items specifically allowing to remote query internal queue stats on another Zabbix instance:

  • zabbix[stats,<ip>,<port>,queue,<from>,<to>] internal item - for direct internal queue queries to remote Zabbix server/proxy
  • zabbix.stats[<ip>,<port>,queue,<from>,<to>] agent item - for agent-based internal queue queries to remote Zabbix server/proxy

See also: Internal items, Zabbix agent items