Set version to 1.5.0b9
[check_mk.git] / inventory / win_wmi_updates
blobd6451b8519ef6dacd263674fd0fd6caa0fd6eb28
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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 # Example output
29 #<<<win_wmi_updates:sep(44):cached(1494868004,3600)>>>
30 #Node,Description,HotFixID,InstalledOn^M
31 #S050MWSIZ001,Update,KB2849697,5/10/2017^M
32 #S050MWSIZ001,Update,KB2849697,5/10/2017^M
33 #S050MWSIZ001,Update,KB2849696,5/10/2017^M
34 #S050MWSIZ001,Update,KB2849696,5/10/2017^M
35 #S050MWSIZ001,Update,KB2841134,5/10/2017^M
36 # Microsoft Office Professional Plus 2010|Microsoft Corporation|14.0.7015.1000
39 def inv_win_wmi_updates(info):
40 paclist = inv_tree_list("software.packages:")
41 for line in info:
42 if len(line) <> 4:
43 continue
45 _, description, knowledge_base, install_date = line
46 date_number = None
47 if re.match(".*20.", install_date):
48 date_number = int(time.mktime(time.strptime(install_date, "%m/%d/%Y")))
49 paclist.append({
50 "name" : "Windows Update " + knowledge_base,
51 "version" : knowledge_base,
52 "vendor" : "Micorosoft " + description,
53 "install_date" : date_number,
54 "package_type" : "wmi",
58 inv_info['win_wmi_updates'] = {
59 "inv_function": inv_win_wmi_updates,