|
6 | 6 | "uuid": "550e8400e29b41d4a716446655440000", |
7 | 7 | "template": "TP-Link Easy Smart Switch", |
8 | 8 | "name": "TP-Link Easy Smart Switch", |
9 | | - "groups": [ |
10 | | - { "name": "Templates" } |
11 | | - ], |
| 9 | + "groups": [{ "name": "Templates" }], |
12 | 10 | "macros": [ |
13 | 11 | { "macro": "{$SWITCH_USER}", "value": "admin" }, |
14 | 12 | { "macro": "{$SWITCH_PWD}", "value": "changeme" }, |
15 | 13 | { "macro": "{$SWITCH_IP}", "value": "{HOST.HOST}" } |
16 | 14 | ], |
| 15 | + "items": [ |
| 16 | + { |
| 17 | + "uuid": "550e8400e29b41d4a716446655442000", |
| 18 | + "name": "ESS CSV single line", |
| 19 | + "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]", |
| 20 | + "type": "ZABBIX_PASSIVE", |
| 21 | + "value_type": "TEXT", |
| 22 | + "delay": "1m", |
| 23 | + "history": "1d", |
| 24 | + "description": "One CSV line: ts,port_count,(port,state,link_status,TxGoodPkt,TxBadPkt,RxGoodPkt,RxBadPkt)*" |
| 25 | + } |
| 26 | + ], |
17 | 27 | "discovery_rules": [ |
18 | 28 | { |
19 | 29 | "uuid": "550e8400e29b41d4a716446655441001", |
20 | 30 | "name": "ESS Port Discovery", |
21 | 31 | "key": "essstat.discovery[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]", |
22 | 32 | "type": "ZABBIX_PASSIVE", |
23 | | - "delay": "1m", |
| 33 | + "delay": "5m", |
24 | 34 | "lifetime": "7d", |
25 | 35 | "item_prototypes": [ |
26 | 36 | { |
27 | | - "uuid": "550e8400e29b41d4a716446655441006", |
| 37 | + "uuid": "550e8400e29b41d4a716446655441206", |
28 | 38 | "name": "Port {#PORT} State", |
29 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},state]", |
30 | | - "type": "ZABBIX_PASSIVE", |
| 39 | + "key": "essstat.value[{#PORT},state]", |
| 40 | + "type": "DEPENDENT", |
| 41 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
31 | 42 | "value_type": "UNSIGNED", |
32 | | - "delay": "1m", |
| 43 | + "delay": "0", |
| 44 | + "preprocessing": [ |
| 45 | + { |
| 46 | + "type": "JAVASCRIPT", |
| 47 | + "parameters": [ |
| 48 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+1]; }\nreturn null;" |
| 49 | + ] |
| 50 | + } |
| 51 | + ], |
33 | 52 | "tags": [ |
34 | 53 | { "tag": "metric", "value": "State" }, |
35 | 54 | { "tag": "port", "value": "{#PORT}" } |
36 | 55 | ] |
37 | 56 | }, |
38 | 57 | { |
39 | | - "uuid": "550e8400e29b41d4a716446655441007", |
| 58 | + "uuid": "550e8400e29b41d4a716446655441207", |
40 | 59 | "name": "Port {#PORT} Link Status", |
41 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},link_status]", |
42 | | - "type": "ZABBIX_PASSIVE", |
| 60 | + "key": "essstat.value[{#PORT},link_status]", |
| 61 | + "type": "DEPENDENT", |
| 62 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
43 | 63 | "value_type": "UNSIGNED", |
44 | | - "delay": "1m", |
| 64 | + "delay": "0", |
| 65 | + "preprocessing": [ |
| 66 | + { |
| 67 | + "type": "JAVASCRIPT", |
| 68 | + "parameters": [ |
| 69 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+2]; }\nreturn null;" |
| 70 | + ] |
| 71 | + } |
| 72 | + ], |
45 | 73 | "tags": [ |
46 | 74 | { "tag": "metric", "value": "LinkStatus" }, |
47 | 75 | { "tag": "port", "value": "{#PORT}" } |
48 | 76 | ] |
49 | 77 | }, |
50 | 78 | { |
51 | | - "uuid": "550e8400e29b41d4a716446655441002", |
| 79 | + "uuid": "550e8400e29b41d4a716446655441202", |
52 | 80 | "name": "Port {#PORT} TxGoodPkt", |
53 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},TxGoodPkt]", |
54 | | - "type": "ZABBIX_PASSIVE", |
| 81 | + "key": "essstat.value[{#PORT},TxGoodPkt]", |
| 82 | + "type": "DEPENDENT", |
| 83 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
55 | 84 | "value_type": "FLOAT", |
56 | | - "delay": "1m", |
| 85 | + "delay": "0", |
57 | 86 | "units": "pps", |
58 | 87 | "preprocessing": [ |
| 88 | + { |
| 89 | + "type": "JAVASCRIPT", |
| 90 | + "parameters": [ |
| 91 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+3]; }\nreturn null;" |
| 92 | + ] |
| 93 | + }, |
59 | 94 | { "type": "CHANGE_PER_SECOND", "parameters": [""] } |
60 | 95 | ], |
61 | 96 | "tags": [ |
|
64 | 99 | ] |
65 | 100 | }, |
66 | 101 | { |
67 | | - "uuid": "550e8400e29b41d4a716446655441003", |
| 102 | + "uuid": "550e8400e29b41d4a716446655441203", |
68 | 103 | "name": "Port {#PORT} TxBadPkt", |
69 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},TxBadPkt]", |
70 | | - "type": "ZABBIX_PASSIVE", |
| 104 | + "key": "essstat.value[{#PORT},TxBadPkt]", |
| 105 | + "type": "DEPENDENT", |
| 106 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
71 | 107 | "value_type": "FLOAT", |
72 | | - "delay": "1m", |
| 108 | + "delay": "0", |
73 | 109 | "units": "pps", |
74 | 110 | "preprocessing": [ |
| 111 | + { |
| 112 | + "type": "JAVASCRIPT", |
| 113 | + "parameters": [ |
| 114 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+4]; }\nreturn null;" |
| 115 | + ] |
| 116 | + }, |
75 | 117 | { "type": "CHANGE_PER_SECOND", "parameters": [""] } |
76 | 118 | ], |
77 | 119 | "tags": [ |
|
80 | 122 | ] |
81 | 123 | }, |
82 | 124 | { |
83 | | - "uuid": "550e8400e29b41d4a716446655441004", |
| 125 | + "uuid": "550e8400e29b41d4a716446655441204", |
84 | 126 | "name": "Port {#PORT} RxGoodPkt", |
85 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},RxGoodPkt]", |
86 | | - "type": "ZABBIX_PASSIVE", |
| 127 | + "key": "essstat.value[{#PORT},RxGoodPkt]", |
| 128 | + "type": "DEPENDENT", |
| 129 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
87 | 130 | "value_type": "FLOAT", |
88 | | - "delay": "1m", |
| 131 | + "delay": "0", |
89 | 132 | "units": "pps", |
90 | 133 | "preprocessing": [ |
| 134 | + { |
| 135 | + "type": "JAVASCRIPT", |
| 136 | + "parameters": [ |
| 137 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+5]; }\nreturn null;" |
| 138 | + ] |
| 139 | + }, |
91 | 140 | { "type": "CHANGE_PER_SECOND", "parameters": [""] } |
92 | 141 | ], |
93 | 142 | "tags": [ |
|
96 | 145 | ] |
97 | 146 | }, |
98 | 147 | { |
99 | | - "uuid": "550e8400e29b41d4a716446655441005", |
| 148 | + "uuid": "550e8400e29b41d4a716446655441205", |
100 | 149 | "name": "Port {#PORT} RxBadPkt", |
101 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},RxBadPkt]", |
102 | | - "type": "ZABBIX_PASSIVE", |
| 150 | + "key": "essstat.value[{#PORT},RxBadPkt]", |
| 151 | + "type": "DEPENDENT", |
| 152 | + "master_item": { "key": "essstat.1line[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD}]" }, |
103 | 153 | "value_type": "FLOAT", |
104 | | - "delay": "1m", |
| 154 | + "delay": "0", |
105 | 155 | "units": "pps", |
106 | 156 | "preprocessing": [ |
| 157 | + { |
| 158 | + "type": "JAVASCRIPT", |
| 159 | + "parameters": [ |
| 160 | + "var p='{#PORT}';\nvar a=value.trim().split(',');\nif(a.length<3) return null;\nfor(var i=2;i+6<a.length;i+=7){ if(a[i]===String(p)) return a[i+6]; }\nreturn null;" |
| 161 | + ] |
| 162 | + }, |
107 | 163 | { "type": "CHANGE_PER_SECOND", "parameters": [""] } |
108 | 164 | ], |
109 | 165 | "tags": [ |
|
120 | 176 | { |
121 | 177 | "color": "00AA00", |
122 | 178 | "calc_fnc": "ALL", |
123 | | - "item": { |
124 | | - "host": "TP-Link Easy Smart Switch", |
125 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},TxGoodPkt]" |
126 | | - } |
| 179 | + "item": { "host": "TP-Link Easy Smart Switch", "key": "essstat.value[{#PORT},TxGoodPkt]" } |
127 | 180 | }, |
128 | 181 | { |
129 | 182 | "color": "0000AA", |
130 | 183 | "calc_fnc": "ALL", |
131 | | - "item": { |
132 | | - "host": "TP-Link Easy Smart Switch", |
133 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},RxGoodPkt]" |
134 | | - } |
| 184 | + "item": { "host": "TP-Link Easy Smart Switch", "key": "essstat.value[{#PORT},RxGoodPkt]" } |
135 | 185 | }, |
136 | 186 | { |
137 | 187 | "color": "AA0000", |
138 | 188 | "calc_fnc": "ALL", |
139 | | - "item": { |
140 | | - "host": "TP-Link Easy Smart Switch", |
141 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},TxBadPkt]" |
142 | | - } |
| 189 | + "item": { "host": "TP-Link Easy Smart Switch", "key": "essstat.value[{#PORT},TxBadPkt]" } |
143 | 190 | }, |
144 | 191 | { |
145 | 192 | "color": "AA00AA", |
146 | 193 | "calc_fnc": "ALL", |
147 | | - "item": { |
148 | | - "host": "TP-Link Easy Smart Switch", |
149 | | - "key": "essstat.port[{$SWITCH_IP},{$SWITCH_USER},{$SWITCH_PWD},{#PORT},RxBadPkt]" |
150 | | - } |
| 194 | + "item": { "host": "TP-Link Easy Smart Switch", "key": "essstat.value[{#PORT},RxBadPkt]" } |
151 | 195 | } |
152 | 196 | ] |
153 | 197 | } |
|
0 commit comments