2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 #<<<win_wmi_updates:sep(44):cached(1494868004,3600)>>>
29 #Node,Description,HotFixID,InstalledOn^M
30 #S050MWSIZ001,Update,KB2849697,5/10/2017^M
31 #S050MWSIZ001,Update,KB2849697,5/10/2017^M
32 #S050MWSIZ001,Update,KB2849696,5/10/2017^M
33 #S050MWSIZ001,Update,KB2849696,5/10/2017^M
34 #S050MWSIZ001,Update,KB2841134,5/10/2017^M
35 # Microsoft Office Professional Plus 2010|Microsoft Corporation|14.0.7015.1000
37 # InstalledOn may have different formats, see
38 # https://docs.microsoft.com/de-de/windows/desktop/CIMWin32Prov/win32-quickfixengineering
46 def _parse_install_date(install_date_str
):
47 for format_
in ["%Y%m%d", "%m/%d/%Y", "%d-%m-%Y"]:
49 return time
.mktime(time
.strptime(install_date_str
, format_
))
52 # However, some systems may return a 64-bit hexidecimal value in the Win32
54 # Contains a 64-bit value representing the number of 100-nanosecond intervals
55 # since January 1, 1601 (UTC).
57 return 1.0 * int(install_date_str
, 16) / 10**7
63 def inv_win_wmi_updates(info
):
64 paclist
= inv_tree_list("software.packages:")
69 _
, description
, knowledge_base
, install_date_str
= line
71 "name": "Windows Update " + knowledge_base
,
72 "version": knowledge_base
,
73 "vendor": "Micorosoft " + description
,
74 "install_date": _parse_install_date(install_date_str
),
75 "package_type": "wmi",
79 inv_info
['win_wmi_updates'] = {
80 "inv_function": inv_win_wmi_updates
,