summaryrefslogtreecommitdiffstats
path: root/itl/command-nscp-local.conf
blob: 8498d68f87c1f797d85bc943631d1e9e5567bd20 (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
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */

if (!globals.contains("NscpPath")) {
	globals.NscpPath = dirname(msi_get_component_path("{5C45463A-4AE9-4325-96DB-6E239C034F93}"))
}

object CheckCommand "nscp-local" {
	command = [ NscpPath + "\\nscp.exe", "client" ]

	arguments = {
		"--log" = {
			value = "$nscp_log_level$"
			description = "The log level to use"
		}
		"--load-all" = {
			set_if ="$nscp_load_all$"
			description = "Load all plugins (currently only used with generate)"
		}
		"--module" = {
			value = "$nscp_modules$"
			description = "Specify which NSClient++ modules are required. 'nscp client' just needs 'CheckSystem' by default."
			repeat_key = true
		}
		"-q" = {
			value = "$nscp_query$"
			description = "Run a query with a given name"
			required = true
		}
		"-b" = {
			set_if = "$nscp_boot$"
			description = "Boot the client before executing command (similar as running the command from test mode)"
		}
		"-a" = {
			value = "$nscp_arguments$"
			repeat_key = true
			description = "List of arguments (arguments gets -- prefixed automatically (--argument foo=bar is the same as setting '--foo bar')"
		}
		"--show-all" = {
			set_if = "$nscp_showall$"
			description = ""
		}
	}

	vars.nscp_log_level = "critical"
	vars.nscp_load_all = false
	vars.nscp_boot = true
	vars.nscp_showall = false
	vars.nscp_modules = [ "CheckSystem" ]
}

object CheckCommand "nscp-local-cpu" {
	import  "nscp-local"

	arguments += {
		"--time" = {
			value = "$nscp_cpu_time$"
			repeat_key = true
			description = "The time to check"
		}
		"--warning" = {
			value = "load>$nscp_cpu_warning$"
		}
		"--critical" = {
			value = "load>$nscp_cpu_critical$"
		}
		"-a" = {
			value = "$nscp_cpu_arguments$"
			repeat_key = true
		}
	}

	vars.nscp_query = "check_cpu"
	vars.nscp_showall = "$nscp_cpu_showall$"

	vars.nscp_cpu_time = [ "1m", "5m", "15m" ]
	vars.nscp_cpu_showall = true
	vars.nscp_cpu_warning = 80
	vars.nscp_cpu_critical = 90
}

object CheckCommand "nscp-local-memory" {
	import  "nscp-local"

	arguments += {
		"--type=committed" = {
			set_if = "$nscp_memory_committed$"
			description = "Total memory (RAM+PAGE)"
		}
		"--type=physical" = {
			set_if = "$nscp_memory_physical$"
			description = "Physical memory (RAM)"
		}
		"--warning" = {
			value = "$nscp_memory_op$ $nscp_memory_warning$"
		}
		"--critical" = {
			value = "$nscp_memory_op$ $nscp_memory_critical$"
		}
		"-a" = {
			value = "$nscp_memory_arguments$"
			repeat_key = true
		}
	}

	vars.nscp_query = "check_memory"
	vars.nscp_showall = "$nscp_memory_showall$"

	vars.nscp_memory_op = {{
		if (!macro("$nscp_memory_free$")) {
			return "used >"
		} else {
			return "free <"
		}
	}}

	vars.nscp_memory_committed = false
	vars.nscp_memory_physical = true
	vars.nscp_memory_free = true
	vars.nscp_memory_warning = {{
		if (!macro("$nscp_memory_free$")) {
			return 80
		} else {
			return 20
		}
	}}
	vars.nscp_memory_critical = {{
		if (!macro("$nscp_memory_free$")) {
			return 90
		} else {
			return 10
		}
	}}
	vars.nscp_memory_showall = false
}

object CheckCommand "nscp-local-os-version" {
	import  "nscp-local"

	vars.nscp_query = "check_os_version"
}

object CheckCommand "nscp-local-pagefile" {
	import  "nscp-local"

	vars.nscp_query = "check_pagefile"
}

object CheckCommand "nscp-local-process" {
	import  "nscp-local"

	vars.nscp_query = "check_process"
}

object CheckCommand "nscp-local-service" {
	import  "nscp-local"

	arguments += {
		"--service" = {
			value = "$nscp_service_name$"
			repeat_key = true
		}
		"--ok" = {
			value = "$nscp_service_otype$='$nscp_service_ok$'"
		}
		"--warning" = {
			value = "$nscp_service_wtype$='$nscp_service_warning$'"
		}
		"--critical" = {
			value = "$nscp_service_ctype$='$nscp_service_critical$'"
		}
		"-a" = {
			value = "$nscp_service_arguments$"
			repeat_key = true
		}
	}

	vars.nscp_query = "check_service"
	vars.nscp_showall = "$nscp_service_showall$"

	vars.nscp_service_showall = true
	vars.nscp_service_type = "state"
	vars.nscp_service_otype = vars.nscp_service_type
	vars.nscp_service_wtype = vars.nscp_service_type
	vars.nscp_service_ctype = vars.nscp_service_type
}

object CheckCommand "nscp-local-uptime" {
	import  "nscp-local"

	vars.nscp_query = "check_uptime"
}

object CheckCommand "nscp-local-version" {
	import  "nscp-local"

	vars.nscp_query = "check_version"
	vars.nscp_modules = [ "CheckHelpers" ]
}

object CheckCommand "nscp-local-disk" {
	import "nscp-local"

	arguments += {
		"--drive" = {
			value = "$nscp_disk_drive$"
			repeat_key = true
		}
		"--exclude" = {
			value = "$nscp_disk_exclude$"
			repeat_key = true
		}
		"--warning" = {
			value = "$nscp_disk_op$ $nscp_disk_warning$"
		}
		"--critical" = {
			value = "$nscp_disk_op$ $nscp_disk_critical$"
		}
		"-a" = {
			value = "$nscp_disk_arguments$"
			repeat_key = true
		}
	}

	vars.nscp_query = "check_drivesize"
	vars.nscp_showall = "$nscp_disk_showall$"

	vars.nscp_disk_op = {{
		if (!macro("$nscp_disk_free$")) {
			return "used >"
		} else {
			return "free <"
		}
	}}

	vars.nscp_disk_showall = true
	vars.nscp_disk_free = false
	vars.nscp_disk_warning = {{
		if (!macro("$nscp_disk_free$")) { return 80 } else { return 20 }
	}}
	vars.nscp_disk_critical = {{
		if (!macro("$nscp_disk_free$")) { return 90 } else { return 10 }
	}}

	vars.nscp_modules = [ "CheckDisk" ]
}

object CheckCommand "nscp-local-counter" {
	import "nscp-local"

	arguments += {
		"--counter" = {
			value = "$nscp_counter_name$"
			repeat_key = true
		}
		"--warning" = {
			value = "value $nscp_counter_op$ $nscp_counter_warning$"
		}
		"--critical" = {
			value = "value $nscp_counter_op$ $nscp_counter_critical$"
		}
		"--perf-syntax" = {
			value = "$nscp_counter_perfsyntax$"
		}
		"-a" = {
			value = "$nscp_counter_arguments$"
			repeat_key = true
		}
	}

	vars.nscp_counter_op = {{
		if (!macro("$nscp_counter_less$")) {
			return ">"
		} else {
			return "<"
		}
	}}

	vars.nscp_query = "check_pdh"
	vars.nscp_showall = "$nscp_counter_showall$"
	vars.nscp_counter_less = false
	vars.nscp_counter_perfsyntax = "$nscp_counter_name$"
}

object CheckCommand "nscp-local-tasksched" {
        import "nscp-local"

        arguments += {
                "--filter" = {
                        set_if = {{
                                var scheduler_name = macro("$nscp_tasksched_name$")
                                if (len(scheduler_name) > 0 ) {
                                        return true
                                } else {
                                        return false
                                }
                        }}
                        value = "title='$nscp_tasksched_name$'"
                        description = "Name of the task to check."
                }
                "--folder" = {
                        value = "$nscp_tasksched_folder$"
                        description = "The folder in which the tasks to check reside."
                }
                "--hidden" = {
                        set_if = "$nscp_tasksched_hidden$"
                        description = "Look for hidden tasks."
                }
                "--recursive" = {
                        value = "$nscp_tasksched_recursive$"
                        description = "Recurse sub folder (defaults to true)."
                }
                "--warning" = {
                        value = "$nscp_tasksched_warning$"
                        description = "Filter which marks items which generates a warning state."
                }
                "--critical" = {
                        value = "$nscp_tasksched_critical$"
                        description = "Filter which marks items which generates a critical state."
                }
                "--empty-state" = {
                        value = "$nscp_tasksched_emptystate$"
                        description = "Return status to use when nothing matched filter."
                }
                "--perf-syntax" = {
                        value = "$nscp_tasksched_perfsyntax$"
                        description = "Performance alias syntax."
                }
                "--detail-syntax" = {
                        value = "$nscp_tasksched_detailsyntax$"
                        description = "Detail level syntax."
                }
                "-a" = {
                        value = "$nscp_tasksched_arguments$"
                        repeat_key = true
                }
        }

        vars.nscp_modules = "CheckTaskSched"
        vars.nscp_query = "check_tasksched"
        vars.nscp_showall = "$nscp_tasksched_showall$"
        vars.nscp_tasksched_recursive = true
        vars.nscp_tasksched_perfsyntax = "%(title)"
        vars.nscp_tasksched_detailsyntax = "%(folder)/%(title): %(exit_code) != 0"
        vars.nscp_tasksched_warning = "exit_code != 0"
        vars.nscp_tasksched_critical = "exit_code < 0"

}