-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTemplate_win_ping.xml
185 lines (185 loc) · 8.48 KB
/
Template_win_ping.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.4</version>
<date>2020-01-21T08:13:33Z</date>
<groups>
<group>
<name>Templates/Modules</name>
</group>
</groups>
<templates>
<template>
<template>Template Module ICMP ping from the Zabbix Windows agent</template>
<name>Template Module ICMP ping from the Zabbix Windows agent</name>
<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 the "get ICMP ping list" item.
List example:
8.8.8.8,www.ya.ru,10.10.10.10</description>
<groups>
<group>
<name>Templates/Modules</name>
</group>
</groups>
<applications>
<application>
<name>ICMP ping</name>
</application>
<application>
<name>Zabbix raw item</name>
</application>
</applications>
<items>
<item>
<name>get ICMP ping list</name>
<type>SIMPLE</type>
<key>icmpping[localhost]</key>
<delay>1d</delay>
<history>0</history>
<trends>0</trends>
<description>Dummy item for addresses LLD from {$PING_LIST} user macro</description>
<applications>
<application>
<name>Zabbix raw item</name>
</application>
</applications>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>ICMP ping discovery</name>
<type>DEPENDENT</type>
<key>icmpping.discovery</key>
<delay>0</delay>
<lifetime>0</lifetime>
<item_prototypes>
<item_prototype>
<name>ping status {#ADDR}</name>
<type>DEPENDENT</type>
<key>ping.status[{#ADDR}]</key>
<delay>0</delay>
<applications>
<application>
<name>ICMP ping</name>
</application>
</applications>
<valuemap>
<name>Service state</name>
</valuemap>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$..StatusCode.first()</params>
<error_handler>CUSTOM_VALUE</error_handler>
<error_handler_params>1</error_handler_params>
</step>
<step>
<type>JAVASCRIPT</type>
<params>if (value == 0) {return(1)} else {return(0)}
</params>
</step>
</preprocessing>
<master_item>
<key>wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address='{#ADDR}' AND Timeout=2000"]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>resolution status {#ADDR}</name>
<type>DEPENDENT</type>
<key>resolution.status[{#ADDR}]</key>
<delay>0</delay>
<applications>
<application>
<name>ICMP ping</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$..PrimaryAddressResolutionStatus.first()</params>
</step>
<step>
<type>JAVASCRIPT</type>
<params>if (value == 0) {return(1)} else {return(0)}
</params>
</step>
</preprocessing>
<master_item>
<key>wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address='{#ADDR}' AND Timeout=2000"]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>response time {#ADDR}</name>
<type>DEPENDENT</type>
<key>response.time[{#ADDR}]</key>
<delay>0</delay>
<value_type>FLOAT</value_type>
<units>s</units>
<applications>
<application>
<name>ICMP ping</name>
</application>
</applications>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$..ResponseTime.first()</params>
<error_handler>DISCARD_VALUE</error_handler>
</step>
<step>
<type>MULTIPLIER</type>
<params>0.001</params>
</step>
</preprocessing>
<master_item>
<key>wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address='{#ADDR}' AND Timeout=2000"]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>get icmp ping {#ADDR}</name>
<key>wmi.getall[root\cimv2,"SELECT PrimaryAddressResolutionStatus, StatusCode, ResponseTime FROM Win32_PingStatus WHERE Address='{#ADDR}' AND Timeout=2000"]</key>
<history>0</history>
<trends>0</trends>
<value_type>TEXT</value_type>
<applications>
<application>
<name>Zabbix raw item</name>
</application>
</applications>
</item_prototype>
</item_prototypes>
<master_item>
<key>icmpping[localhost]</key>
</master_item>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>return '{$PING_LIST}'.replace(/([^,]+)/g,'{"{#ADDR}":"$1"}').replace(/(.*)/,'[$1]')
</params>
</step>
</preprocessing>
</discovery_rule>
</discovery_rules>
<macros>
<macro>
<macro>{$PING_LIST}</macro>
</macro>
</macros>
</template>
</templates>
<value_maps>
<value_map>
<name>Service state</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Down</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Up</newvalue>
</mapping>
</mappings>
</value_map>
</value_maps>
</zabbix_export>