Page 1 of 1

Windows with Mounted Filesystems

Posted: Tue Oct 16, 2018 10:19 am
by nagiosEngie
Hello Nagios Crew,
I have a problem monitoring mounted filesystems on windows servers with ncpa agent.

Basicly I have some volumes (ie I:\ H:\ etc) on windows servers that have different volumes mounted under them.
I was unable to find any info on how to monitor utilization of these volumes.

Any suggestions?

Thanks
Sandro

Re: Windows with Mounted Filesystems

Posted: Tue Oct 16, 2018 10:57 am
by lmiltchev
What is the version of the NCPA agent that you are currently using?

Do you see a line that starts with:

Code: Select all

exclude_fs_types =
in the ncpa.cfg file?

Do you see any mounts when you access the API in the GUI?

Code: Select all

https://<ip address>:5693/api/disk/mount

Re: Windows with Mounted Filesystems

Posted: Tue Oct 23, 2018 3:21 am
by nagiosEngie
Hello lmiltchev,
the agent we are using is NCPA 2.1.3.

This is how the ncpa.cfg parameter is set:
#
exclude_fs_types = aufs,autofs,binfmt_misc,cifs,cgroup,configfs,debugfs,devpts,devtmpfs,encryptfs,efivarfs,fuse,hugetlbfs,mqueue,nfs,overlayfs,proc,pstore,rpc_pipefs,securityfs,selinuxfs,smb,sysfs,tmpfs,tracefs

API GUI OUTPUT (https://<ip address>:5693/api/disk/mount):
{
"mount": {
"X:|": {
"fstype": "",
"opts": "cdrom",
"device_name": [
"X:\\"
]
},
"A:|": {
"fstype": "",
"opts": "removable",
"device_name": [
"A:\\"
]
}
}
}

Thanks
Sandro

Re: Windows with Mounted Filesystems

Posted: Tue Oct 23, 2018 10:14 am
by lmiltchev
Mounts in Windows are "per user/per session", so they are not going to be visible to NCPA. Even if you configured the NCPA services to run as a specific user, and changed the uid and gid to this user (in the ncpa.cfg file), probably you would still not be able to view the mounts. Even if you did (while the user is logged in), you wouldn't be able to monitor the mounts if the user is logged out.

Note: I haven't tried running NCPA as a non-system user, and I don't know if this is going to create some other issues with using the agent. Maybe if you had a powershell script that provided you with the required into, you could call it via NCPA (or use some script that queries the Windows registry).

NCPA is not the only agent, that is having issues with monitoring mounts on Windows. Here's a quote te from the NSClient++ documentation:
Please note that UNC and network paths are only available in each session meaning a user mounted share will not be visible to NSClient++ (since services run in their own session). But as long as NSClient++ can access the share you can still check it as you specify the UNC path.

Re: Windows with Mounted Filesystems

Posted: Fri Oct 26, 2018 2:07 am
by nagiosEngie
Hi lmiltchev,
so from what I see there is no solution for this?

Sandro

Re: Windows with Mounted Filesystems

Posted: Fri Oct 26, 2018 9:23 am
by lmiltchev
There is no "out of the box" solution. Again, you could probably use a custom PS script/registry query, and call it via NCPA, but this is not something we could provide. We can keep the topic open for a while in case there are users, who have a solution for monitoring shared drives in Windows, that they would like to share.

Re: Windows with Mounted Filesystems

Posted: Fri Nov 30, 2018 3:39 am
by nagiosEngie
So I worked on this and found a way to do it.
NCPA agent has the capability to launch commands from the host it is installed on. You place the script in the agent's plugin directory (C:\Programfiles (x86)\nagios\ncpa\plugins).

Next Create a check like this:
/usr/local/nagios/libexec/check_ncpa.py -H <HOSTNAME> -T 120 -t '<PASS>' -P 5693 -M 'plugins/check_storage_pool.ps1'

check_storage_pool.ps1 is the name of your script you copied to the plugin directory. They must be the same.

Attached you can find the script (rename to check_storage_pool.ps1).
Ciao
Sandro

Re: Windows with Mounted Filesystems

Posted: Fri Nov 30, 2018 9:47 am
by lmiltchev
Thanks for sharing, Sandro! I am closing this topic.