Windows Endpoint + Icinga2 Agent + CheckCommand "disk-windows" and mounted directories

Hello,

I’m trying to geht Icinga2 working for monitoring my “Windows 10” System.
On this windows system I have disk C: and a disk Z: which is mounted directory hosted on the NAS.
This directory has been mounted via “Windows Explorer”, via “New-SmbMapping” and via “New-PSDrive”. I tried this 3 ways to connect the shared directory to the System but I have problems with the “disk-windows” check. It can never check disk Z:, disk C: everything is ok.

Now I tried to analyse what is going on. I tried to execute the check_disk.exe which is used für the CheckCommand “disk-Windows”.
If I am connected with a normal user account to the windows system via RDP the check_disk shows me all connected drives:

C:\Program Files\ICINGA2\sbin>check_disk.exe
DISK OK - free space:C:\ 63168409600 B (50%); Z:\ 502717411328 B (51%); | ‘C:’=63168409600B;;;0;126591598592 ‘Z:’=502717411328B;;;0;976214888448

If I start check_disk.exe in a CMD which is running under “LOCAL SYSTEM” (the same Rights as the agent), I geht the following output:

C:\Program Files\ICINGA2\sbin>check_disk.exe
DISK OK - free space:C:\ 64396439552 B (51%); | ‘C:’=64396439552B;;;0;126591598592

If I run a CMD under “” I get the same output - no Z:

I start the CMDs for testing with “PSTools”:

psexec -i -s cmd.exe
psexec -i -u “” cmd.exe

The check_disk.exe Shows all drives including Z: only in my interactive cmd session.
Does anybody of you has any idea what is going on or what do I have to to to get the “check_disk.exe” working with the agent and drive Z:?

regards,
Jens

This is the default behavior of Windows. Means LocalSystem has no mounted drives and is even not allowed to do so.

Two options for checking mounted drives:

  1. Create a dedicated service user which has grants as your NAS and run Icinga Agent with this user.

  2. Clarify if a plugin for your NAS device type is already available or use e.g. check_by_ssh or SNMP

1 Like

Thank you, Roland.
I will try to experiment with a technical user for the agent. I hope it will work.

But I also tried to give the agent my administrator user and the agents behaviour was the same - he could not see any mounted drives.
But if I am connected with a session and this administrative user, I can see this mounted drives. Is there a difference between running a service with a specific user or being connected with an active session with this user?
I hope you have further suggestions why the usage of the same user could result in different behaviour.

Regards,
Jens

Try to use UNC path instead (mounted drives might work if you connect them with the option reconnect at sign-in). And remember the user that is running the agent needs grants at your NAS.

1 Like

What do you mean by grant access on the NAS? It is a QNAP NAS. I set the folder to access for user group everybody and read/write permissions. Do I have to create a user with the same name at the NAS and put it into the user group which has full access to the directory?

Do you know which plug-in I can user for check the UNC path? I didn’t recognize a plug-in on the Windows agent yet.

Regards,
Jens

If you grant access for everyone already, then it should be fine. Simply login as this user and see if it works.

However, I’d recommend try any of these plugins first.

Hi Roland,

I “solved” my issue by using performance counters for recognizing if the mounted drive is reachable:

apply Service “Drive Z: - Avg. Second Per Data Request” {
check_command = “nscp-local-counter”
check_interval = 1m
command_endpoint = host.vars.client_endpoint
vars.nscp_counter_name = “\SMB Client Shares(\IP\NAME)\Avg. sec/Data Request”
vars.nscp_counter_perfsyntax = “Datendurchsatz NAS NAME”
vars.nscp_counter_warning = 1000
vars.nscp_counter_critical = 5000
vars.nscp_counter_showall = true
assign where match(“itunesserver*”, host.vars.client_endpoint)
}

This is not what I really tried to do but is a workaroung for the moment.
I will take a look at the plugins you send for monitoring NAS directly.
Thank you very much!