Home Directory Plugins Operating Systems Windows Check Windows Last Update

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Check Windows Last Update

Rating
3 votes
Favoured:
0
Current Version
0.2
Last Release Date
2015-04-03
Compatible With
  • Nagios 3.x
License
GPL
Hits
38894
Files:
FileDescription
check_win_lastupdate.vbscheck_win_lastupdate.vbs
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Plugin calculates number of days since last success update.
Plugin calculates number of days since last success update using "LastSuccessTime" Windows registry key.The same date you can find in Windiows updates log. Plugin is tested with NSClient++ v 0.4, NSCP-0.4.x.
strKeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall"
strEntryName = "LastSuccessTime" (Value Data).

Usage: cscript check_win_lastupdate.vbs /w:90 /c:120

Script is working on localhost, so you should use for example NRPE and add this line in nsclient.ini in section [/settings/external scripts/scripts]

check_win_lastupdate=cscript.exe //T:30 //NoLogo scripts/check_win_lastupdate.vbs /w:$ARG1$ /c:$ARG2$
Reviews (2)
bynorcon, July 21, 2015
Hi Guys,

there is an Error in your Script. If you set the warning ord critical date to for example 30 and 60 Days, the script will work until the days since last update is excactly 30 or 60 days. 31 or 61 or 29 or 59 will work.

You have to modify your if and elseif at the end to = insted of

See here the edited code snipped:

If DD >= updateTresholdCritical Then
Wscript.Echo "CRITICAL: Patches are not applied for the last " & DD & " days."
Wscript.Quit(intCritical)

ElseIf DD >= updateTresholdWarning Then
Wscript.Echo "WARNING: Patches are not applied for the last " & DD & " days."
Wscript.Quit(intWarning)

ElseIf DD =
This script works like a charm.
As promised it is very fast and solely takes a registry value instead of having windows search for updates (which almost always leads to a timeout).

There is only little glitch though:
When Windows was NEVER updated, the script will return an error stating that "CDate" cannot be created with a NULL value.

I fixed it by editing the script thusly (maybe if someone has a more reliable check for NULL, please feel free to add a it):

[Snippet starts at line 26 of check_win_lastupdate.vbs] ----------------------
strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue

'-----------------------------------
if IsNull(strValue) = -1 then
Wscript.Echo "CRITICAL: Patches have NEVER been applied!"
Wscript.Quit(intCritical)
end if
'-----------------------------------


InstallDate = CDate(strValue)
CurrentDate = CDate(Now)
[...]

----------------------------------------------

Thanks for the script :)