A
A
alex_dredd2011-12-02 12:11:18
Hard disks
alex_dredd, 2011-12-02 12:11:18

Monitoring free disk space

Good afternoon!
There are several servers running Windows 2003. Each of them has several partitions for storing user data. It’s not very convenient to constantly go to the servers and look with your eyes. Therefore, we are looking for a software that is quite lightweight, which will monitor the free space on the disk and, upon reaching a certain threshold (which can be specified), send an e-mail to the specified address.
Thanks for the help.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
Dmitry Sidorov, 2011-12-02
@alex_dredd

I quickly threw it on PowerShell:

$MinimumSize = 10 * 1024 * 1024 * 1024
$InfoArr = Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" | Where { $_.FreeSpace -lt $MinimumSize }
ForEach ($Info in $InfoArr)
{
  Write-Host "sending mail"
  $mail = New-Object System.Net.Mail.MailMessage
  $mail.From = New-Object System.Net.Mail.MailAddress("[email protected]")
  $mail.To.Add("[email protected]")

  $mail.Subject = "Недостаточно свободного места.";
  $mail.Body = "На сервере server.net на диске " + $Info.DeviceID + " недостаточно свободного места. Осталось: " + "{0:N0}" -f ($Info.FreeSpace / 1024 / 1024) + "Мб"

  $smtp = New-Object System.Net.Mail.SmtpClient
  $smtp.host = "server.net"

  $Credentials = new-object System.Net.networkCredential
  $Credentials.domain = "net"
  $Credentials.UserName = "[email protected]"
  $Credentials.Password = "password"
  $smtp.Credentials = $Credentials

  $smtp.Send($mail)
}


Run on each server. Or change the second line like this:
$InfoArr = Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer (Get-Content servers.txt) | Where { $_.FreeSpace -lt $MinimumSize }

and create a server.txt file with a list of servers (IP addresses or domain names, one per line).

D
Denis, 2011-12-02
@uscr

This is not solved by the batch file in the scheduler?
I apologize if I'm talking nonsense: I have never managed to administer Windows, but in Linux I would have done just that.

P
Perkov, 2011-12-02
@Perkov

The key word is monitoring. Why not take and install some kind of monitor - starting with some kind of nagios or kakti , ending with SCOM, and have the full status of the systems, and not just single data?

M
Mikhail Lyalin, 2011-12-02
@mr_jok

www.opennet.ru/tips/info/1405.shtml
borisnote.wordpress.com/2009/02/06/test_free_disk/

A
alex_dredd, 2011-12-02
@alex_dredd

the first option is for Unix systems, which is not suitable.
The second is not a cake because of Net Send instead of mail.
But thanks anyway:)

P
prox, 2011-12-03
@prox

zabbix agent for windows

M
Mikhail Tchervonnko, 2021-03-12
@RusMikle

https://www.superbasis.de/ru/diskfree/
when the lower specified limit is reached, it will launch a batch file or another program and transfer (if necessary) to them the size of the remaining disk space. In the batch file, use blat to send a message to email.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question