Welcome to mirror list, hosted at ThFree Co, Russian Federation.

template_app_systemd.yaml « systemd « app « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fc388194dd39a63dc394c67f904e1e07575db2c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
zabbix_export:
  version: '6.0'
  date: '2021-12-15T06:58:10Z'
  groups:
    -
      uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    -
      uuid: 90ac276995294a6aa88462c032d2ddaf
      template: 'Systemd by Zabbix agent 2'
      name: 'Systemd by Zabbix agent 2'
      description: |
        Get systemd units metrics from plugin for the zabbix-agent2.
          1. Setup and configure zabbix-agent2 compiled with the Systemd monitoring plugin.
          2. Set filters with macros if you want to override default filter parameters.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/
        
        Template tooling version used: 0.40
      groups:
        -
          name: Templates/Applications
      discovery_rules:
        -
          uuid: 0dfbc5994c1e44a6a1a2aa8ecc2f0347
          name: 'Service units discovery'
          key: 'systemd.unit.discovery[service]'
          delay: 30m
          filter:
            evaltype: AND
            conditions:
              -
                macro: '{#UNIT.ACTIVESTATE}'
                value: '{$SYSTEMD.ACTIVESTATE.SERVICE.MATCHES}'
                formulaid: A
              -
                macro: '{#UNIT.ACTIVESTATE}'
                value: '{$SYSTEMD.ACTIVESTATE.SERVICE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
              -
                macro: '{#UNIT.UNITFILESTATE}'
                value: '{$SYSTEMD.UNITFILESTATE.SERVICE.MATCHES}'
                formulaid: E
              -
                macro: '{#UNIT.UNITFILESTATE}'
                value: '{$SYSTEMD.UNITFILESTATE.SERVICE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: F
              -
                macro: '{#UNIT.NAME}'
                value: '{$SYSTEMD.NAME.SERVICE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: C
              -
                macro: '{#UNIT.NAME}'
                value: '{$SYSTEMD.NAME.SERVICE.MATCHES}'
                formulaid: D
          description: 'Discover systemd service units and their details.'
          item_prototypes:
            -
              uuid: 78587e9b16b5431bbccd2855998171fa
              name: '{#UNIT.NAME}: Active state'
              type: DEPENDENT
              key: 'systemd.service.active_state["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              description: 'State value that reflects whether the unit is currently active or not. The following states are currently defined: "active", "reloading", "inactive", "failed", "activating", and "deactivating".'
              valuemap:
                name: 'Unit Active State'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.ActiveState.state
                -
                  type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 30m
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}"]'
              tags:
                -
                  tag: Application
                  value: 'Systemd service: {#UNIT.NAME}'
              trigger_prototypes:
                -
                  uuid: 5237bd423307449b8a58f692082d2a0a
                  expression: 'last(/Systemd by Zabbix agent 2/systemd.service.active_state["{#UNIT.NAME}"])<>1'
                  name: '{#UNIT.NAME}: Service is not running'
                  priority: WARNING
                  manual_close: 'YES'
            -
              uuid: bed610e6ce33494b817eb787e34e18c2
              name: '{#UNIT.NAME}: Load state'
              type: DEPENDENT
              key: 'systemd.service.load_state["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              description: 'State value that reflects whether the configuration file of this unit has been loaded. The following states are currently defined: "loaded", "error", and "masked".'
              valuemap:
                name: 'Unit Load State'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.LoadState.state
                -
                  type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 30m
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}"]'
              tags:
                -
                  tag: Application
                  value: 'Systemd service: {#UNIT.NAME}'
            -
              uuid: f1174eb5abf74e028a75ab9bb8eec649
              name: '{#UNIT.NAME}: Unit file state'
              type: DEPENDENT
              key: 'systemd.service.unitfile_state["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              description: 'Encodes the install state of the unit file of FragmentPath. It currently knows the following states: "enabled", "enabled-runtime", "linked", "linked-runtime", "masked", "masked-runtime", "static", "disabled", and "invalid".'
              valuemap:
                name: 'Unit File State'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.UnitFileState.state
                -
                  type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 30m
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}"]'
              tags:
                -
                  tag: Application
                  value: 'Systemd service: {#UNIT.NAME}'
            -
              uuid: a35992b54d944a389c1bb44748a37fdb
              name: '{#UNIT.NAME}: Active time'
              type: DEPENDENT
              key: 'systemd.service.uptime["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: s
              description: 'Number of seconds since unit entered the active state.'
              preprocessing:
                -
                  type: JAVASCRIPT
                  parameters:
                    - |
                      data = JSON.parse(value)
                        if (data.ActiveEnterTimestamp > data.ActiveExitTimestamp) {
                            return Math.floor(Date.now()/1000)-Number(data.ActiveEnterTimestamp)/1000000;
                          }
                        return null;
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}"]'
              tags:
                -
                  tag: Application
                  value: 'Systemd service: {#UNIT.NAME}'
              trigger_prototypes:
                -
                  uuid: e2292c5ead924500a06d38b6356930c7
                  expression: 'last(/Systemd by Zabbix agent 2/systemd.service.uptime["{#UNIT.NAME}"])<10m'
                  name: '{#UNIT.NAME}: has been restarted (uptime < 10m)'
                  priority: INFO
                  description: 'Uptime is less than 10 minutes'
                  manual_close: 'YES'
            -
              uuid: bdb94d1182114985a8734de7d5d92380
              name: '{#UNIT.NAME}: Get unit info'
              key: 'systemd.unit.get["{#UNIT.NAME}"]'
              history: '0'
              trends: '0'
              value_type: TEXT
              description: |
                Returns all properties of a systemd service unit.
                 Unit description: {#UNIT.DESCRIPTION}.
              tags:
                -
                  tag: Application
                  value: 'Zabbix raw items'
        -
          uuid: 5c337762ae7b43a98fcb9dc3102a8467
          name: 'Socket units discovery'
          key: 'systemd.unit.discovery[socket]'
          delay: 30m
          filter:
            evaltype: AND
            conditions:
              -
                macro: '{#UNIT.ACTIVESTATE}'
                value: '{$SYSTEMD.ACTIVESTATE.SOCKET.MATCHES}'
                formulaid: A
              -
                macro: '{#UNIT.ACTIVESTATE}'
                value: '{$SYSTEMD.ACTIVESTATE.SOCKET.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
              -
                macro: '{#UNIT.UNITFILESTATE}'
                value: '{$SYSTEMD.UNITFILESTATE.SOCKET.MATCHES}'
                formulaid: E
              -
                macro: '{#UNIT.UNITFILESTATE}'
                value: '{$SYSTEMD.UNITFILESTATE.SOCKET.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: F
              -
                macro: '{#UNIT.NAME}'
                value: '{$SYSTEMD.NAME.SOCKET.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: C
              -
                macro: '{#UNIT.NAME}'
                value: '{$SYSTEMD.NAME.SOCKET.MATCHES}'
                formulaid: D
          description: 'Discover systemd socket units and their details.'
          item_prototypes:
            -
              uuid: 462ee6b9e70146c8ab6a917c182f3ce7
              name: '{#UNIT.NAME}: Connections accepted per sec'
              type: DEPENDENT
              key: 'systemd.socket.conn_accepted.rate["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              description: 'The number of accepted socket connections (NAccepted) per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.NAccepted
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}",Socket]'
              tags:
                -
                  tag: Application
                  value: 'Systemd socket: {#UNIT.NAME}'
            -
              uuid: 258a899aba9546db956b8e235738bd89
              name: '{#UNIT.NAME}: Connections connected'
              type: DEPENDENT
              key: 'systemd.socket.conn_count["{#UNIT.NAME}"]'
              delay: '0'
              history: 7d
              description: 'The current number of socket connections (NConnections).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.NConnections
              master_item:
                key: 'systemd.unit.get["{#UNIT.NAME}",Socket]'
              tags:
                -
                  tag: Application
                  value: 'Systemd socket: {#UNIT.NAME}'
            -
              uuid: 83ffad5a484d48e388ac658511d4b803
              name: '{#UNIT.NAME}: Get unit info'
              key: 'systemd.unit.get["{#UNIT.NAME}",Socket]'
              history: '0'
              trends: '0'
              value_type: TEXT
              description: |
                Returns all properties of a systemd socket unit.
                 Unit description: {#UNIT.DESCRIPTION}.
              tags:
                -
                  tag: Application
                  value: 'Zabbix raw items'
      macros:
        -
          macro: '{$SYSTEMD.ACTIVESTATE.SERVICE.MATCHES}'
          value: active
          description: 'Filter of systemd service units by active state'
        -
          macro: '{$SYSTEMD.ACTIVESTATE.SERVICE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd service units by active state'
        -
          macro: '{$SYSTEMD.ACTIVESTATE.SOCKET.MATCHES}'
          value: active
          description: 'Filter of systemd socket units by active state'
        -
          macro: '{$SYSTEMD.ACTIVESTATE.SOCKET.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd socket units by active state'
        -
          macro: '{$SYSTEMD.NAME.SERVICE.MATCHES}'
          value: '.*'
          description: 'Filter of systemd service units by name'
        -
          macro: '{$SYSTEMD.NAME.SERVICE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd service units by name'
        -
          macro: '{$SYSTEMD.NAME.SOCKET.MATCHES}'
          value: '.*'
          description: 'Filter of systemd socket units by name'
        -
          macro: '{$SYSTEMD.NAME.SOCKET.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd socket units by name'
        -
          macro: '{$SYSTEMD.UNITFILESTATE.SERVICE.MATCHES}'
          value: enabled
          description: 'Filter of systemd service units by unit file state'
        -
          macro: '{$SYSTEMD.UNITFILESTATE.SERVICE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd service units by unit file state'
        -
          macro: '{$SYSTEMD.UNITFILESTATE.SOCKET.MATCHES}'
          value: enabled
          description: 'Filter of systemd socket units by unit file state'
        -
          macro: '{$SYSTEMD.UNITFILESTATE.SOCKET.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter of systemd socket units by unit file state'
      valuemaps:
        -
          uuid: fe20979701834a80a823c514d11c19e7
          name: 'Unit Active State'
          mappings:
            -
              value: '0'
              newvalue: unknown
            -
              value: '1'
              newvalue: active
            -
              value: '2'
              newvalue: reloading
            -
              value: '3'
              newvalue: inactive
            -
              value: '4'
              newvalue: failed
            -
              value: '5'
              newvalue: activating
            -
              value: '6'
              newvalue: deactivating
        -
          uuid: e0a5e55e5a074a26935386c5e29a0e36
          name: 'Unit File State'
          mappings:
            -
              value: '0'
              newvalue: unknown
            -
              value: '1'
              newvalue: enabled
            -
              value: '2'
              newvalue: enabled-runtime
            -
              value: '3'
              newvalue: linked
            -
              value: '4'
              newvalue: linked-runtime
            -
              value: '5'
              newvalue: masked
            -
              value: '6'
              newvalue: masked-runtime
            -
              value: '7'
              newvalue: static
            -
              value: '8'
              newvalue: disabled
            -
              value: '9'
              newvalue: invalid
        -
          uuid: 0309ef57e92a4ea2ae4404a685f0e7b8
          name: 'Unit Load State'
          mappings:
            -
              value: '0'
              newvalue: unknown
            -
              value: '1'
              newvalue: loaded
            -
              value: '2'
              newvalue: error
            -
              value: '3'
              newvalue: masked