I’m having trouble setting up a folder size check in Icinga2. I’ve already taken several steps to ensure everything is configured correctly, but I’m encountering various issues.
Problem Description:
I want to monitor a folder on a Windows client and retrieve the total size of the folder. I created a batch script that works with the command dir "C:\Path\To\Folder" /s /a and correctly returns the total size when I run it manually. The script is located in the C:\Program Files\ICINGA2\scripts directory.
Error Messages:
When attempting to execute the script through Icinga2, I receive the following error message:
execvpe(cmd) failed: No such file or directory
and
execvpe(C:\Windows\System32\cmd.exe) failed: No such file or directory
Steps I’ve Taken:
Defined CheckCommand: I created a CheckCommand for the folder size and linked it to the batch file.
Defined Service: I set up a service for the folder size that is associated with the relevant host.
Checked Permissions: Icinga runs under the “Local System Account,” and I verified the permissions of the target folder to ensure the SYSTEM user has access.
Tested Batch Script: The script outputs the correct folder size when executed directly in the command prompt.
Validated Configuration: I ran icinga2 daemon -C and checked the configuration for errors, but everything seems to be in order.
Question:
Does anyone have any ideas on how I can resolve the issue with executing the script through Icinga2? Are there specific configurations that I might have overlooked? I would appreciate any help!
I’m a bit further along. I found the service Invoke-‘IcingaCheckDirectory’. according to the website, there is the argument ‘CriticalTotalSize’. I don’t have this argument in my service. what could be the reason?
The Icinga 2 network monitoring daemon (version: r2.14.2-1)
in the preview you can also see that there is no line that defines the total size
IcingaCheckDirectory' "
}
"-ChangeOlderThan" = {
order = 8
value = "$IcingaCheckDirectory_String_ChangeOlderThan$"
}
"-ChangeTimeEqual" = {
order = 6
value = "$IcingaCheckDirectory_String_ChangeTimeEqual$"
}
"-ChangeYoungerThan" = {
order = 7
value = "$IcingaCheckDirectory_String_ChangeYoungerThan$"
}
"-CreationOlderThan" = {
order = 10
value = "$IcingaCheckDirectory_String_CreationOlderThan$"
}
"-CreationTimeEqual" = {
order = 9
value = "$IcingaCheckDirectory_String_CreationTimeEqual$"
}
"-CreationYoungerThan" = {
order = 11
value = "$IcingaCheckDirectory_String_CreationYoungerThan$"
}
"-Critical" = {
order = 4
value = "$IcingaCheckDirectory_Object_Critical$"
}
"-FileNames" = {
order = 3
value = {{
var arr = macro("$IcingaCheckDirectory_Array_FileNames$");
if (len(arr) == 0) {
return "@()";
}
return arr.map(
x => if (typeof(x) == String) {
var argLen = len(x);
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
x;
} else {
"'" + x + "'";
}
} else {
x;
}
).join(",");
}}
}
"-FileSizeGreaterThan" = {
order = 12
value = "$IcingaCheckDirectory_String_FileSizeGreaterThan$"
}
"-FileSizeSmallerThan" = {
order = 13
value = "$IcingaCheckDirectory_String_FileSizeSmallerThan$"
}
"-NoPerfData" = {
order = 99
set_if = "$IcingaCheckDirectory_Switchparameter_NoPerfData$"
}
"-Path" = {
order = 2
value = "$IcingaCheckDirectory_String_Path$"
}
"-Recurse" = {
order = 99
set_if = "$IcingaCheckDirectory_Switchparameter_Recurse$"
}
"-ThresholdInterval" = {
order = 100
value = "$IcingaCheckDirectory_String_ThresholdInterval$"
}
"-Verbosity" = {
order = 14
value = "$IcingaCheckDirectory_Int32_Verbosity$"
}
"-Warning" = {
order = 5
value = "$IcingaCheckDirectory_Object_Warning$"
}
}
Oh wow! But how do I update the plugin version? It doesn’t seem to be tied to the Icinga version, or am I mistaken? I regularly update the Icinga version itself.