Monitor Windows disk space usage on a drive without letter

Written by - 0 comments

Published on - Listed in Windows Monitoring Icinga Nagios


Monitoring a drive on Windows is pretty easy, as a drive usually has a drive-letter assigned (for example C:).
Here I'm using NSClient++ running as agent on the Windows host while on the monitoring server I use check_nt to query the agent:

nagios@monitoring:~# /usr/lib/nagios/plugins/check_nt -H sqldevserver -p 1248 -v USEDDISKSPACE -l "D" -w 100G -c 99
D:\ - total: 99.87 Gb - used: 10.93 Gb (11%) - free 88.94 Gb (89%) | 'D:\ Used Space'=10.93Gb;99.87;98.87;0.00;99.87

But what about drives that appear in the disk management but are not assigned with a drive letter but are rather mounted as a folder?
In this example we have the classical C: drive for the Windows OS and an additional D: as data partition. But as you can see in the Disk Management UI, Disk 2 (named SQL_Data_DEV001) and Disk 3 (named SQL_Log_DEV001) have no drive letter assigned.

 Windows Disk Management Drives without letter

Instead they're mounted as a subfolder inside D:
- Drive 2 is mounted on D:\SQL_Data
- Drive 3 is mounted on D:\SQL_Log

Windows drives mounted as subfolder 

Unfortunately when using NSClient, check_nt and the USEDDISKSPACE variable, this won't work out because a drive letter is a must. From the check_nt manpage:

 USEDDISKSPACE =
  Size and percentage of disk use.
  Request a -l parameter containing the drive letter only.

But NSClient++ also speaks NRPE and its internal checks are even newer. To check a drive with NSClient as agent and check_nrpe from the monitoring server:

nagios@monitoring:~# /usr/lib/nagios/plugins/check_nrpe -H sqldevserver -c check_drivesize -a "drive=D:"
OK All 1 drive(s) are ok|'D: used'=10.94061GB;79.89838;89.88568;0;99.87298 'D: used %'=10%;79;89;0;100

And here comes the good news: The NRPE command check_drivesize (internally configured within the NSClient agent, no need to define this command somewhere) also allows mounted volumes. From the NSClient++ documentation:

To check the size of a mounted volume (c:\volume_test)[...]

According to the documentation, only the mount-path is needed. Let's try that:

nagios@monitoring:~# /usr/lib/nagios/plugins/check_nrpe -H sqldevserver -c check_drivesize -a "drive=D:\SQL_Data"
OK All 1 drive(s) are ok|'D:\SQL_Data used'=302.15924GB;319.8976;359.8848;0;399.872 'D:\SQL_Data used %'=75%;79;89;0;100

Indeed, the returned values are different than from the D: drive!
And this is how you can monitor Windows drives/partitions without a drive-letter.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences