Has anyone got a working monitor for Zabbix 3.0 and letting you know how many pending updates? i've tried a few even the one on the zabbix site doesnt appear to work anymore.
Ad Widget
Collapse
Monitor Windows Updates
Collapse
X
-
Hi,
I used this a few months ago and it worked.
1.Install the agent on the host you want to monitor
2.Add an userparameter on the zabbix_agentd.conf like this:
3.Put the script in the folder that you specified in the userparameter in this case is C:\Zabbix\scripts\zabbix....vbs)Code:userparameter=custom.check_win_update[*],cscript //NoLogo "C:\Zabbix\scripts\ZabbixWindowsUpdate.vbs" $1
4.Create on Zabbix frontend 5 items for the host:
keys/types to use:
item1: type: zabbix agent (active) key: custom.check_win_update["last"] (numeric/decimal)
item2: type: zabbix agent (active) key: custom.check_win_update["optional"] (numeric/decimal)
item3: type: zabbix agent (active) key: custom.check_win_update["priority"] (numeric/decimal)
item4: type: zabbix agent (active) key: custom.check_win_update["total"](numeric/decimal)
item5: type: zabbix agent (active) key: custom.check_win_update["full"] (text)
ZabbixWindowsUpdate.vbs script:
Code:Set args = WScript.Arguments IF (WScript.Arguments.Count > 0) Then IF (WScript.Arguments.Item(0) = "last") Then Set objSession = CreateObject("Microsoft.Update.Session") Set objSearcher = objSession.CreateUpdateSearcher Set colHistory = objSearcher.QueryHistory(0,1) For Each objEntry in colHistory WScript.Echo date2epoch(objEntry.Date) Next Else Wscript.Echo getUpdates(WScript.Arguments.Item(0)) End IF Else Wscript.Echo "ERROR in CheckWinUpdate parameter" End IF Function getUpdates(updateType) Set objSearcher = CreateObject("Microsoft.Update.Searcher") Set objResults = objSearcher.Search("IsInstalled=0") Set colUpdates = objResults.Updates updatesHigh = 0 updatesOptional = 0 priorityUpdateList = "Priority Updates:" & vbCrLf optionalUpdateList = "Optional Updates:" & vbCrLf For i = 0 to colUpdates.Count - 1 If (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = False) Then updatesOptional = updatesOptional + 1 title = "Optional Update" optionalUpdateList = optionalUpdateList & colUpdates.Item(i).Title & vbCrLf ElseIf (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = True) Then updatesHigh = updatesHigh + 1 title = "High Priority Update" priorityUpdateList = priorityUpdateList & colUpdates.Item(i).Title & vbCrLf End IF Next IF (updateType = "priority") Then getUpdates = updatesHigh ElseIf (updateType = "optional") Then getUpdates = updatesOptional ElseIf (updateType = "total") Then getUpdates = (updatesHigh + updatesOptional) ElseIf (updateType = "full") Then getUpdates = priorityUpdateList & vbCrLf & optionalUpdateList Else getUpdates = "ERROR in CheckWinUpdate parameter" End IF End function Function getmydat(wmitime) dtmInstallDate.Value = wmitime getmydat = dtmInstallDate.GetVarDate End function function date2epoch(myDate) date2epoch = DateDiff("s", "01/01/1970 00:00:00", myDate) end functionLast edited by IT-Yannick; 21-11-2016, 16:45. -
Last edited by IT-Yannick; 21-11-2016, 16:58.Comment
-
Comment