Link to home
Start Free TrialLog in
Avatar of bominthu
bominthuFlag for Myanmar

asked on

Can't find Logical disk performance counter in Windows server 2003 (exchange 2003)

Hi Expert,

I have windows server 2003 standard R2 installed with Exchange server 2003.
I'm trying to monitor Logical disk free space using windows Performance monitoring as mentioned in this lin khttp://jamesrossiter.wordpress.com/2011/02/23/send-email-alerts-for-low-disk-space-using-perfmon-exe-in-windows-using-bmail-exe/ but I can't find Logical disk counter in there.
I've tried finding using microsoft tool , exctrlst.exe but it is not listed there.
http://networkadminkb.com/KB/a56/how-to-enable-or-disable-performance-counters.aspx

Tried manually rebuilding http://support.microsoft.com/?kbid=300956 but still cannot see logical disk counter.

Is that because i need restart server? Since it is mail server i can't restart server,
can i restart service? which service I can restart ?
What step I miss in it ? Appreciate ur help as I find monitoring using Logical drive counter is simple and easy.

If above all fail, is there any free open source tool which is non Nagio as I find Nagio installation so many steps involved.

Is there any script availabel which can check free space and send out alert email if free space is less than xxx Mbytes ?

Thanks in advance.
Avatar of UnConn
UnConn

You could try this:

http://www.simple-talk.com/sysadmin/powershell/disk-space-monitoring-and-early-warning-with-powershell/

Or a try something like this script I wrote as an example.  You can schedule to run nightly:

Get-WMIObject  -ComputerName SERVERNAME Win32_LogicalDisk | where {$_.deviceid -ilike "*C*"} | foreach {
	if ($_.freespace -lt 9999999999999) {
		$space = $_.freespace
		write-host "Low on space, sending email"
		$emailFrom = "someone@domain.com"
		$emailTo = "You@domain.com"
		$subject = "Low Space on SERVERNAME"
		$body = "Space on C: is $space"
		$smtpServer = "yourSMTPservername"
		$smtp = new-object Net.Mail.SmtpClient($smtpServer)
		$smtp.UseDefaultCredentials = $true
		$smtp.Send($emailFrom, $emailTo, $subject, $body)
	} else {
		write-host "All ok."
	} 
		Write-host "Freespace: $space"
}

Open in new window

Avatar of bominthu

ASKER

Hi UnConn,

Thanks for your reply. Could you let me what is the content "if ($_.freespace -lt 9999999999999) {
            $space = $_.freespace" referring to ?

I'm sorry that I'm not good in script.

Anyway what I'm trying to configure is to receive email alert as soon as drive D: Free space becomes less than 2048MB. And I'll set that schedule to run every 3 hours by setting task schedule.

If the drive free space is not less than 2048MB, I don't want to receive email alert.

Could you please amend the script ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of UnConn
UnConn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Get-WMIObject Win32_LogicalDisk | where {$_.deviceid -ilike "*C*"} | foreach {
      if ($_.freespace -lt 2048MB) {
            $space = $_.freespace
            write-host "Low on space, sending email"
            $emailFrom = "email@mydomain.com"
            $emailTo = "email@mydomain.com"
            $subject = "Low Space on MYSERVER"
            $body = "Space on C: is $space"
            $smtpServer = "mail.mydomain.com"
            $smtp = new-object Net.Mail.SmtpClient($smtpServer)
            $smtp.UseDefaultCredentials = $true
            $smtp.Send($emailFrom, $emailTo, $subject, $body)
      } else {
            write-host "All ok."
      }
            Write-host "Freespace: $space"
}
   


Hi Unconn,

I saved above as checkHDD.vbs and test. I don't receive any email even though my C: drive is less than 2GB.
Could you please advise what I miss above
Thanks
I have my own email server hosted actually.
I don't receive any email even if I allow relay.

Thanks
Hi Experts,

Anyne help me write a working Vbs script which can check free space of Logical drive and send email alert if free space is less than 1GB ?

I'll set that as task schedule to run every one hour and if free disk space is less than 1024MB, I would like to receive email alert.

Thanks a lot