Resource management method and apparatus, electronic device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNDSUN TECH
- Filing Date
- 2023-09-27
- Publication Date
- 2026-07-21
Smart Images

Figure CN117171173B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of configuration management databases, and more specifically, to a resource management method, apparatus, electronic device, and storage medium. Background Technology
[0002] A CMDB (Configuration Management Database) contains information about the entire lifecycle of configuration items and the relationships between them (including physical relationships, real-time communication relationships, non-real-time communication relationships, and dependencies). In other words, all resources within an enterprise that need to be managed and maintained can be abstracted into configuration information, such as hosts, processes, application services, components, switches, business systems, etc. The relationships between resources can be abstracted into relationships between configurations, and the CMDB is responsible for maintaining the entire lifecycle of configurations and the relationships between them.
[0003] CMDB construction typically includes configuration modeling and resource management. Configuration modeling refers to modeling the configuration information of hosts, switches, processes, application services, middleware, databases, racks, data centers, personnel, etc., using custom models. Each model can be further characterized by custom attributes. Resource management refers to instantiating different models and managing the detailed configuration information of resources. Resource management mainly includes the lifecycle management of resources, such as resource acquisition, storage, modification, and destruction.
[0004] Currently, in the process of building a CMDB (Content Management Database), modeling is typically based on the basic attributes of the resources themselves (e.g., name, type, IP address, etc.) and the association attributes that express the relationships between models. Accordingly, the CMDB model can manage resources based on both the basic attributes of the resources and the association attributes between resources. However, because only the basic attributes of the resources and the association attributes between resources are considered, resource management is not comprehensive enough, affecting the accuracy of subsequent decisions. Summary of the Invention
[0005] The purpose of this application is to provide a resource management method, apparatus, electronic device, and storage medium that, during the CMDB construction process, establishes a combinatorial dependency relationship between newly added resources, thereby improving the comprehensiveness of resource management and ultimately enhancing the accuracy of subsequent decisions.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0007] In a first aspect, embodiments of this application provide a resource management method, the method comprising:
[0008] Obtain the target CMDB model corresponding to the target resource;
[0009] The target CMDB model has multiple target attribute fields; these target attribute fields include an instance cascade attribute field, an instance option attribute field, and an instance association attribute field; the instance cascade attribute field stores the cascade attributes of the target resource, each cascade attribute including multiple option attributes, and each option attribute has a composite dependency with the association attribute of the associated resource; the instance option attribute field stores each option attribute; the instance association attribute field stores the association attribute of the associated resource corresponding to each option attribute; the associated resource is stored in the associated CMDB model.
[0010] Establish a data mapping relationship between a custom data structure and the target CMDB model; the custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model;
[0011] Based on the data mapping relationship, the target data corresponding to each target field is written into the attribute field corresponding to the target CMDB model.
[0012] Optionally, the step of obtaining the target CMDB model includes:
[0013] A general CMDB model is established, wherein the general CMDB model includes multiple attribute fields, the attribute fields include cascading attribute fields, option attribute fields and related attribute fields, the cascading attribute fields, the option attribute fields and the related attribute fields are respectively used to store the cascading attributes of resources, each option attribute contained in the cascading attributes, and the related attributes of related resources that have a combined dependency relationship with each option attribute;
[0014] Based on the general CMDB model, the target CMDB model is obtained.
[0015] Optionally, the step of obtaining the target CMDB model based on the general CMDB model includes:
[0016] Based on the general CMDB model, multiple target attribute fields are generated that correspond one-to-one with the multiple attribute fields in the general CMDB model, thus obtaining the target CMDB model.
[0017] Optionally, the custom data structure includes a data cascading attribute field, a data option attribute field, and a data association attribute field;
[0018] The step of establishing the data mapping relationship between the custom data structure and the target CMDB model includes:
[0019] Map the data cascaded attribute fields in the custom data structure to the instance cascaded attribute fields in the target CMDB model;
[0020] Map the data option attribute field in the custom data structure to the instance option attribute field in the target CMDB model;
[0021] The data mapping relationship is obtained by mapping the data association attribute field in the custom data structure to the instance association attribute field in the target CMDB model.
[0022] Optionally, before the step of writing the target data corresponding to each target field into the corresponding attribute field according to the data mapping relationship, the method further includes:
[0023] Cascaded data is identified from the data to be transformed of the target resource, wherein the cascaded data includes cascaded attribute data of the target resource, multiple option attribute data included in the cascaded attribute data, and associated attribute data of associated resources that have a combined dependency relationship with each of the option attribute data.
[0024] Optionally, the custom data structure includes a data cascade attribute field, a data option attribute field, and a data association attribute field, and the data mapping relationship includes a one-to-one mapping relationship between the data cascade attribute field, the data option attribute field, the data association attribute field, and the instance cascade attribute field, the instance option attribute field, and the instance association attribute field in the target CMDB model;
[0025] The step of writing the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship includes:
[0026] If the cascaded data does not conform to the custom data structure, then according to the custom data structure, the cascaded data is transformed so that the data cascaded attribute field, the data option attribute field, and the data association attribute field correspond to the cascaded attribute data, each option attribute data, and the association attribute data associated with each option attribute data in the cascaded data, respectively.
[0027] Based on the data mapping relationship, the cascading attribute data, option attribute data, and associated attribute data corresponding to the data cascading attribute field, the data option attribute field, and the data association attribute field are respectively written into the instance cascading attribute field, the instance option attribute field, and the instance association attribute field in the target CMDB model.
[0028] Optionally, the step of writing the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship further includes:
[0029] If the cascaded data conforms to the custom data structure, then according to the data mapping relationship, the cascaded attribute data, option attribute data, and associated attribute data corresponding to the data cascaded attribute field, the data option attribute field, and the data association attribute field are respectively written into the instance cascaded attribute field, the instance option attribute field, and the instance association attribute field in the target CMDB model.
[0030] Secondly, embodiments of this application also provide a resource management device, the device comprising:
[0031] The model acquisition module is used to acquire the target CMDB model corresponding to the target resource.
[0032] The target CMDB model has multiple target attribute fields; these target attribute fields include an instance cascade attribute field, an instance option attribute field, and an instance association attribute field; the instance cascade attribute field stores the cascade attributes of the target resource, each cascade attribute including multiple option attributes, and each option attribute has a composite dependency with the association attribute of the associated resource; the instance option attribute field stores each option attribute; the instance association attribute field stores the association attribute of the associated resource corresponding to each option attribute; the associated resource is stored in the associated CMDB model.
[0033] The data mapping relationship establishment module is used to establish a data mapping relationship between a custom data structure and the target CMDB model; the custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model;
[0034] The data writing module is used to write the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship.
[0035] Thirdly, embodiments of this application also provide an electronic device, including a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the resource management method in the first aspect above when executing the program.
[0036] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the resource management method described in the first aspect above.
[0037] Compared to existing technologies, the resource management method, apparatus, electronic device, and storage medium provided in this application first obtain a target CMDB model corresponding to the target resource. The target resource has cascading attributes, including multiple option attributes. Each option attribute has a combinatorial dependency relationship with the associated attributes of the associated resource. The target CMDB model includes instance cascading attribute fields, instance option attribute fields, and instance associated attribute fields, which are used to store cascading attributes, option attributes, and associated attributes, respectively. Then, a data mapping relationship is established between each type of target field in a custom data structure and the target CMDB model. Finally, according to the data mapping relationship, the target data corresponding to each target field is written into the attribute field corresponding to the target CMDB model. Thus, the target CMDB model can perform asset management on attributes with combinatorial dependencies between resources, improving the comprehensiveness of resource management and thereby improving the accuracy of subsequent decisions. Attached Figure Description
[0038] Figure 1 A schematic diagram of the CMDB model structure provided by the prior art is shown.
[0039] Figure 2 This application illustrates a flowchart of the resource management method provided in an embodiment. Figure 1 .
[0040] Figure 3 A schematic diagram of the CMDB model structure provided in the embodiments of this application is shown. Figure 1 .
[0041] Figure 4 A schematic diagram of the CMDB model structure provided in the embodiments of this application is shown. Figure 2 .
[0042] Figure 5 This application illustrates a flowchart of the resource management method provided in an embodiment. Figure 2 .
[0043] Figure 6 A block diagram of a resource management device provided in an embodiment of this application is shown.
[0044] Figure 7 A block diagram of an electronic device provided in an embodiment of this application is shown.
[0045] Icons: 100-Resource management device; 101-Model acquisition module; 102-Data mapping relationship establishment module; 103-Data identification module; 104-Data writing module; 10-Electronic device; 11-Processor; 12-Memory; 13-Bus. Detailed Implementation
[0046] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0047] CMDB plays a crucial role in enterprise resource allocation and management, enabling the construction of all manageable objects using its modeling capabilities. Currently, CMDB construction typically involves modeling based on the resource's fundamental attributes (e.g., name, type, IP address, etc.) and relational attributes that express the relationships between models. Figure 1 As shown, model A includes basic attributes 1 and 2, related attributes 1 and 2, etc. Related attribute 1 is associated with model B, and related attribute 2 is associated with model C.
[0048] For example, in an operation and maintenance scenario, taking the server as an example of the operation and maintenance monitoring object, it is modeled. The server model includes attributes such as name, IP address, CPU configuration, memory configuration, and data center. Among them, name, IP address, CPU configuration, and memory configuration are basic attributes, and the data center is a related attribute, which is associated with the data center model.
[0049] Because CMDB modeling only considers the basic attributes of resources and the relationship attributes between resources, the attributes are not fully considered. This may lead to missing or incorrect relationships, making it impossible to accurately understand the dependencies and scope of influence between resources. As a result, resource management is not comprehensive enough, which affects the accuracy of subsequent decisions.
[0050] To address the aforementioned technical issues, this application embodiment adds an attribute indicating a composite dependency relationship between resources during the CMDB construction process. This enables the CMDB model to manage assets based on this attribute, improving the comprehensiveness of resource management and consequently enhancing the accuracy of subsequent decisions.
[0051] The electronic devices in the embodiments of this application can be servers, such as a single server, a server cluster, etc.; or they can be terminals, such as desktop computers, laptops, smartphones, tablets, etc. The embodiments of this application do not impose any limitations on them.
[0052] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0053] Please refer to Figure 2 , Figure 2 A flowchart illustrating a resource management method provided in an embodiment of this application is shown. This resource management method, applied to an electronic device, may include the following steps:
[0054] S101, Obtain the target CMDB model corresponding to the target resource; wherein, the target CMDB model has multiple target attribute fields; the target attribute fields include instance cascade attribute fields, instance option attribute fields, and instance association attribute fields; the instance cascade attribute fields are used to store the cascade attributes of the target resource, the cascade attributes include multiple option attributes, and each option attribute has a composite dependency relationship with the attributes of the associated resource; the instance option attribute fields are used to store each option attribute; the instance association attribute fields are used to store the association attributes of the associated resource corresponding to each option attribute; the associated resource is stored in the associated CMDB model.
[0055] In this embodiment, as described above, CMDB modeling currently only considers the basic attributes of resources and the associated attributes between resources. However, there are often combinatorial dependencies between the attributes of different resources. Attributes that have combinatorial dependencies with the attributes of other resources are called cascading attributes. Cascading attributes typically have two characteristics: 1. Cascading attributes contain multiple optional attributes; 2. Each optional attribute is associated with one or more attributes of other resources.
[0056] For example, taking the server being monitored as an example, such as Figure 3 As shown, in addition to attributes such as name, IP address, CPU configuration, memory configuration, and data center location, the server also has a monitoring method attribute. Typically, monitoring methods include Client proxy and WebSocket. Client proxy is associated with the Client IP address and License name; the Client IP address is an attribute of the Client, and the License name is an attribute of the License. WebSocket is associated with Path and Login name; Path is an attribute of the Protocol, and Login name is an attribute of the contact person. Clearly, the monitoring method is a cascading attribute that has a composite dependency relationship with attributes of other resources.
[0057] Existing CMDB modeling does not consider cascading attributes. Consequently, the resulting CMDB model cannot manage assets related to cascading attributes, leading to incomplete resource management and affecting the accuracy of subsequent decisions.
[0058] Based on this, in CMDB modeling, this application embodiment considers not only the basic attributes and associated attributes of resources, but also the cascading attributes of resources and the combinatorial dependencies between cascading attributes and the attributes of other resources.
[0059] like Figure 4As shown, resource A is modeled as model A. Model A includes basic attribute A.P1, associated attribute A.Pn, and cascading attribute A.P2. Cascading attribute A.P2 includes option attributes Cx and Cy. Option attribute Cx is associated with associated attribute E.Px of model E and associated attribute F.Px of model F. Option attribute Cy is associated with associated attribute G.Py of model G and associated attribute H.Py of model H.
[0060] It should be pointed out that, Figure 4 The CMDB model shown is for illustrative purposes only. In practice, cascading attributes may have more than two option attributes, and each option attribute may be associated with one or more related attributes.
[0061] The CMDB modeling process in this application embodiment may include the following steps:
[0062] 1. Define a model, for example, Model A, which mainly provides a general description of the common characteristics of the resources. It may include the model's name, description, usage scenarios, model number, model icon, model grouping, etc.
[0063] A model includes multiple attributes, such as A.P1, A.P2, etc. The types of attributes in CMDB basically include character, boolean, integer, floating point, date, text, single selection, multiple selection, foreign key, structure, and cascading combination type, etc. This embodiment mainly describes the cascading combination type.
[0064] 2. Define cascading attributes, which mainly include option attributes, such as Cx, Cy, etc. In addition, cascading attributes also include common attributes, such as attribute flags, attribute names, attribute groups, etc.
[0065] 3. Define the option attributes contained in the cascading attribute. The difference between the cascading attribute and other attributes is that the cascading attribute includes option attributes. Different option attributes are defined to express the toggleable content. Each option attribute can contain multiple different associated attributes, such as E.Px, F.Px, etc.
[0066] 4. Define associated attributes. Associated attributes are attributes that come from other models. They can be basic attributes, reference attributes, cascading attributes, etc.
[0067] 5. Establish cascading relationships by binding each option attribute to one or more associated attributes to form cascading relationships. The specific associations can be customized according to individual needs.
[0068] By following the above process, CMDB modeling can be completed. Then, the modeled CMDB model can be instantiated to manage the detailed configuration information of resources.
[0069] Optionally, the process of obtaining the target CMDB model corresponding to the target resource in step S101 may include sub-steps S1011 to S1012.
[0070] S1011, Establish a general CMDB model, wherein the general CMDB model includes multiple attribute fields, including cascading attribute fields, option attribute fields, and related attribute fields. The cascading attribute fields, option attribute fields, and related attribute fields are used to store the cascading attributes of resources, each option attribute contained in the cascading attributes, and the related attributes of related resources that have a combined dependency relationship with each option attribute, respectively.
[0071] Those skilled in the art should understand that the above Figure 4 The diagram shows the model structure. In actual modeling, a general CMDB model can be built according to this structure. The general CMDB model can be in the form of data tables. For example, a general CMDB model can include model tables, attribute tables, option tables, and association tables.
[0072] The model table is used to store model information, as shown in Table 1 below. The model table may include fields such as model name, model id, model code (model_code), and attribute id, which are used to store the model name, model id, model code, and attribute id contained in the model, respectively.
[0073] Table 1
[0074] Model Name model id Model code attribute id ……
[0075] The attribute table is used to store information about attributes in the model, as shown in Table 2 below. The attribute table may include an attribute name field, an attribute id field, an attribute type field, and a model id field, which are used to store the attribute name of the resource, the attribute id of the resource, the attribute type, and the model id of the model to which it belongs, respectively. The attribute type may include basic attributes, related attributes, reference attributes, cascading attributes, etc.
[0076] Table 2
[0077] Attribute Name attribute id Attribute type model id ……
[0078] The option table is used to store information about the option attributes in the cascading attributes, as shown in Table 3 below. The option table may include fields such as option attribute name, option attribute id, cascading attribute name, and cascading attribute id, which are used to store the name, id, and id of the cascading attribute contained in the cascading attribute, respectively.
[0079] Table 3
[0080] Option attribute name Option attribute id Cascade property name Cascade attribute id ……
[0081] The association table is used to store the composite dependency relationship between option attributes and the associated attributes of associated resources, as shown in Table 4 below. The association table may include the option attribute id field, the associated attribute name field, the associated attribute id field, the associated model id field, etc., which are used to store the name and id of the option attribute, the name and id of the associated attribute of the associated resource that has a composite dependency relationship with the option attribute, and the id of the associated model to which the associated attribute belongs, etc.
[0082] Table 4
[0083] Option attribute id Associated attribute name Related attribute id Related model ID ……
[0084] S1012, Based on the general CMDB model, obtain the target CMDB model.
[0085] In this embodiment, after establishing the general CMDB model, the general CMDB model is instantiated to generate multiple target attribute fields that correspond one-to-one with the multiple attribute fields in the general CMDB model, thus obtaining the target CMDB model.
[0086] As described above, a general CMDB model can include a model table, an attribute table, an option table, and an option-attribute association table. Correspondingly, a target CMDB model can include an instance model table, an instance attribute table, an instance option table, and an instance association table. The tables and fields contained in the target CMDB model are consistent with those in the general CMDB model.
[0087] The instance model table is used to store information about the target CMDB model, as shown in Table 5 below. The instance model table may include fields such as target model name, target model id, target model code (model_code), and target attribute id, which are used to store the target CMDB model name, target CMDB model id, target CMDB model code, and attribute id contained in the target CMDB model, respectively.
[0088] Table 5
[0089] Target model name target model id Target model code target attribute id ……
[0090] The instance attribute table is used to store information about attributes in the target CMDB model, as shown in Table 6 below. The instance attribute table may include the target attribute name field, the target attribute id field, the attribute type field, and the target model id field, which are used to store the attribute name, attribute id, attribute type, and model id of the target CMDB model to which the target resource belongs, respectively. The attribute type may include basic attributes, related attributes, reference attributes, cascading attributes, etc.
[0091] Table 6
[0092] Target attribute name target attribute id Attribute type target model id ……
[0093] The instance option table is used to store information about the option attributes in the cascading attributes of the target resource, as shown in Table 7 below. The instance option table may include the instance option attribute name field, the instance option attribute id field, the instance cascading attribute name field, and the instance cascading attribute id field, which are used to store the name, id, and id of the cascading attribute contained in the cascading attribute, respectively.
[0094] Instance option property name Instance option attribute id Instance cascade property name Instance cascaded property id ……
[0095] The instance association table is used to store the combined dependency relationship between the option attributes of the target resource and the association attributes of the associated resources, as shown in Table 8 below. The instance association table may include the instance option attribute id field, the instance association attribute name field, the instance association attribute id field, the association model id field, etc., which are used to store the name and id of the option attribute, the name and id of the association attribute of the associated resource that has a combined dependency relationship with the option attribute, and the id of the association model to which the association attribute belongs, etc.
[0096] Table 8
[0097] Instance option attribute id Instance associated property name Instance associated attribute id Related model ID ……
[0098] It should be noted that the target CMDB model obtained through step S101 consists of four empty tables with fields, as shown in Tables 5-8. Subsequent data entry involves writing data into these four empty tables.
[0099] S103, Establish the data mapping relationship between the custom data structure and the target CMDB model; the custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model.
[0100] In this embodiment, for the data to be automatically collected and stored in the target CMDB model, the connection method, request parameters, and returned data structure of the data source need to be defined first. The custom data structure can contain multiple types of target fields, which can be cascading attributes, option attributes, related attributes, etc.
[0101] Optionally, the custom data structure can be as follows:
[0102]
[0103] Wherein, cascade1 represents the data cascading attribute field, label-a and label-b represent the data option attribute fields, associate-aa and associate-ab represent the data association attribute fields of label-a, and associate-ba and associate-bb represent the data association attribute fields of label-b.
[0104] In one possible implementation, the custom data structure may include data cascading attribute fields, data option attribute fields, and data association attribute fields. The process of establishing the data mapping relationship between the custom data structure and the target CMDB model in step S103 may include:
[0105] Map data cascaded attribute fields in a custom data structure to instance cascaded attribute fields in the target CMDB model;
[0106] Map the data option attribute fields in the custom data structure to the instance option attribute fields in the target CMDB model;
[0107] Map the data association attribute fields in the custom data structure to the instance association attribute fields in the target CMDB model to obtain the data mapping relationship.
[0108] In other words, the data mapping relationship between the custom data structure and the target CMDB model is established as shown in Table 9 below:
[0109] Table 9
[0110] Custom data structures Data cascading attributes Data Option Properties Data association attributes
[0111] As shown in Table 9, the instance cascading attribute field, instance option attribute field, and instance association attribute field of the target CMDB model correspond to the data cascading attribute field, data option attribute field, and data association attribute field of the custom data structure, respectively.
[0112] S105, based on the data mapping relationship, write the target data corresponding to each target field into the attribute field corresponding to the target CMDB model.
[0113] In this embodiment, for the data to be converted of the target resource, if the data to be converted conforms to a custom data structure, then according to the data mapping relationship established in step S103, the target data corresponding to each target field in the custom data structure is directly written into the attribute field corresponding to the target CMDB model. If the data to be converted does not conform to the custom data structure, then the data to be converted is first processed into a custom data structure, and then according to the data mapping relationship established in step S103, the target data corresponding to each target field in the custom data structure is written into the attribute field corresponding to the target CMDB model.
[0114] As can be seen from the foregoing, compared with the prior art, in addition to basic attributes and related attributes, the CMDB model in this application embodiment can manage assets for attributes that have composite dependencies between resources. Therefore, before writing data, cascaded data can be identified from the data to be converted, and then the cascaded data can be written into the target CMDB model according to the data mapping relationship established in step S103.
[0115] Therefore, in Figure 2 Based on this, please refer to Figure 5 Prior to step S105, the resource management method provided in this application embodiment further includes step S104.
[0116] S104, Identify cascaded data from the data to be transformed of the target resource, wherein the cascaded data includes cascaded attribute data of the target resource, multiple option attribute data included in the cascaded attribute data, and associated attribute data of associated resources that have a combined dependency relationship with each option attribute data.
[0117] As can be seen from the foregoing, the custom data structure includes cascading attribute fields, data option attribute fields, and data association attribute fields. The data mapping relationship includes a one-to-one mapping between these fields and the instance cascading attribute fields, instance option attribute fields, and instance association attribute fields in the target CMDB model. Therefore, please refer again... Figure 5 Step S105, which involves writing the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship, may include sub-steps S1051 to S1053.
[0118] S1051, if the cascaded data does not conform to the custom data structure, then according to the custom data structure, the cascaded data is transformed so that the data cascaded attribute field, data option attribute field, and data association attribute field correspond to the cascaded attribute data, each option attribute data, and the association attribute data associated with each option attribute data in the cascaded data, respectively.
[0119] S1052, Based on the data mapping relationship, write the cascading attribute data, option attribute data, and associated attribute data corresponding to the data cascading attribute field, data option attribute field, and data association attribute field into the instance cascading attribute field, instance option attribute field, and instance association attribute field of the target CMDB model, respectively.
[0120] S1053, if the cascaded data conforms to the custom data structure, then according to the data mapping relationship, write the cascaded attribute data, option attribute data, and associated attribute data corresponding to the data cascaded attribute field, data option attribute field, and data association attribute field into the instance cascaded attribute field, instance option attribute field, and instance association attribute field of the target CMDB model, respectively.
[0121] In this embodiment, the custom data structure is as shown in step S103. For cascaded data, first obtain the cascaded attribute data, option attribute data, and associated attribute data corresponding to the cascade1 field, label-a field, and associate-aa field, respectively. Then, according to the data mapping relationship shown in Table 9, write the cascaded attribute data, option attribute data, and associated attribute data corresponding to the cascade1 field, label-a field, and associate-aa field, respectively, into the instance cascaded attribute field, instance option attribute field, and instance associated attribute field in the target CMDB model.
[0122] For example, combined with Figure 3 The example shown illustrates how, for cascaded data related to monitoring methods, the data is written into the target CMDB model following the above process, resulting in the following Table 10:
[0123] Table 10
[0124]
[0125]
[0126]
[0127]
[0128]
[0129] Compared with the prior art, the embodiments of this application have the following beneficial effects:
[0130] First, the addition of the attribute of combinatorial dependencies between resources during the CMDB construction process enhances the modeling capabilities of the CMDB. The CMDB model can perform asset management on the attribute of combinatorial dependencies between resources, improving the comprehensiveness of resource management and thus improving the accuracy of subsequent decisions.
[0131] Secondly, by defining a custom data structure and establishing a data mapping relationship between the custom data structure and the target CMDB model, the data to be converted from the target resource is automatically entered into the target CMDB model.
[0132] In order to perform the corresponding steps in the above method embodiments and various possible implementations, an implementation of a resource management device is given below.
[0133] Please refer to Figure 6 , Figure 6 A block diagram of a resource management device 100 provided in an embodiment of this application is shown. The resource management device 100 is applied to an electronic device and includes: a model acquisition module 101, a data mapping relationship establishment module 102, and a data writing module 104.
[0134] The model acquisition module 101 is used to acquire the target CMDB model corresponding to the target resource. The target CMDB model has multiple target attribute fields. The target attribute fields include instance cascade attribute fields, instance option attribute fields, and instance association attribute fields. The instance cascade attribute fields are used to store the cascade attributes of the target resource. The cascade attributes include multiple option attributes, and each option attribute has a composite dependency relationship with the attributes of the associated resource. The instance option attribute fields are used to store each option attribute. The instance association attribute fields are used to store the association attributes of the associated resource corresponding to each option attribute. The associated resource is stored in the associated CMDB model.
[0135] The data mapping relationship establishment module 102 is used to establish the data mapping relationship between the custom data structure and the target CMDB model; the custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model.
[0136] The data writing module 104 is used to write the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship.
[0137] Optionally, the model acquisition module 101 is specifically used for:
[0138] Establish a general CMDB model, which includes multiple attribute fields, including cascading attribute fields, option attribute fields, and related attribute fields. The cascading attribute fields, option attribute fields, and related attribute fields are used to store the cascading attributes of resources, each option attribute contained in the cascading attributes, and the related attributes of related resources that have a composite dependency relationship with each option attribute, respectively.
[0139] Based on the general CMDB model, the target CMDB model is obtained.
[0140] Optionally, the model acquisition module 101 executes methods to obtain the target CMDB model based on the general CMDB model, including:
[0141] Based on the general CMDB model, multiple target attribute fields are generated that correspond one-to-one with multiple attribute fields in the general CMDB model, thus obtaining the target CMDB model.
[0142] Optionally, the custom data structure includes data cascading attribute fields, data option attribute fields, and data association attribute fields; the data mapping relationship establishment module 102 is specifically used for:
[0143] Map data cascaded attribute fields in a custom data structure to instance cascaded attribute fields in the target CMDB model;
[0144] Map the data option attribute fields in the custom data structure to the instance option attribute fields in the target CMDB model;
[0145] Map the data association attribute fields in the custom data structure to the instance association attribute fields in the target CMDB model to obtain the data mapping relationship.
[0146] Optionally, the resource management device 100 provided in this application embodiment further includes a data identification module 103, which is used for:
[0147] Identify cascaded data from the target resource's data to be transformed. The cascaded data includes the target resource's cascaded attribute data, multiple option attribute data included in the cascaded attribute data, and the associated attribute data of associated resources that have a combined dependency relationship with each option attribute data.
[0148] Optionally, the data structure includes custom data cascading attribute fields, data option attribute fields, and data association attribute fields. The data mapping relationship includes a one-to-one mapping relationship between the data cascading attribute fields, data option attribute fields, data association attribute fields, and instance cascading attribute fields, instance option attribute fields, and instance association attribute fields in the target CMDB model. The data writing module 104 is specifically used for:
[0149] If the cascaded data does not conform to the custom data structure, then the cascaded data is transformed according to the custom data structure so that the data cascaded attribute field, data option attribute field, and data association attribute field correspond to the cascaded attribute data, each option attribute data, and the association attribute data associated with each option attribute data in the cascaded data, respectively.
[0150] Based on the data mapping relationship, the cascading attribute data, option attribute data, and associated attribute data corresponding to the data cascading attribute field, data option attribute field, and data association attribute field are respectively written into the instance cascading attribute field, instance option attribute field, and instance association attribute field in the target CMDB model.
[0151] Optionally, the data writing module 104 is further used for:
[0152] If the cascaded data conforms to the custom data structure, then according to the data mapping relationship, the cascaded attribute data, option attribute data, and associated attribute data corresponding to the data cascaded attribute field, data option attribute field, and data association attribute field are respectively written into the instance cascaded attribute field, instance option attribute field, and instance association attribute field in the target CMDB model.
[0153] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the resource management device 100 described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0154] Please refer to Figure 7 , Figure 7 A block diagram of an electronic device 10 provided in an embodiment of this application is shown. The electronic device 10 includes a processor 11, a memory 12, and a bus 13. The processor 11 is connected to the memory 12 via the bus 13.
[0155] Memory 12 is used to store programs, for example Figure 6 The resource management device 100 shown includes at least one software function module that can be stored in the memory 12 in the form of software or firmware. After receiving an execution instruction, the processor 11 executes the program to implement the resource management method disclosed in the foregoing embodiments.
[0156] The memory 12 may include RAM (Random Access Memory) or NVM (non-volatile memory).
[0157] Processor 11 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed through integrated logic circuits in the hardware of processor 11 or through software instructions. Processor 11 can be a general-purpose processor, including CPU (Central Processing Unit), MCU (Microcontroller Unit), CPLD (Complex Programmable Logic Device), FPGA (Field Programmable Gate Array), embedded ARM chips, etc.
[0158] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by processor 11, implements the resource management method disclosed in the foregoing embodiments.
[0159] In summary, the resource management method, apparatus, electronic device, and storage medium provided in this application first obtain a target CMDB model corresponding to the target resource. The target resource has cascading attributes, including multiple option attributes. Each option attribute has a combinatorial dependency relationship with the associated attributes of the associated resource. The target CMDB model includes instance cascading attribute fields, instance option attribute fields, and instance associated attribute fields, which are used to store cascading attributes, option attributes, and associated attributes, respectively. Then, a data mapping relationship is established between each type of target field in a custom data structure and the target CMDB model. Finally, according to the data mapping relationship, the target data corresponding to each target field is written into the attribute field corresponding to the target CMDB model. Thus, the target CMDB model can perform asset management on attributes with combinatorial dependencies between resources, improving the comprehensiveness of resource management and thereby improving the accuracy of subsequent decisions.
[0160] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A resource management method, characterized in that, The method includes: Obtain the target CMDB model corresponding to the target resource; The target CMDB model has multiple target attribute fields; these target attribute fields include an instance cascade attribute field, an instance option attribute field, and an instance association attribute field; the instance cascade attribute field stores the cascade attributes of the target resource, each cascade attribute including multiple option attributes, and each option attribute has a composite dependency with the association attribute of the associated resource; the instance option attribute field stores each option attribute; the instance association attribute field stores the association attribute of the associated resource corresponding to each option attribute; the associated resource is stored in the associated CMDB model. Establish a data mapping relationship between a custom data structure and the target CMDB model; the custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model; the custom data structure includes data cascading attribute fields, data option attribute fields, and data association attribute fields; the step of establishing the data mapping relationship between the custom data structure and the target CMDB model includes: mapping the data cascading attribute fields in the custom data structure to the instance cascading attribute fields in the target CMDB model; mapping the data option attribute fields in the custom data structure to the instance option attribute fields in the target CMDB model; and mapping the data association attribute fields in the custom data structure to the instance association attribute fields in the target CMDB model, thereby obtaining the data mapping relationship; Based on the data mapping relationship, the target data corresponding to each target field is written into the attribute field corresponding to the target CMDB model.
2. The method as described in claim 1, characterized in that, The steps for obtaining the target CMDB model include: A general CMDB model is established, wherein the general CMDB model includes multiple attribute fields, the attribute fields include cascading attribute fields, option attribute fields and related attribute fields, the cascading attribute fields, the option attribute fields and the related attribute fields are respectively used to store the cascading attributes of resources, each option attribute contained in the cascading attributes, and the related attributes of related resources that have a combined dependency relationship with each option attribute; Based on the general CMDB model, the target CMDB model is obtained.
3. The method as described in claim 2, characterized in that, The step of obtaining the target CMDB model based on the general CMDB model includes: Based on the general CMDB model, multiple target attribute fields are generated that correspond one-to-one with the multiple attribute fields in the general CMDB model, thus obtaining the target CMDB model.
4. The method as described in claim 1, characterized in that, Before the step of writing the target data corresponding to each target field into the corresponding attribute field according to the data mapping relationship, the method further includes: Cascaded data is identified from the data to be transformed of the target resource, wherein the cascaded data includes cascaded attribute data of the target resource, multiple option attribute data included in the cascaded attribute data, and associated attribute data of associated resources that have a combined dependency relationship with each of the option attribute data.
5. The method as described in claim 4, characterized in that, The custom data structure includes a data cascade attribute field, a data option attribute field, and a data association attribute field. The data mapping relationship includes a one-to-one mapping relationship between the data cascade attribute field, the data option attribute field, the data association attribute field, and the instance cascade attribute field, instance option attribute field, and instance association attribute field in the target CMDB model. The step of writing the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship includes: If the cascaded data does not conform to the custom data structure, then according to the custom data structure, the cascaded data is transformed so that the data cascaded attribute field, the data option attribute field, and the data association attribute field correspond to the cascaded attribute data, each option attribute data, and the association attribute data associated with each option attribute data in the cascaded data, respectively. Based on the data mapping relationship, the cascading attribute data, option attribute data, and associated attribute data corresponding to the data cascading attribute field, the data option attribute field, and the data association attribute field are respectively written into the instance cascading attribute field, the instance option attribute field, and the instance association attribute field in the target CMDB model.
6. The method as described in claim 5, characterized in that, The step of writing the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship further includes: If the cascaded data conforms to the custom data structure, then according to the data mapping relationship, the cascaded attribute data, option attribute data, and associated attribute data corresponding to the data cascaded attribute field, the data option attribute field, and the data association attribute field are respectively written into the instance cascaded attribute field, the instance option attribute field, and the instance association attribute field in the target CMDB model.
7. A resource management device, characterized in that, The device includes: The model acquisition module is used to acquire the target CMDB model corresponding to the target resource. The target CMDB model has multiple target attribute fields; these target attribute fields include an instance cascade attribute field, an instance option attribute field, and an instance association attribute field; the instance cascade attribute field stores the cascade attributes of the target resource, each cascade attribute including multiple option attributes, and each option attribute has a composite dependency with the association attribute of the associated resource; the instance option attribute field stores each option attribute; the instance association attribute field stores the association attribute of the associated resource corresponding to each option attribute; the associated resource is stored in the associated CMDB model. A data mapping relationship establishment module is used to establish a data mapping relationship between a custom data structure and the target CMDB model. The custom data structure contains multiple types of target fields, and the data mapping relationship represents the mapping relationship between all target fields and the target CMDB model. The custom data structure includes data cascading attribute fields, data option attribute fields, and data association attribute fields. Specifically, the data mapping relationship establishment module is used to: map the data cascading attribute fields in the custom data structure to the instance cascading attribute fields in the target CMDB model; map the data option attribute fields in the custom data structure to the instance option attribute fields in the target CMDB model; and map the data association attribute fields in the custom data structure to the instance association attribute fields in the target CMDB model, thereby obtaining the data mapping relationship. The data writing module is used to write the target data corresponding to each target field into the attribute field corresponding to the target CMDB model according to the data mapping relationship.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory being used to store a program, and the processor being used to implement the resource management method according to any one of claims 1-6 when executing the program.
9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the resource management method as described in any one of claims 1-6.