安装成功后,你需要立刻安全配置一下,我们大家都知道,SNMP在网络上决不是一个安全的协议,你可以通过这个连接来具体了解。但是我们只是在本地使用SNMP,但是还是建议你通过防火墙屏蔽SNMP的161与162端口和使用IPSec。并且要配置为obscure community string。在管理工具中,在服务中选择安全,设为只读访问。尽管community string安全问题不多,但是你还是要避免使用community string为只读访问。
Set oWService=GetObject("winmgmts:\\localhost\root\cimv2")
Set colItems=oWService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_System",,48)
For Each Item in colItems
Param1=Param1 + Item.Processes
Param2=Param2 + Item.Threads
Uptime=Item.SystemUptime
Next
WScript.Echo Param1
WScript.Echo Param2
WScript.Echo Uptime & " seconds"
WScript.Echo "LocalHost"
Another problem I had was getting detailed or custom web statistics through either SNMP or WMI. To solve that, I used Microsoft's LogParser tool to run custom queries from a simple batch file:
@for /f "tokens=1,2,3,4* delims=/ " %%i in ('date /t') do @set year=%%l&& @set month=%%j&& @set day=%%k