-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTemplate_win_ping_v5.2.yaml
149 lines (147 loc) · 4.94 KB
/
Template_win_ping_v5.2.yaml
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
zabbix_export:
version: '5.2'
date: '2022-03-11T10:16:49Z'
groups:
-
name: Templates
templates:
-
template: 'Template Module ICMP ping from windows agent'
name: 'Template Module ICMP ping from windows agent'
description: |
Oleg Kostikov aka Semiadmin
Module for ICMP ping test from the Zabbix Windows agent.
Put the comma-separated target list in user macro {$PING_LIST} at the template or host level and run a LLD rule.
List example:
8.8.8.8,www.ya.ru,10.10.10.10,::1
groups:
-
name: Templates
applications:
-
name: 'ICMP ping'
-
name: 'Zabbix raw items'
discovery_rules:
-
name: 'ICMP ping discovery'
type: SCRIPT
key: icmpping.discovery
delay: 1d
params: 'return ''[''+''{$PING_LIST}''.replace(/([^,]+)/g,''{"{#ADDR}":"$1"}'')+'']'''
lifetime: 1w
item_prototypes:
-
name: 'ping status {#ADDR}'
type: DEPENDENT
key: 'ping.status[{#ADDR}]'
delay: '0'
applications:
-
name: 'ICMP ping'
valuemap:
name: 'Service state'
preprocessing:
-
type: JSONPATH
parameters:
- $..StatusCode.first()
error_handler: CUSTOM_VALUE
error_handler_params: '1'
-
type: JAVASCRIPT
parameters:
- |
if (value == 0) {return(1)} else {return(0)}
master_item:
key: 'wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address=''{#ADDR}'' AND Timeout=2000"]'
-
name: 'resolution status {#ADDR}'
type: DEPENDENT
key: 'resolution.status[{#ADDR}]'
delay: '0'
discover: NO_DISCOVER
applications:
-
name: 'ICMP ping'
preprocessing:
-
type: JSONPATH
parameters:
- $..PrimaryAddressResolutionStatus.first()
-
type: JAVASCRIPT
parameters:
- |
if (value == 0) {return(1)} else {return(0)}
master_item:
key: 'wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address=''{#ADDR}'' AND Timeout=2000"]'
-
name: 'response time {#ADDR}'
type: DEPENDENT
key: 'response.time[{#ADDR}]'
delay: '0'
value_type: FLOAT
units: s
applications:
-
name: 'ICMP ping'
preprocessing:
-
type: JSONPATH
parameters:
- $..ResponseTime.first()
error_handler: DISCARD_VALUE
-
type: MULTIPLIER
parameters:
- '0.001'
-
type: IN_RANGE
parameters:
- '0.001'
- ''
error_handler: CUSTOM_VALUE
error_handler_params: '0.001'
master_item:
key: 'wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address=''{#ADDR}'' AND Timeout=2000"]'
-
name: 'get icmp ping {#ADDR}'
key: 'wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address=''{#ADDR}'' AND Timeout=2000"]'
history: '0'
trends: '0'
value_type: TEXT
applications:
-
name: 'Zabbix raw items'
overrides:
-
name: 'resolution status for DNS names'
step: '1'
filter:
conditions:
-
macro: '{#ADDR}'
value: '.*\.\D+$'
formulaid: A
operations:
-
operationobject: ITEM_PROTOTYPE
operator: LIKE
value: 'resolution status'
discover: DISCOVER
macros:
-
macro: '{$PING_LIST}'
value: '8.8.8.8,www.ya.ru,10.10.10.10,::1'
description: sample
value_maps:
-
name: 'Service state'
mappings:
-
value: '0'
newvalue: Down
-
value: '1'
newvalue: Up