======= 系列目录 =======
Zabbix监控系统系列之一 : Server部署
Zabbix监控系统系列之二 : 初始化配置
Zabbix监控系统系列之三 :版本升级
Zabbix监控系统系列之四:Agent监控Windows客户端
Zabbix监控系统系列之五:SNMP监控Windows客户端
Zabbix监控系统系列之六:EMAIL警告配置
Zabbix监控系统系列之七:VMware虚拟化监控
Zabbix监控系统系列之八:日志监控
Zabbix监控系统系列之九:监控网络设备指定接口流量
Zabbix监控系统系列之十:自动发现配置
Zabbix监控系统系列之十一:拓扑图绘制
Zabbix监控系统系列之十二:SNMP Traps主动告警
Zabbix监控系统系列之十三:SNMP Mibs库加载
Zabbix监控系统系列之十四:Oracle监控
Zabbix监控系统系列之十五:自动发现Oracle表空间并监控
======================
[Zabbix SNMP介绍]
如果服务器无法安装第三方软件(如存储设备、网络设备、其他供应商维护系统),那么可以考虑Zabbix SNMP监控方式,他可以收集一些必要的设备信息,如存活、性能、网络等。
[SNMP配置]
InstallSNMP.ps1 脚本参考:
适用范围:Windows 2008, 2008 R2, 2012, 2012 R2, 2016
####################################
# Last update: 20190813
# Description: Powershell script to install and configure SNMP Services on Windows 2008R2, 2012, 2012R2 and 2016 Server (SNMP Service, SNMP WMI Provider)
# start As Administrator with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -Command "&{ \\Servername\InstallSNMP\installsnmp.ps1}"
# Script Location: \\Servername\InstallSNMP\installsnmp.ps1
####################################
#Variables :)
$PManagers = @("192.168.0.99") # ADD YOUR MANAGER(s) in format @("manager1","manager2")
$CommString = @("zhong") # ADD YOUR COMM STRING(s) in format @("Community1","Community2")
#Import ServerManger Module
Import-Module ServerManager
#Check if SNMP-Service is already installed
$check = Get-WindowsFeature -Name SNMP-Service
If ($check.Installed -ne "True")
{
#Install/Enable SNMP-Service
Write-Host "SNMP Service Installing..."
# Get OS Version to use the right install command
[int]$verMajor = [environment]::OSVersion.Version | ft -property Major -HideTableHeaders -auto | Out-String
[int]$verMinor = [environment]::OSVersion.Version | ft -property Minor -HideTableHeaders -auto | Out-String
if ($verMajor -eq 6)
{
$winVer = switch ($verMinor)
{
0 {"Win2008"}
1 {"Win2008R2"}
2 {"Win2012"}
3 {"Win2012R2"}
}
}
if ($verMajor -eq 10)
{
$winVer = switch ($verMinor)
{
0 {"Win2016"}
}
}
#Install SNMP on 2008 (R2)
if ($winVer -eq "Win2008" -or $winVer -eq "Win2008R2")
{
Get-WindowsFeature -name SNMP* | Add-WindowsFeature | Out-Null
}
#Install SNMP on 20012 (R2)
if ($winVer -eq "Win2012" -or $winVer -eq "Win2012R2" -or $winVer -eq "Win2016")
{
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}
}
$check = Get-WindowsFeature -Name SNMP-Service
##Verify Windows Services Are Enabled
If ($check.Installed -eq "True")
{
Write-Host "Configuring SNMP Services..."
#Set SNMP Permitted Manager(s) ** WARNING : This will over write current settings **
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null
#Set SNMP Traps and SNMP Community String(s) - *Read Only*
Foreach ($String in $CommString)
{
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
# Set the Default value to be null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2
Foreach ($Manager in $PManagers)
{
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}
Else
{
Write-Host "Error: SNMP Services Not Installed"
}
执行上述Powershell实施SNMP服务部署与配置,重启服务器才可以让SNMP Service完全生效。
检查SNMP Service服务状态。
[Zabbix配置]
Zabbix Server新建监控主机
导航路径:配置 > 主机 > 创建主机
主机配置 关键参数:
主机名称 > 此参数与监控主机主机名称一致;
代理地址 > 此参数与监控主机网络地址一致;
模板设置 [Template OS Windows SNMPv2]
检查确认新增监控状态
※ 如果失败,请检查[管理 > 一般 >宏]是否正常设置默认团体名。
导航路径:监控中 > 最新数据 > 主机过滤 [ZServer02]
======= 系列目录 =======
Zabbix监控系统系列之一 : Server部署
Zabbix监控系统系列之二 : 初始化配置
Zabbix监控系统系列之三 :版本升级
Zabbix监控系统系列之四:Agent监控Windows客户端
Zabbix监控系统系列之五:SNMP监控Windows客户端
Zabbix监控系统系列之六:EMAIL警告配置
Zabbix监控系统系列之七:VMware虚拟化监控
Zabbix监控系统系列之八:日志监控
Zabbix监控系统系列之九:监控网络设备指定接口流量
Zabbix监控系统系列之十:自动发现配置
Zabbix监控系统系列之十一:拓扑图绘制
Zabbix监控系统系列之十二:SNMP Traps主动告警
Zabbix监控系统系列之十三:SNMP Mibs库加载
Zabbix监控系统系列之十四:Oracle监控
Zabbix监控系统系列之十五:自动发现Oracle表空间并监控
======================
[Zabbix SNMP介绍]
如果服务器无法安装第三方软件(如存储设备、网络设备、其他供应商维护系统),那么可以考虑Zabbix SNMP监控方式,他可以收集一些必要的设备信息,如存活、性能、网络等。
[SNMP配置]
InstallSNMP.ps1 脚本参考:
适用范围:Windows 2008, 2008 R2, 2012, 2012 R2, 2016
####################################
# Last update: 20190813
# Description: Powershell script to install and configure SNMP Services on Windows 2008R2, 2012, 2012R2 and 2016 Server (SNMP Service, SNMP WMI Provider)
# start As Administrator with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -Command "&{ \\Servername\InstallSNMP\installsnmp.ps1}"
# Script Location: \\Servername\InstallSNMP\installsnmp.ps1
####################################
#Variables :)
$PManagers = @("192.168.0.99") # ADD YOUR MANAGER(s) in format @("manager1","manager2")
$CommString = @("zhong") # ADD YOUR COMM STRING(s) in format @("Community1","Community2")
#Import ServerManger Module
Import-Module ServerManager
#Check if SNMP-Service is already installed
$check = Get-WindowsFeature -Name SNMP-Service
If ($check.Installed -ne "True")
{
#Install/Enable SNMP-Service
Write-Host "SNMP Service Installing..."
# Get OS Version to use the right install command
[int]$verMajor = [environment]::OSVersion.Version | ft -property Major -HideTableHeaders -auto | Out-String
[int]$verMinor = [environment]::OSVersion.Version | ft -property Minor -HideTableHeaders -auto | Out-String
if ($verMajor -eq 6)
{
$winVer = switch ($verMinor)
{
0 {"Win2008"}
1 {"Win2008R2"}
2 {"Win2012"}
3 {"Win2012R2"}
}
}
if ($verMajor -eq 10)
{
$winVer = switch ($verMinor)
{
0 {"Win2016"}
}
}
#Install SNMP on 2008 (R2)
if ($winVer -eq "Win2008" -or $winVer -eq "Win2008R2")
{
Get-WindowsFeature -name SNMP* | Add-WindowsFeature | Out-Null
}
#Install SNMP on 20012 (R2)
if ($winVer -eq "Win2012" -or $winVer -eq "Win2012R2" -or $winVer -eq "Win2016")
{
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}
}
$check = Get-WindowsFeature -Name SNMP-Service
##Verify Windows Services Are Enabled
If ($check.Installed -eq "True")
{
Write-Host "Configuring SNMP Services..."
#Set SNMP Permitted Manager(s) ** WARNING : This will over write current settings **
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null
#Set SNMP Traps and SNMP Community String(s) - *Read Only*
Foreach ($String in $CommString)
{
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
# Set the Default value to be null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2
Foreach ($Manager in $PManagers)
{
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}
Else
{
Write-Host "Error: SNMP Services Not Installed"
}
执行上述Powershell实施SNMP服务部署与配置,重启服务器才可以让SNMP Service完全生效。
检查SNMP Service服务状态。
[Zabbix配置]
Zabbix Server新建监控主机
导航路径:配置 > 主机 > 创建主机
主机配置 关键参数:
主机名称 > 此参数与监控主机主机名称一致;
代理地址 > 此参数与监控主机网络地址一致;
模板设置 [Template OS Windows SNMPv2]
检查确认新增监控状态
※ 如果失败,请检查[管理 > 一般 >宏]是否正常设置默认团体名。
导航路径:监控中 > 最新数据 > 主机过滤 [ZServer02]