标签:event 目标 eve microsoft exe -o 平均值 ted add
目标: 统计特定周期内邮件的收发数量。解决思路:
将每台服务器每天收发邮件的数量,推送到zabbix进行监控。每天推送一次,zabbix中绘图,通过图中的平均值*周期即可得出特定周期内邮件总量。
解决方案:
1.使用powershell获取每台服务器每天的收发量,并zabbix_sender 到zabbix server
2.创建定时任务定时执行脚本
解决过程:
脚本如下:
Add-PSSnapin microsoft.exchange*
$Server="MBX1.liuxing.com","MBX2.liuxing.com","MBX03.liuxing.com","MBX4.liuxing.com","MBX5.liuxing.com"
$today=get-date
$ago=$today.AddDays(-1)
$from=$ago.ToString("MM/dd/yyyy")
$timeF="$from 00:00:00"
$timeE="$from 23:59:59"
$SCount=$RCount=$DSNCount=0
foreach($i in $Server)
{
$temp=Get-MessageTrackingLog -Server "$i" -Start "$timeF" -End "$timeE" -ResultSize unlimited
foreach($j in $temp){
if($j.EventId -eq "RECEIVE" -and $j.Source -eq "STOREDRIVER"){
$SCount++
}
if($j.EventId -eq "DELIVER"){
$RCount++
}
if($j.EventId -eq "DSN"){
$DSNCount++
}
}
C:\zabbix\bin\zabbix_sender.exe -z zabbix.liuxing.com -s $i -k sendcount -o $SCount
C:\zabbix\bin\zabbix_sender.exe -z zabbix.liuxing.com -s $i -k receivecount -o $RCount
C:\zabbix\bin\zabbix_sender.exe -z zabbix.liuxing.com -s $i -k dsncount -o $DSNCount
}
定时任务:
Zabbix效果图:
因为
标签:event 目标 eve microsoft exe -o 平均值 ted add
原文地址:https://blog.51cto.com/magic3/2458421