Licenses: Updated the list of licenses and added a PDF containing all license texts
[check_mk.git] / .werks / 5605
blobe2f0705058bb368ea7089558b816964fe33dcd60
1 Title: HW/SW Inventory: Status data can be integrated into HW/SW Inventory tree
2 Level: 2
3 Component: inv
4 Compatible: compat
5 Edition: cre
6 Version: 1.5.0i3
7 Date: 1513851109
8 Class: feature
10 The HW/SW Inventory system collects static information about hardware and
11 software of hosts which is displayed in the GUI as a tree below 'Inventory'
12 of each host which has installed the mk_inventory plugin and enabled the
13 rule 'Do hardware/software inventory'.
14 If any data changes the HW/SW Inventory system detects that and calculates
15 the differences which can be viewed below 'Inventory history'.
17 Now status data like free space of tablespace can be intergated into the
18 HW/SW Inventory tree. These kind of data may change after every check cycle
19 thus we do not calculate any differences as for the static inventory data
20 in order to avoid filling up inventory archive and therefore slowing down
21 the monitoring system.
23 We solve above problem by separating these two kind of data within the
24 inventory plugins.
25 - There's one tree which is filled up with inventory data and will be saved
26 to var/check_mk/inventory as before.
27 - A second tree for the status data will be created and saved to
28 tmp/check_mk/structured_data
30 Later in the web GUI both tree objects are merged and visible below 'Inventory'.
31 Inventory history is only calculated for the inventory data, not for the
32 status data.
34 If the rule 'Do hardware/software inventory' is enabled for a host then
35 doing status data inventory is also enabled. In this case Check_MK does a
36 HW/SW inventory for this host after every check cycle if and only if there's a
37 inventory plugin which fills up status data tree.
38 Within above ruleset 'do status data inventory' can be disabled.
40 Notes for inventory plugin development:
41 Previously an inventory plugin used the functions inv_tree_list and inv_tree
42 for filling up the inventory tree, eg.
44 C+:
45 def inv_oracle_tablespaces(info):
46     node = inf_tree_list("software.applications.oracle.tablespaces:")
47 C-:
49 This behaviour will be still supported, but it's recommended to use the
50 new API, escpecially for new inventory plugins.
52 In order to use this new feature the inventory plugin takes the optional
53 arguments 'inventory_tree' or 'status_data_tree', eg.
55 C+:
56 def inv_oracle_tablespaces(info, inventory_tree, status_data_tree):
57 C-:
59 There are two methods for these tree objects 'get_dict' and 'get_list' which
60 take a path as argument. This path defines where the data should be stored, eg.
62 C+:
63     path = "software.applications.oracle.tablespaces:"
64     inv_node = inventory_tree.get_list(path)
65     status_node = status_data_tree.get_list(path)
66 C-:
68 Especially if lists are filled up with inventory and status data, there must
69 be a so-called identifier in the entries of these lists in order to link the
70 related elements, eg.:
72 C+:
73     for sid, data in tablespaces:
74         inv_node.append({"sid": sid, "INV-KEY": data[INV-DATA]})
75         status_node.append({"sid": sid, "STATUS-KEY": data[STATUS-DATA]})
76 C-:
78 Both nodes, 'inv_node' and 'status_node', use 'sid' as an identifier. Thereby
79 Check_MK knows which entries of both lists belong together.
80 If one identifier is not sufficient you can add more, eg.:
82 C+:
83     for sid, data in tablespaces:
84         inv_node.append({"sid": sid, "name" : name, "INV-KEY": data[INV-DATA]})
85         status_node.append({"sid": sid, "name": name, "STATUS-KEY": data[STATUS-DATA]})
86 C-:
88 Now Check_MK uses 'sid' and 'name' as identifier. These identifier have to exist in
89 all entries of both lists. Otherwise there's no possibility to link these entries.
91 To make Check_MK know which inventory plugins calculate status data an
92 additional attribute 'has_status_data' must be added which has the
93 value 'True'.
95 C+:
96 inv_info['oracle_tablespaces'] = {
97     "inv_function": inv_oracle_tablespaces,
98     "has_status_data": True,