Monitoring GB free on mapped Windows drive
Monitoring GB free on mapped Windows drive
I've searched the library and forum every way that I can think of and still can't find a clear answer for how to monitor the free space (in GB, not %) on a Windows server. The drive is a mapped drive, not a local drive. The file system is really on a NAS but it is managed by our outsource "partner" so there is no way to get access to install an agent, etc. If the check can be made by UNC instead of mapped drive, that would be awesome! I expect that the NAS needs authentication in order to know the quota. This is why the mapped drive from a Windows server has been the attack approach so far.
check_disk seems like the functionality that I need. The documentation doesn't clearly say it but it seems it is for UNIX file systems.
check_disk.vbs also looks useful but doesn't return the correct value for the mapped drive so maybe it is really only for local file systems.
Thank you
check_disk seems like the functionality that I need. The documentation doesn't clearly say it but it seems it is for UNIX file systems.
check_disk.vbs also looks useful but doesn't return the correct value for the mapped drive so maybe it is really only for local file systems.
Thank you
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Monitoring GB free on mapped Windows drive
This isn't really possible due to how Windows chooses to make all mapped drives user specific. Therefore service accounts and such do not have mapped drives and will not map them even if configured to do so. Likely you will have to use snmp or something similar against the nas device to test free drive space, or mount on a linux system(such as nagios) and check drive space there as those would be system wide. Also unfortunately, I do not know of a way to check via unc path directly, however it could be possible.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Monitoring GB free on mapped Windows drive
Yeah, you won't be able to use a service account like Spenser said since they can't see mapped drives(non local). There are a couple ways I can think of fixing it.
On the windows server, you could create a local account and make NSClient run as that local user instead of the system account or if you are using check_wmi in your environment, you should already be using an account other than the system and should have no issue. I'm going to guess you aren't using WMI.
So basically, just make the change I mentioned about NSClient and then depending on the plugin you are using for checking the drive, you should be easily able to make it show GB instead of % as most I have used have supported that. If you need me to recommend one, just let me know and I'll dig around.
On the windows server, you could create a local account and make NSClient run as that local user instead of the system account or if you are using check_wmi in your environment, you should already be using an account other than the system and should have no issue. I'm going to guess you aren't using WMI.
So basically, just make the change I mentioned about NSClient and then depending on the plugin you are using for checking the drive, you should be easily able to make it show GB instead of % as most I have used have supported that. If you need me to recommend one, just let me know and I'll dig around.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Monitoring GB free on mapped Windows drive
I was wondering how wmi might handle that... The only other thing to note, is if you alter the nsclient or ncpa logon account, make sure it has permissions to everything else it needs to check if this user is not an admin.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Monitoring GB free on mapped Windows drive
Seems like a nice tip bandit,
I wrote some Powershell script that compares free space on an unc path to a quota threshold, but the script sometimes runs a long time, which results in no perfdata, as I only run it once each day.. It runs now on a few shares, but takes +- 150 sec to run
The nsclient needs to run as a domain user wit permissions on the unc path.
So as I understand it right, I should let the nsclient run as some local user, map an UNC path, for example \\dfsroot\namespace\share to a drive letter for example T: and then use the usual checkdrivesize?
Grtz
I wrote some Powershell script that compares free space on an unc path to a quota threshold, but the script sometimes runs a long time, which results in no perfdata, as I only run it once each day.. It runs now on a few shares, but takes +- 150 sec to run
So as I understand it right, I should let the nsclient run as some local user, map an UNC path, for example \\dfsroot\namespace\share to a drive letter for example T: and then use the usual checkdrivesize?
Grtz
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Monitoring GB free on mapped Windows drive
I believe you can easily use NCPA for this purpose. You just need to change the units in the command (-u), for example:
Code: Select all
[root@testbox libexec]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -P 5693 -M 'disk/logical/C:|/free' -u B
OK: Free was 1.70535419904e+11Bb|'free_0'=1.70535419904e+11Bb
[root@testbox libexec]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -P 5693 -M 'disk/logical/C:|/free' -u G
OK: Free was 170.535Gb|'free_0'=170.535GbBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Monitoring GB free on mapped Windows drive
Thank you for the tip! I installed NCPA.lmiltchev wrote:I believe you can easily use NCPA for this purpose. You just need to change the units in the command (-u), for example:
Code: Select all
[root@testbox libexec]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -P 5693 -M 'disk/logical/C:|/free' -u B OK: Free was 1.70535419904e+11Bb|'free_0'=1.70535419904e+11Bb [root@testbox libexec]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'token' -P 5693 -M 'disk/logical/C:|/free' -u G OK: Free was 170.535Gb|'free_0'=170.535Gb
1- I query the D drive from the command line on the Nagios server (LINUX) and NCPA returns 24.049 GB free. Windows shows free size is 24,049,274,880 so NCPA is converting to GB using 10**9. Why doesn't it report 22.3 GB (1024^3) like the OS does? In this case the difference is almost 2GB, which can be significant!
2- NCPA doesn't seem to see the mapped drive (mentioned in the initial posting of this thread). I have it mapped with "reconnect at login" using a local admin account. NCPA services are running as the same local admin.
3- Where/how can I learn the strings to pass for -M? check_ncpa.py --help does not explain how to build the value for M. It refers to the plugins folder on the client, but it is empty on the Windows client.
Re: Monitoring GB free on mapped Windows drive
Thank you for the idea BanditBBS. I set this up with NSClient running under a local admin account. The query works if I use a local file system. NSClient still doesn't see the mapped drive. I have it mapped with "reconnect at login" using a local admin account that NSClient is running as.BanditBBS wrote:So basically, just make the change I mentioned about NSClient and then depending on the plugin you are using for checking the drive, you should be easily able to make it show GB instead of % as most I have used have supported that. If you need me to recommend one, just let me know and I'll dig around.
The part I'm still missing is how to get NSClient (NCPA or whatever mechanism) to see the mapped file system.
Thank you.
Re: Monitoring GB free on mapped Windows drive
The problem I just thought of...it won't be logged in, so the drive won't be mapped. You would have to use the UNC path, so would need a plugin that supports that.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Monitoring GB free on mapped Windows drive
Agreed, service accounts, don't technically login in a traditional windows sense, it just uses the account to set its permission and access levels. The only other thought I would have short of bandits suggestion of a tool that can access unc paths(powershell script?) would be to mount the unc path as a folder within windows. However that presents it's own set of issues in checking the space relative to folder path instead of drive total.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.