In order to have an accurate network map, I'm trying to configure zabbix to initiate ping checks from agents and return the results in milliseconds on Windows 2003. Is this functionality built into Zabbix or will it require additional scripting to function. If scripting is required, would someone offer some advice on how to execute this?
Ad Widget
Collapse
Ping between agents
Collapse
X
-
Below is the script/config I used to get this working. I'm not all that familiar with VB so this could undoubtedly be more elegant. Anyone know if it's possible to pass an argument through the zabbix server item to the agent's script? It would be great to not have an entry for each host in the config and item on the server.
VB Script
Option Explicit
Dim strHost
strHost = Wscript.Arguments(0)
if Ping(strHost) = True then
Wscript.Echo
Else
Wscript.Echo "00"
end if
Function Ping(strHost)
Dim objPing, objRetStatus
set objPing = GetObject("winmgmts:{impersonationLevel=impersonat e}").ExecQuery _
("select * from Win32_PingStatus where address = '" & strHost & "'")
for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
Ping = False
'WScript.Echo "Status code is " & objRetStatus.StatusCode
else
Ping = True
Wscript.Echo objRetStatus.ResponseTime
end if
next
End Function
Agent Config
UserParameter=PingNode,cscript //nologo pingtest.vbs google.com
Comment