Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up alerts for low disk space conditions on a server (Windows Server 2008 R2 Enterprise, SP1). To do this I want to trigger an email via Task Scheduler whenever Event ID 2013 is logged in the System event log.

The problem is that Event ID 2013 doesn't seem to be occurring. The LowDiskSpaceMinimum and DiskSpaceThreshold registry keys are not present, which to my understanding should mean that Event 2013 occurs when the disk space of any partition drops below 10 percent.

I've tried to trigger this event on three servers now, on system drives (C:) or data drives (E:).

I have three theories:

  • The default threshold on 2008 R2 is much lower than 10% (but it must be VERY low given how full I'm making these drives in my tests)
  • The system only checks the disk space infrequently, and I'm just not waiting long enough
  • Something else is preventing this event from being logged that I haven't considered

If anybody can give me any suggestions I'd be grateful.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I eventually got this working. I had to specifically add the LowDiskSpaceMinimum and DiskSpaceThreshold registry keys and then it started to work.

I do agree that installing server monitoring software is probably a better way to go in a lot of cases, and if I was a sysadmin then I would do exactly that and centralise it to monitor all our servers. But my concern is only for one system so this approach works well enough for my needs (and means I don't need to wait for the sysadmins to actually do something!!)

If anybody else wants to set up something similar then here are the registry settings (DiskSpaceThreshold set to 10%):

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
"DiskSpaceThreshold"=dword:0000000a
"LowDiskSpaceMinimum"=dword:00000000

And here is the Task Scheduler job, which can be saved as an xml file and imported. Just change [ServerName], [YourDomain], [YourUserName] and the email addresses:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2013-02-05T14:37:17.165247</Date>
    <Author>[YourDomain]\[YourUserName]</Author>
    <Description>Send an emailed warning when a low disk space event is recorded.</Description>
  </RegistrationInfo>
  <Triggers>
    <EventTrigger>
      <Enabled>true</Enabled>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="System"&gt;&lt;Select Path="System"&gt;*[System[Provider[@Name='srv'] and EventID=2013]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    </EventTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-20</UserId>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <SendEmail>
      <Server>smtpServer.YourCompany.co.uk</Server>
      <Subject>Low disk space warning on server: [ServerName]</Subject>
      <To>Admin@YourCompany.co.uk</To>
      <From>noreply@YourCompany.co.uk</From>
      <Body>Disk space is running low on server: [ServerName] - please investigate.</Body>
      <HeaderFields />
      <Attachments />
    </SendEmail>
  </Actions>
</Task>
share|improve this answer
    
The Registry entries you provided there are not valid. a = 10 ?? –  tntu Nov 28 '13 at 16:55
    
That's how it appears when it's exported out of regedit. I've imported those settings onto several systems and received the alert emails that prove that it works. At a guess 0000000a is hex code for 10, but it really is a guess and I'm not inclined to try to decipher it as it's of no interest to me what encoding is used. –  paulH Nov 28 '13 at 17:06
    
My export: dword:00000030 and dword:00010240. I do not belive the data is exported as HEX. –  tntu Nov 28 '13 at 17:10
    
If it really won't work on your system (or you're too uncertain to try) then you could always add the registry settings manually (and then export them if you want to distribute it easily among several systems). I suppose it's always possible that regedit works differently on different versions of Windows. It is Microsoft after all! –  paulH Nov 28 '13 at 17:11
    
I have added them manually and then exported them for distribution. Only now I have noticed your answer here and decided to note the error in your entries. I have tried importing yours to and I ended up with and a and a 0. –  tntu Nov 28 '13 at 17:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.