码迷,mamicode.com
首页 > 其他好文 > 详细

检查DHCP IP分配情况

时间:2018-07-12 16:38:08      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:for   邮件告警   dhcp   system   smtps   odi   发邮件   address   ipad   

检查DHCP IP分配情况,Scop IP分配超过80% 发邮件告警
$SMTPServer = "mail.domain.net"
$FromEmail = "dhcp@domain.net"
$ToEmail = "info@domain.net"

#IP分配大于80% 发邮件告警
$percentage = 80
#Send-MailMessage -From $FromEmail -To $ToEmail -subject $Subject -Body $body -SmtpServer $SMTPServer -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8)
$Statistics = Get-DhcpServerv4ScopeStatistics
if ( $? -eq $True )
{
foreach ($scop in $Statistics)
{
if ($scop.PercentageInUse -gt $percentage)
{
$subject = "DHCP " +($scop.ScopeId).IPAddressToString + " In Use: " + $scop.PercentageInUse
$body = " scop: " + ($scop.ScopeId).IPAddressToString
$body += " InUse: " + $scop.InUse
$body += " Free: " + $scop.Free
$body += " PercentageInUse: " + $scop.PercentageInUse
Send-MailMessage -From $FromEmail -To $ToEmail -subject $Subject -Body $body -SmtpServer $SMTPServer -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8)
}
}
}

检查DHCP IP分配情况

标签:for   邮件告警   dhcp   system   smtps   odi   发邮件   address   ipad   

原文地址:http://blog.51cto.com/13804335/2140897

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!