21 Top hosts

Description

These parameters and the possible property values for the respective dashboard widget field objects allow to configure the Top Hosts widget in dashboard.create and dashboard.update methods.

Parameters

The following parameters are supported for the Top Hosts widget.

Parametertypenamevalue
Refresh interval0rf_rate0 - No refresh;
10 - 10 seconds;
30 - 30 seconds;
60 - (default) 1 minute;
120 - 2 minutes;
600 - 10 minutes;
900 - 15 minutes.
Host groups2groupidsHost group ID.

Note: To configure multiple host groups, create a dashboard widget field object for each host group.
Hosts3hostidsHost ID.

Note: To configure multiple hosts, create a dashboard widget field object for each host. For multiple hosts, the parameter Host groups must either be not configured at all or configured with at least one host group that the configured hosts belong to.
Host Tags (the number in the property name (e.g. tags.tag.0) references tag order in the tag evaluation list)
Evaluation type0evaltype0 - (default) And/Or;
2 - Or.
Tag name1tags.tag.0Any string value.

Parameter behavior:
- required if configuring Tags
Operator0tags.operator.00 - Contains;
1 - Equals;
2 - Does not contain;
3 - Does not equal;
4 - Exists;
5 - Does not exist.

Parameter behavior:
- required if configuring Tags
Tag value1tags.value.0Any string value.

Parameter behavior:
- required if configuring Tags
Columns (see below)
Order0order2 - (default) Top N;
3 - Bottom N.
Order column0columnColumn numeric value from the configured columns.
Host count0countValid values range from 1-100.

Default: 10.

Columns

Columns have common parameters and additional parameters depending on the configuration of the parameter Data.

For all parameters related to columns the number in the property name (e.g. columns.name.0) references a column for which the parameter is configured.

The following parameters are supported for all columns.

Parametertypenamevalue
Name1columns.name.0Any string value.
Data0columns.data.01 - Item value;
2 - Host name;
3 - Text.

Parameter behavior:
- required
Base color1columns.base_color.0Hexadecimal color code (e.g. FF0000).

Parameter behavior:
- required
Item value

The following parameters are supported if Data is set to “Item value”.

The first number in the Thresholds property name (e.g. columnsthresholds.color.0.0) references the column for which thresholds are configured, while the second number references threshold place in a list, sorted in ascending order. However, if thresholds are configured in a different order, the values will be sorted in ascending order after updating widget configuration in Zabbix frontend (e.g. "threshold.threshold.0":"5""threshold.threshold.0":"1"; "threshold.threshold.1":"1""threshold.threshold.1": "5").

Parametertypenamevalue
Item1columns.item.0Valid item name.
Time shift1columns.timeshift.0Valid numeric or time string value (e.g. 3600 or 1h).
You may use time suffixes. Negative values are allowed.

Parameter behavior:
- required
Aggregation function0columns.aggregate_function.00 - (default) none;
1 - min;
2 - max;
3 - avg;
4 - count;
5 - sum;
6 - first;
7 - last.
Aggregation interval1columns.aggregate_interval.0Valid time string (e.g. 3600, 1h, etc.).
You may use time suffixes.

Parameter Aggregation interval not available if Aggregation function is set to none.

Default: 1h.
Display0columns.display.01 - (default) As is;
2 - Bar;
3 - Indicators.
Min1columns.min.0Any numeric value.

Parameter Min not available if Display is set to “As is”.
Max1columns.max.0Any numeric value.

Parameter Max not available if Display is set to “As is”.
Decimal places0columns.decimal_places.0Valid values range from 0-10.

Default: 2.
History data0columns.history.01 - (default) Auto;
2 - History;
3 - Trends.
Thresholds
Color1columnsthresholds.color.0.0Hexadecimal color code (e.g. FF0000).

Default: “” (empty).
Threshold1columnsthresholds.threshold.0.0Any string value.
Text

The following parameters are supported if Data is set to “Text”.

Parametertypenamevalue
Text1columns.text.0Any string value, including macros.
Supported macros: {HOST.}, {INVENTORY.}.

Parameter behavior:
- required if Data is set to “Text”

Examples

The following examples aim to only describe the configuration of the dashboard widget field objects for the Top hosts widget. For more information on configuring a dashboard, see dashboard.create.

Configuring a Top hosts widget

Configure a Top hosts widget that displays top hosts by CPU utilization in host group “4”. In addition, configure the following custom columns: “Host name”, “CPU utilization in %”, “1m avg”, “5m avg”, “15m avg”, “Processes”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.create",
  4. "params": {
  5. "name": "My dashboard",
  6. "display_period": 30,
  7. "auto_start": 1,
  8. "pages": [
  9. {
  10. "widgets": [
  11. {
  12. "type": "tophosts",
  13. "name": "Top hosts",
  14. "x": 0,
  15. "y": 0,
  16. "width": 12,
  17. "height": 5,
  18. "view_mode": 0,
  19. "fields": [
  20. {
  21. "type": 2,
  22. "name": "groupids",
  23. "value": 4
  24. },
  25. {
  26. "type": 1,
  27. "name": "columns.name.0",
  28. "value": ""
  29. },
  30. {
  31. "type": 0,
  32. "name": "columns.data.0",
  33. "value": 2
  34. },
  35. {
  36. "type": 1,
  37. "name": "columns.base_color.0",
  38. "value": "FFFFFF"
  39. },
  40. {
  41. "type": 1,
  42. "name": "columns.item.0",
  43. "value": "System name"
  44. },
  45. {
  46. "type": 1,
  47. "name": "columns.timeshift.0",
  48. "value": ""
  49. },
  50. {
  51. "type": 1,
  52. "name": "columns.name.1",
  53. "value": "CPU utilization in %"
  54. },
  55. {
  56. "type": 0,
  57. "name": "columns.data.1",
  58. "value": 1
  59. },
  60. {
  61. "type": 1,
  62. "name": "columns.base_color.1",
  63. "value": "4CAF50"
  64. },
  65. {
  66. "type": 1,
  67. "name": "columns.item.1",
  68. "value": "CPU utilization"
  69. },
  70. {
  71. "type": 1,
  72. "name": "columns.timeshift.1",
  73. "value": ""
  74. },
  75. {
  76. "type": 0,
  77. "name": "columns.display.1",
  78. "value": 3
  79. },
  80. {
  81. "type": 1,
  82. "name": "columns.min.1",
  83. "value": "0"
  84. },
  85. {
  86. "type": 1,
  87. "name": "columns.max.1",
  88. "value": "100"
  89. },
  90. {
  91. "type": 1,
  92. "name": "columnsthresholds.color.1.0",
  93. "value": "FFFF00"
  94. },
  95. {
  96. "type": 1,
  97. "name": "columnsthresholds.threshold.1.0",
  98. "value": "50"
  99. },
  100. {
  101. "type": 1,
  102. "name": "columnsthresholds.color.1.1",
  103. "value": "FF8000"
  104. },
  105. {
  106. "type": 1,
  107. "name": "columnsthresholds.threshold.1.1",
  108. "value": "80"
  109. },
  110. {
  111. "type": 1,
  112. "name": "columnsthresholds.color.1.2",
  113. "value": "FF4000"
  114. },
  115. {
  116. "type": 1,
  117. "name": "columnsthresholds.threshold.1.2",
  118. "value": "90"
  119. },
  120. {
  121. "type": 1,
  122. "name": "columns.name.2",
  123. "value": "1m avg"
  124. },
  125. {
  126. "type": 0,
  127. "name": "columns.data.2",
  128. "value": 1
  129. },
  130. {
  131. "type": 1,
  132. "name": "columns.base_color.2",
  133. "value": "FFFFFF"
  134. },
  135. {
  136. "type": 1,
  137. "name": "columns.item.2",
  138. "value": "Load average (1m avg)"
  139. },
  140. {
  141. "type": 1,
  142. "name": "columns.timeshift.2",
  143. "value": ""
  144. },
  145. {
  146. "type": 1,
  147. "name": "columns.name.3",
  148. "value": "5m avg"
  149. },
  150. {
  151. "type": 0,
  152. "name": "columns.data.3",
  153. "value": 1
  154. },
  155. {
  156. "type": 1,
  157. "name": "columns.base_color.3",
  158. "value": "FFFFFF"
  159. },
  160. {
  161. "type": 1,
  162. "name": "columns.item.3",
  163. "value": "Load average (5m avg)"
  164. },
  165. {
  166. "type": 1,
  167. "name": "columns.timeshift.3",
  168. "value": ""
  169. },
  170. {
  171. "type": 1,
  172. "name": "columns.name.4",
  173. "value": "15m avg"
  174. },
  175. {
  176. "type": 0,
  177. "name": "columns.data.4",
  178. "value": 1
  179. },
  180. {
  181. "type": 1,
  182. "name": "columns.base_color.4",
  183. "value": "FFFFFF"
  184. },
  185. {
  186. "type": 1,
  187. "name": "columns.item.4",
  188. "value": "Load average (15m avg)"
  189. },
  190. {
  191. "type": 1,
  192. "name": "columns.timeshift.4",
  193. "value": ""
  194. },
  195. {
  196. "type": 1,
  197. "name": "columns.name.5",
  198. "value": "Processes"
  199. },
  200. {
  201. "type": 0,
  202. "name": "columns.data.5",
  203. "value": 1
  204. },
  205. {
  206. "type": 1,
  207. "name": "columns.base_color.5",
  208. "value": "FFFFFF"
  209. },
  210. {
  211. "type": 1,
  212. "name": "columns.item.5",
  213. "value": "Number of processes"
  214. },
  215. {
  216. "type": 1,
  217. "name": "columns.timeshift.5",
  218. "value": ""
  219. },
  220. {
  221. "type": 0,
  222. "name": "columns.decimal_places.5",
  223. "value": 0
  224. },
  225. {
  226. "type": 0,
  227. "name": "column",
  228. "value": 1
  229. }
  230. ]
  231. }
  232. ]
  233. }
  234. ],
  235. "userGroups": [
  236. {
  237. "usrgrpid": 7,
  238. "permission": 2
  239. }
  240. ],
  241. "users": [
  242. {
  243. "userid": 1,
  244. "permission": 3
  245. }
  246. ]
  247. },
  248. "id": 1
  249. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "dashboardids": [
  5. "3"
  6. ]
  7. },
  8. "id": 1
  9. }

See also