事件ID 2013(磁盘处于或接近容量)未logging

我正在尝试为服务器上的磁盘空间不足情况设置警报(Windows Server 2008 R2 Enterprise,SP1)。 要做到这一点,我想通过任务计划程序触发一个电子邮件,只要在系统事件日志中logging事件ID 2013。

问题是,事件ID 2013似乎并没有发生。 LowDiskSpaceMinimum和DiskSpaceThresholdregistry项不存在,据我的理解,这意味着事件2013发生时,任何分区的磁盘空间下降到10%以下。

我试图在现在的三台服务器上,在系统驱动器(C :)或数据驱动器(E :)上触发此事件。

我有三个理论:

  • 2008 R2的默认阈值远远低于10%(但是由于在testing中我使这些驱动器有多满,它必须非常低)
  • 系统只会很less检查磁盘空间,而我只是不够长
  • 还有一件事是阻止这个事件被logging,我没有考虑

如果有人能给我任何build议,我将不胜感激。

我最终得到了这个工作。 我不得不专门添加LowDiskSpaceMinimum和DiskSpaceThresholdregistry项,然后开始工作。

我同意安装服务器监控软件可能是一个更好的办法,在很多情况下,如果我是一个系统pipe理员,那么我会做到这一点,并集中监控所有的服务器。 但是我关心的只是一个系统,所以这个方法对于我的需求来说足够好了(也就意味着我不需要等待系统pipe理员真的做些事情了!)

如果其他人想要设置类似的东西,那么这里是registry设置(DiskSpaceThreshold设置为10%):

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

这里是任务计划任务,可以保存为一个XML文件并导入。 只需更改[ServerName],[YourDomain],[YourUserName]和电子邮件地址:

 <?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>[email protected]</To> <From>[email protected]</From> <Body>Disk space is running low on server: [ServerName] - please investigate.</Body> <HeaderFields /> <Attachments /> </SendEmail> </Actions> </Task>