zabbix获取windows服务器上数据
C:\zabbix_agents\conf\zabbix_agentd.win.conf
UserParameter=conncount,d:\\tools\\online_conncount.bat
举例获取 mysql 用户数
@echo off
set mysql="D:\tools\mysql.exe"
%mysql% --defaults-extra-file=d:\\tools\\my.cnf --default-character-set=utf8 -N -e "SELECT count(*) FROM `mysql`.`user`;"
user_count.bat
mysql.exe 为:
C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe
my.cnf 目的为了不显示 mysql 出现 [Warning] Using a password on the command line interface can be insecure. 的提示,影响 zabbix 取值
[client]
user = root
password = passwd
host = 10.10.50.20
my.cnf
保证 zabbix server 端能正常取值即可实现监控
zabbix_get -s 10.10.50.20 -k conncount