-
Notifications
You must be signed in to change notification settings - Fork 0
/
WinProcessStats.xml
599 lines (578 loc) · 24.9 KB
/
WinProcessStats.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
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
<?xml version="1.0" encoding="UTF-8" ?>
<feed version="1.0" hasPendingRequests="false" >
<company></company>
<status>200</status>
<errmsg>OK</errmsg>
<interval>0</interval>
<entry type="predatasource">
<version>1587069037</version>
<name>WinProcessStats</name>
<displayedas>Processes</displayedas>
<description>Monitor the resource usage of a process.</description>
<collector>batchscript</collector>
<hasMultiInstances>true</hasMultiInstances>
<schedule>180</schedule>
<appliesTo>isWindows()</appliesTo>
<wildcardauto>true</wildcardauto>
<wildcardpersist>false</wildcardpersist>
<wildcardlinuxscript>ad_script</wildcardlinuxscript>
<wildcardlinuxcmdline>type="embeded" </wildcardlinuxcmdline>
<wildcardwinscript>ad_script</wildcardwinscript>
<wildcardwincmdline>type="embeded" </wildcardwincmdline>
<wildcardgroovyscript>import com.santaba.agent.groovyapi.win32.WMI;
def host = hostProps.get("system.hostname");
def process_name = [];
// get the process list
def process_list = WMI.queryAll(host, "select * from Win32_PerfRawData_PerfProc_Process");
// enumerate as a map
process_list.each
{ process_map ->
// enumerate each of the fields in this process map
process_map.each
{ key,value ->
//grab the name
if ((key == "NAME") )
{
//feed the svc list
process_name.add(value)
}
}
}
//iterate to the built list 'process_name' & extract values to build the output line(s)
process_name.eachWithIndex { item, index ->
//check for SpecialCharacters & remove them
item2=SpecialCharacterCheck(item)
println item2+"##"+item;
}
return(0);
//according to :
//https://www.logicmonitor.com/support/logicmodules/datasources/active-discovery/script-active-discovery
//active discovery WILDVALUE cannot contain ['=',':','\','#','space'] characters
//the function below will get rid of those special characters if they exist
def SpecialCharacterCheck(process){
//special characters not allowed in ActiveDiscovery
def specialCharacters = ~/\=|\:|\\|\#|\s/
//replace the special character by nothing & return the 'new' process name
process=process.replaceAll(specialCharacters, '')
//println(process); //DEBUG
return process
}</wildcardgroovyscript>
<wildcardschedule>0</wildcardschedule>
<wildcarddisable>false</wildcarddisable>
<wildcarddeleteinactive>true</wildcarddeleteinactive>
<agdmethod>none</agdmethod>
<agdparams></agdparams>
<group>Windows Processes</group>
<tags></tags>
<technology>#04/16/2020
Datasource created with the intent of don't perform a WMI query for each process instance (this will reduce the collector usage)</technology>
<adlist><![CDATA[{"agdmethod":"none","method":"ad_script","agdparams":"","id":0,"filters":[{"attribute":"##WILDVALUE##","operation":"RegexNotMatch","value":"_Total|Idle"},{"attribute":"##WILDVALUE##","operation":"RegexNotMatch","value":"##process.exclusions##"}],"params":{"type":"embeded","groovyscript":"import com.santaba.agent.groovyapi.win32.WMI;\n\ndef host = hostProps.get(\"system.hostname\");\ndef process_name = [];\n\n// get the process list\ndef process_list = WMI.queryAll(host, \"select * from Win32_PerfRawData_PerfProc_Process\");\n\n// enumerate as a map\nprocess_list.each\n{ process_map ->\n // enumerate each of the fields in this process map\n process_map.each\n { key,value ->\n //grab the name\n if ((key == \"NAME\") )\n {\n //feed the svc list\n process_name.add(value)\n }\n } \n}\n\n//iterate to the built list 'process_name' & extract values to build the output line(s)\nprocess_name.eachWithIndex { item, index ->\n //check for SpecialCharacters & remove them\n item2=SpecialCharacterCheck(item)\n \n println item2+\"##\"+item;\n}\n\nreturn(0);\n\n//according to :\n//https://www.logicmonitor.com/support/logicmodules/datasources/active-discovery/script-active-discovery\n//active discovery WILDVALUE cannot contain ['=',':','\\','#','space'] characters\n//the function below will get rid of those special characters if they exist\ndef SpecialCharacterCheck(process){\n\t//special characters not allowed in ActiveDiscovery\n\tdef specialCharacters = ~/\\=|\\:|\\\\|\\#|\\s/\n\n\t//replace the special character by nothing & return the 'new' process name\n\tprocess=process.replaceAll(specialCharacters, '')\n\t//println(process); //DEBUG\n\n\treturn process\n}"}}]]></adlist>
<schemaVersion>2</schemaVersion>
<dataSourceType>1</dataSourceType>
<attributes>
<attribute>
<name>scripttype</name>
<value>embed</value>
<comment></comment>
</attribute>
<attribute>
<name>scriptgroovy</name>
<value>import com.santaba.agent.groovyapi.win32.WMI;
def host = hostProps.get("system.hostname");
def process_name = [];
def process_percentprocessortime = [];
def process_handlecount = [];
def process_iodatabytespersec = [];
def process_processid = [];
def process_threadcount = [];
def process_workingset = [];
// get the processes list
def process_list = WMI.queryAll(host, "select * from Win32_PerfRawData_PerfProc_Process");
// enumerate as a map
process_list.each
{ process_map ->
// enumerate each of the fields in this process map
process_map.each
{ key,value ->
//grab the name
if ((key == "NAME") )
{
//add the process name into the 'svc' list
process_name.add(value)
}
//grab the HandleCount
if ((key == "HANDLECOUNT") )
{
//add the process name into the 'svc' list
process_handlecount.add(value)
}
//grab the IODataBytesPerSec
if ((key == "IODATABYTESPERSEC") )
{
//add the process name into the 'svc' list
process_iodatabytespersec.add(value)
}
//grab the PercentProcessorTime
if ((key == "PERCENTPROCESSORTIME") )
{
//add the process name into the 'svc' list
process_percentprocessortime.add(value)
}
//grab the ProcessID
if ((key == "IDPROCESS") )
{
//add the process name into the 'svc' list
process_processid.add(value)
}
//grab the ThreadCount
if ((key == "THREADCOUNT") )
{
//add the process name into the 'svc' list
process_threadcount.add(value)
}
//grab the WorkingSet
if ((key == "WORKINGSET") )
{
//add the process name into the 'svc' list
process_workingset.add(value)
}
}
}
//iterate to the built list 'process_name' & extract values to build the output line(s)
process_name.eachWithIndex { item, index ->
//check for SpecialCharacters & remove them
item2=SpecialCharacterCheck(item)
println item2+".HandleCount="+process_handlecount[index]
println item2+".IODataBytesPerSec="+process_iodatabytespersec[index]
println item2+".PercentProcessorTime="+process_percentprocessortime[index]
println item2+".ProcessID="+process_processid[index]
println item2+".ThreadCount="+process_threadcount[index]
println item2+".WorkingSet="+process_workingset[index]
}
return(0);
//according to :
//https://www.logicmonitor.com/support/logicmodules/datasources/active-discovery/script-active-discovery
//active discovery WILDVALUE cannot contain ['=',':','\','#','space'] characters
//the function below will get rid of those special characters if they exist
def SpecialCharacterCheck(process){
//special characters not allowed in ActiveDiscovery
def specialCharacters = ~/\=|\:|\\|\#|\s/
//replace the special character by nothing & return the 'new' process name
process=process.replaceAll(specialCharacters, '')
//println(process); //DEBUG
return process
}</value>
<comment></comment>
</attribute>
<attribute>
<name>windowsscript</name>
<value></value>
<comment></comment>
</attribute>
<attribute>
<name>linuxscript</name>
<value></value>
<comment></comment>
</attribute>
<attribute>
<name>windowscmdline</name>
<value></value>
<comment></comment>
</attribute>
<attribute>
<name>linuxcmdline</name>
<value></value>
<comment></comment>
</attribute>
<attribute>
<name>__filter_0</name>
<value>##WILDVALUE## RegexNotMatch _Total|Idle</value>
<comment>Excluding processes generally</comment>
</attribute>
<attribute>
<name>__filter_1</name>
<value>##WILDVALUE## RegexNotMatch ##process.exclusions##</value>
<comment>Custom property to be applied within CLIENTS group (used to filter processes)</comment>
</attribute>
</attributes>
<datapoints>
<datapoint>
<name>HandleCount</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.HandleCount</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody></alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>IODataBytesPerSec</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.IODataBytesPerSec</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody></alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Rate at which the process is reading and writing bytes in I/O operations. This property counts all I/O activity generated by the process to include file, network, and device I/Os.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>ProcessCPUPercent</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>expression</postprocessormethod>
<postprocessorparam>PercentProcessorTime/100000</postprocessorparam>
<usevalue></usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody>The process ##INSTANCE## ##DSIDESCRIPTION## on Windows host ##HOST## is taking up ##VALUE##% of CPU cycles, placing the processes into ##LEVEL## state.
Values exceeding 100% means the process consumes resources of more than one CPU or core.
This started at ##START##, -- or ##DURATION## ago.</alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Percent of CPU cycles. Value exceeding 100% means the process consumes resources of more than one CPU or core.</description>
<maxvalue></maxvalue>
<minvalue></minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>PercentProcessorTime</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.PercentProcessorTime</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody></alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Percentage of elapsed time that all of the threads of this process used the processor to execute instructions.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>ProcessID</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.ProcessID</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody>The process ##INSTANCE## ##DSIDESCRIPTION## on Windows host ##HOST## has stopped and is no longer collecting data, placing the processes into ##LEVEL## state.
The process has not been detected since ##START##, -- or ##DURATION## ago. .</alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Used to detect if a process is running.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>ThreadCount</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.ThreadCount</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody></alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Number of threads currently active in this process.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
<datapoint>
<name>WorkingSet</name>
<dataType>7</dataType>
<type>2</type>
<postprocessormethod>namevalue</postprocessormethod>
<postprocessorparam>##WILDVALUE##.WorkingSet</postprocessorparam>
<usevalue>output</usevalue>
<alertexpr></alertexpr>
<alertmissing>1</alertmissing>
<alertsubject></alertsubject>
<alertbody></alertbody>
<enableanomalyalertsuppression></enableanomalyalertsuppression>
<description>Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process.</description>
<maxvalue></maxvalue>
<minvalue>0</minvalue>
<userparam1></userparam1>
<userparam2></userparam2>
<userparam3></userparam3>
<iscomposite>false</iscomposite>
<rpn></rpn>
<alertTransitionIval>5</alertTransitionIval>
<alertClearTransitionIval>0</alertClearTransitionIval>
</datapoint>
</datapoints>
<graphs>
<graph>
<name>CPU Usage</name>
<title>CPU Usage</title>
<verticallabel>%</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>false</base1024>
<graphdatapoints>
<graphdatapoint>
<name>ProcessCPUPercent</name>
<datapointname>ProcessCPUPercent</datapointname>
<cf>1</cf>
</graphdatapoint>
</graphdatapoints>
<graphvirtualdatapoints>
</graphvirtualdatapoints>
<graphdatas>
<graphdata>
<type>2</type>
<legend>CPU Usage (single core)</legend>
<color>red</color>
<datapointname>ProcessCPUPercent</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
</graphdata>
</graphdatas>
</graph>
<graph>
<name>Data Throughput</name>
<title>Data Throughput</title>
<verticallabel>bytes/sec</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>true</base1024>
<graphdatapoints>
<graphdatapoint>
<name>IODataBytesPerSec</name>
<datapointname>IODataBytesPerSec</datapointname>
<cf>1</cf>
</graphdatapoint>
</graphdatapoints>
<graphvirtualdatapoints>
</graphvirtualdatapoints>
<graphdatas>
<graphdata>
<type>2</type>
<legend>Throughput</legend>
<color>blue</color>
<datapointname>IODataBytesPerSec</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
</graphdata>
</graphdatas>
</graph>
<graph>
<name>File Handles</name>
<title>File Handles</title>
<verticallabel>count</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>false</base1024>
<graphdatapoints>
<graphdatapoint>
<name>HandleCount</name>
<datapointname>HandleCount</datapointname>
<cf>1</cf>
</graphdatapoint>
</graphdatapoints>
<graphvirtualdatapoints>
</graphvirtualdatapoints>
<graphdatas>
<graphdata>
<type>1</type>
<legend>Handle Count</legend>
<color>fuchsia</color>
<datapointname>HandleCount</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
</graphdata>
</graphdatas>
</graph>
<graph>
<name>Process Memory</name>
<title>Process Memory</title>
<verticallabel>bytes</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>true</base1024>
<graphdatapoints>
<graphdatapoint>
<name>WorkingSet</name>
<datapointname>WorkingSet</datapointname>
<cf>1</cf>
</graphdatapoint>
</graphdatapoints>
<graphvirtualdatapoints>
</graphvirtualdatapoints>
<graphdatas>
<graphdata>
<type>1</type>
<legend>Working Set</legend>
<color>orange2</color>
<datapointname>WorkingSet</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
</graphdata>
</graphdatas>
</graph>
<graph>
<name>Threads</name>
<title>Threads</title>
<verticallabel>count</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>false</base1024>
<graphdatapoints>
<graphdatapoint>
<name>ThreadCount</name>
<datapointname>ThreadCount</datapointname>
<cf>1</cf>
</graphdatapoint>
</graphdatapoints>
<graphvirtualdatapoints>
</graphvirtualdatapoints>
<graphdatas>
<graphdata>
<type>2</type>
<legend>Threads</legend>
<color>gray</color>
<datapointname>ThreadCount</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
</graphdata>
</graphdatas>
</graph>
</graphs>
<overviewgraphs>
<overviewgraph>
<name>Top 10 Processes by CPU Usage</name>
<title>Top 10 Processes by CPU Usage</title>
<verticallabel>%</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>false</base1024>
<aggregated>false</aggregated>
<datapoints>
<overviewgraphdatapoint>
<name>ProcessCPUPercent</name>
<datapointname>ProcessCPUPercent</datapointname>
<cf>1</cf>
<aggregateMethod>sum</aggregateMethod>
</overviewgraphdatapoint>
</datapoints>
<virtualdatapoints>
</virtualdatapoints>
<lines>
<overviewgraphline>
<type>1</type>
<legend>##INSTANCE##</legend>
<datapointname>ProcessCPUPercent</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
<color>silver</color>
</overviewgraphline>
</lines>
</overviewgraph>
<overviewgraph>
<name>Top 10 Processes by Data Throughput</name>
<title>Top 10 Processes by Data Throughput</title>
<verticallabel>bytes/sec</verticallabel>
<rigid>false</rigid>
<maxvalue>NaN</maxvalue>
<minvalue>0.0</minvalue>
<displayprio>1</displayprio>
<timescale>1day</timescale>
<base1024>true</base1024>
<aggregated>false</aggregated>
<datapoints>
<overviewgraphdatapoint>
<name>IODataBytesPerSec</name>
<datapointname>IODataBytesPerSec</datapointname>
<cf>1</cf>
<aggregateMethod>sum</aggregateMethod>
</overviewgraphdatapoint>
</datapoints>
<virtualdatapoints>
</virtualdatapoints>
<lines>
<overviewgraphline>
<type>1</type>
<legend>##INSTANCE##</legend>
<datapointname>IODataBytesPerSec</datapointname>
<isvirtualdatapoint>false</isvirtualdatapoint>
<color>silver</color>
</overviewgraphline>
</lines>
</overviewgraph>
</overviewgraphs>
<scripts>
</scripts>
</entry>
</feed>