Monitoring Disk Space Whitout SCOM

Standard

In this blog post I’m going to explain how to monitor your disk-space and getting an email notification when the disk space is below a certain value. I know that you can use System Center Operations Manager for these kind of tasks but it is a expensive tool for small Businesses and you need quid a lot of knowledge to get it working properly. We need the following tools:

  • WevUtil
  • Windows Performance Monitor
  • Event Viewer
  • Task Scheduler

Wevutil Script

  1. Create a batch file with the following lines:
    • del /q /f c:\event2031.txt
    • wevtutil.exe qe Microsoft-Windows-Diagnosis-PLA/Operational "/Q:*[System [(EventID=2031)]]" /f:text /rd:true /c:1 > C:\event2031.txt
    • You script should look something like this:

      event2013

    Configuring the Windows Performance Monitor

    1. Start the Performance Monitor
    2. Navigate to "Data Collector Sets" and right click "User Defined"

      UserDefined

    3. Click "New", "Data Collector Set"

      NewDataCollectorSet

    4. On the "Create new Data Collector Set" page, name the set "Free Disk Space Available" and select "Create Manually (Advanced)". CLick "Next"
    5. Select "Performance Counter Alert" and click "Next"
    6. Click "Add"
    7. In the "Available counters section, select "LogicalDisk" and then select "Free Megabytes". In the "Instances of the selected Object’s" section, select the drive you wish to monitor and click "Add". Click "OK"

      AvailebleCounters

    8. On the "Create new Data Collector Set" page, select alert when "below" limit "5000" and click "Next" (In my example I will use 80000 for the alerting check)

      AlertWhenLimit

    9. select "Save and Close" and click "Finish"
    10. Navigate to "Data Collector Sets – User Defined – Free Disk Space Available" and select "DataConnector01"right click "properties"

      PerfmonProperties

    11. On the "DataCollector01 Properties" page, select the tab "Alert Action"
    12. On the "Alert Action tab, check "Log an entry in the application event Log". On the "Start data collector set section, select "Free Disk Space Available"

      AlertAction

    13. Click "Apply" and "Ok
    14. Navigate to "Data Collector Sets – User Defined " and right click "Free Disk Space Available" and click "Start"

      StartDataCollector

    (Optional)Adding multiple dataConnectors to the Data Collector Set:

    1. Navigate to "Data Collector Sets – User Defined " and right click "Free Disk Space Available " and click "Stop"

      StopDataCollectorSet

    2. On the "Action" page, richt click and select "New" and click "Data Collector"

      NewDataCollector

    3. On the "Create New Data Collector" page, name the data collector "DataCollector02" and select "Performance counter Alert" and click "Next"
    4. Click "Add"
    5. In the "Available counters section, select "LogicalDisk" and then select "Free Megabytes". In the "Instances of the selected Object’s" section, select the drive you wish to monitor and click "Add". Click "OK"
    6. On the "Create new Data Collector Set" page, select alert when "below" limit "5000" and click "Next"
    7. Click "Finish"
    8. Navigate to "Data Collector Sets – User Defined – Free Disk Space Available" and select "DataConnector02"right click "properties"
    9. On the "DataCollector01 Properties" page, select the tab "Alert Action"
    10. On the "Alert Action tab, check "Log an entry in the application event Log". On the "Start data collector set section, select "Free Disk Space Available"
    11. Navigate to "Data Collector Sets – User Defined " and right click "Free Disk Space Available" and click "Start"

    Check and configure the Event Viewer

    1. Start the Event Viewer
    2. Navigate to "Applications and Services Logs – Microsoft – Windows – Diagnosis-PLA – Operational and you can see that event "2031" is logged. For demonstration purpuses I changed the percentage to 50.

      EventID2031

    3. Right click on the event and click "Attach Task to this Event"

      AttachTaskToThisEvent

    4. On the "Create A Basic Task section, name the task "Free Disk Space Email Alert" and click "Next"
    5. On the "When an Event is Logged section, click "Next"
    6. On the "Action section, select "Send an E-mail and click "Next"
    7. On the "Send an Email section, fill in the following:
      • Form "Alert@domain.com"
      • To "name@domain.com"
      • Subject "Available Disk Space low"
      • Text "The description you want to put here"
      • Attachment "event2031.txt"
      • SMTP Server "smtp.domain.com"
      • You script should look something like this:

        SendAnEmail

    8. Click "Finish"
    9. Open the "Task Schedular" page, select "Event Viewer Tasks" an right click the created task and select "Properties"

      PropertiesEmailTask

    10. Select "Actions" tab and click "New"
    11. Click "Browse" and select the script that you created. Click "OK"

      NewAction 

    12. Move the "Start a Program" to the top of the list and click "OK"
    13. When the Configuration is finished. You should get an e-mail looking like this:

      email

    Configure the Scheduled task to run on Startup

    1. Open the "Task Schedular" page, select "Event Viewer Tasks" an right click the created task and select "Properties"
    2. Select "Triggers" tab and click "New"
    3. On the "New Trigger" tab, on the "Begin the task" option, select "At Startup" and make sure the task is "Enabled"

      NewTrigger

    4. Click "OK" and click "OK"

    Hopefully the above steps will help you to configure disk space alert notifications. If you have a question feel free to contact me