Exchange 性能计数器介绍详见 https://docs.microsoft.com/en-us/exchange/exchange-2013-performance-counters-exchange-2013-help。

实现方式:使用userparameter 参数通过powershell脚本将数据库推送至zabbix server,自动创建监控项。

  1. zabbix agent配置userprarmeter参数,指向运行的脚本。
PS C:\Users\administrator> type C:\zabbix\zabbix_agentd.d\UserParameter.conf
UserParameter=db.counter,c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file c:\zabbix\scripts\perf-db.ps1

脚本内容:

Add-PSSnapin Microsoft.Exchange*

$DBs=Get-MailboxDatabase | % {$_.Name}
$VAR1="{"
$VAR2='"data": ['
$VAR3='"{#DB_NAME}":'
$VAR4="]"
$VAR5="}"
$VAR6="},"

Write-Output $VAR1
Write-Output "   $VAR2"

ForEach($i in $DBs)
{
Write-Output "      $VAR1"
Write-Output "         $VAR3 `"$i`""
    if ($i -eq $DBs[-1])
    {         
        Write-Output "      $VAR5"

    }
    else
      {         
        Write-Output "      $VAR6"

    }

}

Write-Output "   $VAR4"
Write-Output $VAR5

脚本的输出结果需要满足格式要求:
Exchange数据库性能监控_第1张图片

脚本执行结果(只展示一部分):

{
   "data": [
      {
         "{#DB_NAME}": "Staff03"
      },
      {
         "{#DB_NAME}": "Staff02"
      },
      {
         "{#DB_NAME}": "Manager"
      },
      {
         "{#DB_NAME}": "Staff01"
      },
      {
         "{#DB_NAME}": "Staff04"
      },
      {
         "{#DB_NAME}": "Staff05"
      },
      {
         "{#DB_NAME}": "Staff06"
      },
      {
         "{#DB_NAME}": "Staff07"
      },
      {
         "{#DB_NAME}": "NBU-Test"
      }
   ]
}

目的是:通过zabbix discover 自动创建对应的数据库item.

  1. Zabbix web端创建模板,并创建discover 规则。

LLD 详见: https://www.zabbix.com/documentation/4.2/manual/discovery/low_level_discovery

Exchange数据库性能监控_第2张图片

  1. 创建数据库性能对应的key,通过宏调用db.

zabbix性能监介绍详见: https://www.zabbix.com/documentation/current/manual/config/items/perfcounters

Exchange数据库性能监控_第3张图片

Exchange数据库性能监控_第4张图片

  1. 创建graph

Exchange数据库性能监控_第5张图片

将主机关联到该模板即可。

看一下效果:

Exchange数据库性能监控_第6张图片