详细脚本在github上 1上传zbxwmi脚本放入zabbix脚本执行目录 /usr/local/zabbix/share/zabbix/externalscripts 授权 chmod 755 zbxwmi chown zabbix:zabbix zbxwmi 2上传 impacket-py3.tar.bz2 到zbxwmi 同目录 /usr/local/zabbix/share/zabbix/externalscripts tar -zxvf impacket-py.tar.bz2 3服务器环境安装impacket 1检查pip版本如果太低最好升级 2上传pip-20.tar 3解压 tar -xvf pip-20.tar 4 cd pip-20.0.2 5升级pip python3 python3 setup.py install 6检查是否升级成功 /usr/local/python3/bin/pip --version pip 20.0.2 from /usr/local/python3/lib/python3.5/site-packages/pip-20.0.2-py3.5.egg/pip (python 3.5) ln -s /usr/local/python3/bin/pip /usr/bin/pip 7解压impacket.zip cd impacket.zip tar -xvf future-0.18.2.tar.gz
cd future-0.18.2.tar.gz python3 setup.py install tar -xvf impacket-0.9.21.tar.gz cd impacket-0.9.21 python3 setup.py install 回到impacket目录 pip install ./*.whl 4创建windows认证文本 mkdir -p /etc/zabbix vi /etc/zabbix/wmi.pw 文本内容填写 第一行为用户名 第二行为密码 5 测试脚本 python3 zbxwmi "-action" "json" "-k" "DeviceID" "-fields" "FreeSpace,Size" "-item" "C:" "Win32_LogicalDisk" “{HOST.HOST}” 6模板添加