Windows system, if the disk appears in the software full, then how to achieve the disk fulfilment of automatic mail alarm? So that we can understand the disk full situation! Now let's go and have a look!
This problem is divided into two steps, one is how to monitor disk capacity, and the other is how to automatically email the alarm.
There are two solutions to the first problem, one is to write a bat script using the WMIC command at the command line, and the other is to take advantage of Windows ' own performance monitoring. The first method is troublesome, and the second method is used here.
In this way, the overall detailed steps are as follows:
The first step is to enable the performance feature
In the server, click "Start → run", enter "perfmon.msc" command in the "Run" dialog box, and return to the "Performance" Management Main window. then expand the Performance Logs and Alerts → alerts option, and then you can use the new alert settings to monitor the amount of server space remaining, alerting the administrator when the server's remaining space is below a number, prompting for insufficient space warning messages.
Step Two new warning settings
Next, create a new alert setting to monitor the amount of disk space remaining.
In the Performance Management Main window, right-click the Alerts option, select the New Alert Settings option in the pop-up menu, pop-up the New Alert Settings dialog box, name the alert in the Name column, such as "Diskfree", and then click OK to enter the Alert Parameters Settings dialog box.
Step three alert parameter settings
1. Add Counters
In the Alert Parameter Settings dialog box, click the Add button, pop the Add Counter dialog box, and then select the LogicalDisk option in the Performance object Drop-down list box.
Select the Counter from list option below, and then select "%free Space" in the list box, check the letter you want to monitor, such as "C:", and then click the "Add" button. (Note, monitor multiple disks to add alerts separately; Monitor entire disk capacity to select "_total")
2. Warning parameters and sampling interval
Then go back to the Alert Parameters Settings dialog box, and then set the trigger warning parameters and the data sampling interval parameters. This is set to give the administrator an alert when the remaining disk space is below 15%. In the will trigger an alert, if the value is a drop-down box, select the below option, and in the Limit column, enter 15. Then set the data sampling interval value, this interval does not set too short, such as set to "5 minutes", in the "Interval" column, enter "5", "Unit" column, select "Minutes."
3. Specify alert actions
Finally, switch to the Actions tab, select the "Execute this Program" option in the box body when the alert is triggered, click Browse, and select Mail Warning. bat.
Attached is an example of "mail warning. bat":
[HTML]
@echo off
The echo disk is full, please clean the!!! in time The server address is: > C:mail_body.txt
ipconfig | Find "IP address" >> c:mail_body.txt
,:::::::::: £ º:: Parameters::
Set from=test@qq.com
Set User=test
Set pass=11111
Set to=alarm@qq.com
Set subj= "Disk full alarm!"
Set Mail=c:mail_body.txt
Set server=smtp.qq.com
Set Debug=-debug-log C:blat.log-timestamp
::::::::-::::--£ blat::-----
Blat%mail%-to%to%-base64-charset gb2312-subject%subj%-server%server%-F%from%-u%user%-pw%pass%%debug%
Email Alert screenshot: