共计 6014 个字符,预计需要花费 16 分钟才能阅读完成。
之前给大家介绍了如何在 CentOS 与 Ubuntu 系统下安装 OMSA 硬件监控(地址是 http://www.linuxidc.com/Linux/2015-05/117339.htm),但 Windows 下安装 OMSA 没有介绍,很多朋友咨询如何在 Windows 里安装 OMSA,并使用 Zabbix 进行硬件监控,现在我在给大家介绍一下。
1、Windows 系统安装 OMSA
可以参考 这里。
2、在客户端的 zabbix_agentd.conf 里配置
UserParameter=hardware_battery,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_battery
UserParameter=hardware_cpu_model,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_cpu_model
UserParameter=hardware_fan_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_fan_health
UserParameter=hardware_memory_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_memory_health
UserParameter=hardware_nic_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_nic_health
UserParameter=hardware_cpu,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_cpu
UserParameter=hardware_power_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_power_health
UserParameter=hardware_temp,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_temp
UserParameter=hardware_physics_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_physics_health
UserParameter=hardware_virtual_health,c:\zabbix\bin\zabbix_monitor_hardware.bat hardware_virtual_health
3、在 c:\zabbix\bin\ 里添加一个脚本,名字为 zabbix_monitor_hardware.bat, 可以在附件里下载,内容为
@echo off
::goto program
goto %1
::check hardware_battery
:hardware_battery
for /f “tokens=2 delims=:” %%b in (‘omreport chassis batteries^|find /i “Health”‘) do set hardware_battery=%%b
Set hardware_battery=%hardware_battery: =%
if %hardware_battery% EQU Ok (set hardware_battery=1) else set hardware_battery=0
echo %hardware_battery%
exit
::check hardware_cpu_model
:hardware_cpu_model
for /f “tokens=2 delims=:” %%b in (‘omreport chassis biossetup^|find /i “C State”‘) do set hardware_cpu_crontol=%%b
Set hardware_cpu_crontol=%hardware_cpu_crontol: =%
if %hardware_cpu_crontol% EQU Enabled (set hardware_cpu_crontol=1) else set hardware_cpu_crontol=0
for /f “tokens=2 delims=:” %%b in (‘omreport chassis biossetup^|findstr /i “C1[-|E]”‘) do set hardware_cpu_c1=%%b
Set hardware_cpu_c1=%hardware_cpu_c1: =%
if %hardware_cpu_c1% EQU Enabled (set hardware_cpu_c1=1) else set hardware_cpu_c1=0
if %hardware_cpu_crontol% == 1 if %hardware_cpu_c1% == 1 (set hardware_cpu_model=1) else set hardware_cpu_model=0
echo %hardware_cpu_model%
exit
::check hardware_fan_health
:hardware_fan_health
for /f %%b in (‘omreport chassis fans^|find /i /C “Index”‘) do set hardware_fan_number=%%b
for /f %%b in (‘omreport chassis fans^|find /i /C “Ok”‘) do set hardware_fan=%%b
if %hardware_fan_number% == %hardware_fan% (set hardware_fan_health=1) else set hardware_fan_health=0
echo %hardware_fan_health%
exit
::check hardware_memory_health
:hardware_memory_health
for /f “tokens=2 delims=:” %%b in (‘omreport chassis memory^|find /i “Health”‘) do set hardware_memory=%%b
Set hardware_memory=%hardware_memory: =%
if %hardware_memory% EQU Ok (set hardware_memory_health=1) else set hardware_memory_health=0
echo %hardware_memory_health%
exit
::check hardware_nic_health
:hardware_nic_health
for /f %%b in (‘omreport chassis nics^|find /i /C “Interface Name”‘) do set hardware_nic_number=%%b
for /f %%b in (‘omreport chassis nics^|find /i /C “Connection Status”‘) do set hardware_nic=%%b
if %hardware_nic_number% == %hardware_nic% (set hardware_nic_health=1) else set hardware_nic_health=0
echo %hardware_nic_health%
exit
::check hardware_cpu
:hardware_cpu
for /f “tokens=2 delims=:” %%b in (‘omreport chassis processors^|find /i “Health”‘) do set hardware_cpu=%%b
Set hardware_cpu=%hardware_cpu: =%
if %hardware_cpu% EQU Ok (set hardware_cpu=1) else set hardware_cpu=0
echo %hardware_cpu%
exit
::check hardware_power_health
:hardware_power_health
for /f %%b in (‘omreport chassis pwrsupplies^|find /i /C “Index”‘) do set hardware_power_number=%%b
for /f %%b in (‘omreport chassis pwrsupplies^|find /i /C “Ok”‘) do set hardware_power=%%b
if %hardware_power_number% == %hardware_power% (set hardware_power_health=1) else set hardware_power_health=0
echo %hardware_power_health%
exit
::check hardware_temp
:hardware_temp
for /f “tokens=2 delims=:” %%b in (‘omreport chassis temps^|findstr /i “Status”‘) do set hardware_temp=%%b
Set hardware_temp=%hardware_temp: =%
if %hardware_temp% EQU Ok (set hardware_temp=1) else set hardware_temp=0
echo %hardware_temp%
exit
::check hardware_physics_health
:hardware_physics_health
for /F %%b in (‘omreport storage pdisk “controller=0″^|findstr /i “^State”^|find /i /C “State”‘) do set hardware_physics_disk_number=%%b
for /F %%b in (‘omreport storage pdisk “controller=0″^|find /i /C “Online”‘) do set hardware_physics_disk=%%b
if %hardware_physics_disk_number% == %hardware_physics_disk% (set hardware_physics_health=1) else set hardware_physics_health=0
echo %hardware_physics_health%
exit
::check hardware_virtual_health
:hardware_virtual_health
for /F %%b in (‘omreport storage vdisk “controller=0″^|findstr /i “^State”^|find /i /C “State”‘) do set hardware_virtual_disk_number=%%b
for /F %%b in (‘omreport storage vdisk “controller=0″^|find /i /C “Ready”‘) do set hardware_virtual_disk=%%b
if %hardware_virtual_disk_number% == %hardware_virtual_disk% (set hardware_virtual_health=1) else set hardware_virtual_health=0
echo %hardware_virtual_health%
exit
这个脚本是 bat 脚本,使用 bat 脚本的原因是我这里有 windows 2003、2008、2012 系统,默认给与用户不允许安装其他环节,所以 Python、cygwin 都不能安装,power shell 在 2003 系统还不支持,所以只能使用 bat 了。
3、关联模板
把 http://www.linuxidc.com/Linux/2015-05/117339.htm 里的模板导入到 web 里,然后主机管理模板即可。
监控 Windows 的硬件信息如下图
如果大家有问题可以直接留言。
相关附件 zabbix_monitor_hardware.bat 下载:
—————————————— 分割线 ——————————————
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2015 年资料 / 5 月 /11 日 /Zabbix 企业应用之 Windows 系统安装 OMSA 硬件监控 /
下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm
—————————————— 分割线 ——————————————
一些 Zabbix 相关教程集合:
安装部署分布式监控系统 Zabbix 2.06 http://www.linuxidc.com/Linux/2013-07/86942.htm
《安装部署分布式监控系统 Zabbix 2.06》http://www.linuxidc.com/Linux/2013-07/86942.htm
CentOS 6.3 下 Zabbix 安装部署 http://www.linuxidc.com/Linux/2013-05/83786.htm
Zabbix 分布式监控系统实践 http://www.linuxidc.com/Linux/2013-06/85758.htm
CentOS 6.3 下 Zabbix 监控 apache server-status http://www.linuxidc.com/Linux/2013-05/84740.htm
CentOS 6.3 下 Zabbix 监控 MySQL 数据库参数 http://www.linuxidc.com/Linux/2013-05/84800.htm
64 位 CentOS 6.2 下安装 Zabbix 2.0.6 http://www.linuxidc.com/Linux/2014-11/109541.htm
ZABBIX 的详细介绍:请点这里
ZABBIX 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-05/117340.htm