Equipment state monitoring method and device, equipment and storage medium
By using pre-registered routing information and interface configuration files in the Redfish interface to read device status data from the data bus, the problem of increased response time of the Redfish interface is solved and the convenience of data access and user experience are improved.
Patent Information
- Application Number
- CN202411581616.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-01-24
AI Technical Summary
When using the Redfish interface to obtain a large amount of information, multiple interfaces need to be called, resulting in an increase in the interface response time and poor user experience.
Through the pre -registered routing information, find the target interface configuration file from the preset interface configuration file, use the configuration file to read the bus data from the target data bus to the device to be monitored, generate a response message and return to the client.
It simplifies the data access process and improves the convenience of obtaining data. It obtains a large amount of data at a time through the configuration file and improves the user experience of data access.
Smart Images

Figure CN119356987A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method, device, equipment and storage medium for monitoring device status. Background Art
[0002] Redfish (a service management standard) is an interface provided to users and upper-layer application software. It can obtain all the information monitored by BMC (Baseboard Management Controller) and control BMC. The flexibility and diversity of its request body and response body have attracted much attention from users. At present, the API (Application Programming Interface) and request body and response body fields of various manufacturers are all defined with the BMC firmware version, and users cannot configure and modify them. That is, users cannot configure them without modifying the BMC firmware. When using Redfish, operation and maintenance personnel and other users are not flexible and convenient. When obtaining a large amount of information, they need to call multiple Redfish interfaces. The interface response time will also take a long time as the number and amount of redundant information obtained increase, resulting in a poor user experience and inconvenience.
[0003] It can be seen that how to optimize the data access process and improve the user experience of data access is a problem that technical personnel in this field need to solve. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a device status monitoring method, apparatus, device and storage medium, which can solve the problem that when acquiring a large amount of information, multiple Redfish interfaces are called, and the interface response time will also consume a lot of time as the number and amount of redundant information acquired increase.
[0005] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a device status monitoring method, comprising:
[0006] Obtaining the access request initiated by the client based on the target resource locator;
[0007] Based on the pre-registered routing information corresponding to the target resource locator, searching for a corresponding target interface configuration file from a preset interface configuration file; the interface configuration file includes a resource locator, first field information representing an interface format, and second field information representing an interface response body format bound to the first field information;
[0008] Utilizing the second field information in the target interface configuration file, corresponding bus data is read from the target data bus of the device to be monitored, a corresponding response message is generated based on the read bus data, and the response message is returned to the client; the bus data includes status data of the device to be monitored.
[0009] Optionally, before obtaining the access request initiated by the client based on the target resource locator, the method further includes:
[0010] Obtaining parameter configuration instructions for configuring the application programming interface through a preset configuration interface; the parameter configuration instructions include configuration instructions for resource locators, request methods, request bodies, and formats of various fields of response bodies;
[0011] The interface configuration files corresponding to the application programming interfaces are configured based on the parameter configuration instructions to obtain interface configuration files corresponding to each of the application programming interfaces.
[0012] Optionally, the parameter configuration instruction is a first parameter configuration instruction for creating a new interface configuration file;
[0013] Accordingly, configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction includes:
[0014] configuring a new interface configuration file corresponding to the application programming interface based on the first parameter configuration instruction;
[0015] The new routing information corresponding to the new interface configuration file is registered using the resource identifier corresponding to the new interface configuration file.
[0016] Optionally, the parameter configuration instruction is a second parameter configuration instruction for modifying an interface configuration file;
[0017] Accordingly, configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction includes:
[0018] Modify the original interface configuration file based on the second parameter configuration instruction to obtain a modified interface configuration file;
[0019] The original routing information corresponding to the original interface configuration file is deleted, and the new routing information corresponding to the modified interface configuration file is registered using the resource identifier corresponding to the modified interface configuration file.
[0020] Optionally, before reading corresponding bus data from the target data bus, the method further includes:
[0021] Determine the monitored object in the monitored device;
[0022] The real-time status data of the object to be monitored is collected through a data collection thread and / or process, and the real-time status data is saved to the target data bus to obtain bus data of the target data bus.
[0023] Optionally, collecting the real-time status data of the object to be monitored through a data collection thread and / or process, and saving the real-time status data to the target data bus to obtain bus data of the target data bus, includes:
[0024] Determine the current components to be monitored and the services to be monitored in the device to be monitored according to the preset list to be monitored, and create a data acquisition thread and / or process for acquiring real-time status data of the components to be monitored and the services to be monitored;
[0025] Based on a preset data collection cycle, the status data of each component to be monitored and each service to be monitored are collected using the data collection thread and / or process to obtain real-time status data of each component to be monitored and each service to be monitored;
[0026] Or, when it is monitored that the device to be monitored triggers an event that meets the preset state change condition, the state data of each component to be monitored and each service to be monitored in the device to be monitored are collected respectively through the data collection thread and / or process to obtain the real-time state data of each component to be monitored and each service to be monitored;
[0027] The real-time state data collected is saved to the target data bus to obtain bus data of the target data bus;
[0028] Accordingly, the method further includes:
[0029] If the bus data in the target data bus changes, a corresponding data change notification is triggered.
[0030] Optionally, using the second field information in the target interface configuration file to read corresponding bus data from a target data bus of the device to be monitored, and generating a corresponding response message based on the read bus data includes:
[0031] Reading a plurality of bus data matching the second field information in the target interface configuration file from the target data bus of the device to be monitored;
[0032] The plurality of bus data are used to form a response body file that matches the interface response body format corresponding to the second field information, and the response body file is assembled into a message form based on a preset message format to obtain a corresponding response message.
[0033] In a second aspect, the present application provides a device status monitoring device, comprising:
[0034] An access request acquisition module, used to acquire an access request initiated by a client based on a target resource locator;
[0035] A configuration file search module, used to search for a corresponding target interface configuration file from a preset interface configuration file based on pre-registered routing information corresponding to the target resource locator; the interface configuration file includes a resource locator, first field information representing an interface format, and second field information representing an interface response body format bound to the first field information;
[0036] A message generation module is used to use the second field information in the target interface configuration file to read corresponding bus data from the target data bus of the device to be monitored, generate a corresponding response message based on the read bus data, and return the response message to the client; the bus data includes status data of the device to be monitored.
[0037] In a third aspect, the present application provides an electronic device, including:
[0038] Memory for storing computer programs;
[0039] A processor is used to execute the computer program to implement the steps of the above-mentioned device status monitoring method.
[0040] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned device status monitoring method are implemented.
[0041] As can be seen from the above technical solution, the present application first obtains the access request initiated by the client based on the target resource locator; then, based on the pre-registered routing information corresponding to the target resource locator, the corresponding target interface configuration file is searched from the preset interface configuration file; the interface configuration file includes the resource locator, the first field information representing the interface format, and the second field information representing the interface response body format bound to the first field information; then, using the second field information in the target interface configuration file, the corresponding bus data is read from the target data bus of the device to be monitored, the corresponding response message is generated based on the read bus data, and the response message is returned to the client; the bus data includes the status data of the device to be monitored. In this way, the present application can pre-set the configuration file and routing information corresponding to the application programming interface, and the status information of the currently monitored device can be saved to the data bus. The bus data used to respond to the access request can be directly obtained from the data bus through the configuration file, so that the data access process is simplified through the configuration file corresponding to the application programming interface, and the status data of the device to be monitored is saved through the data bus, which improves the convenience of obtaining data, and a large amount of data can be obtained at a time through the configuration file, which improves the user experience of data access. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A flow chart of a device status monitoring method disclosed in this application;
[0044] Figure 2 A flow chart of a specific device status monitoring method disclosed in this application;
[0045] Figure 3 Another specific flow chart of the device status monitoring method disclosed in this application;
[0046] Figure 4 A flow chart of a specific device status monitoring method disclosed in this application;
[0047] Figure 5 This is a schematic diagram of the structure of a device status monitoring device disclosed in this application;
[0048] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0051] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0052] like Figure 1 As shown, the embodiment of the present application discloses a device status monitoring method, including:
[0053] Step S11: Obtain an access request initiated by the client based on the target resource locator.
[0054] In the embodiment of the present application, before obtaining the access request initiated by the client based on the target resource locator, it can also include: obtaining parameter configuration instructions for configuring the application programming interface through a preset configuration interface; the parameter configuration instructions include configuration instructions for each field format of the resource locator, request method, request body and response body; configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instructions to obtain the interface configuration file corresponding to each of the application programming interfaces. It can be understood that before obtaining the access request, it is necessary to first issue the interface configuration file for configuring the application programming interface, and specifically, the corresponding parameter configuration instructions can be obtained through the preset configuration interface, and the parameter configuration instructions can configure the interface configuration file corresponding to the application programming structure; further, the parameter configuration instruction can be used to configure the resource locator, request method, request body and response body The format of each field, based on the parameter configuration instruction, the interface configuration file corresponding to the application programming interface can be configured. Correspondingly, the interface configuration file corresponding to each application programming interface contains the resource locator, request method, request body and response body. The format of each field. It can be understood that the interface configuration file can be found through the resource locator, and the field format of the response body can be used to obtain data in response to the access request initiated by the user; further, the user can initiate a data access request for the resource locator through the client, so as to obtain relevant data through the corresponding interface configuration file to respond to the access request.
[0055] In a specific embodiment, the parameter configuration instruction is a first parameter configuration instruction for creating a new interface configuration file; accordingly, the configuration of the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction may include: configuring a new interface configuration file corresponding to the application programming interface based on the first parameter configuration instruction; registering new routing information corresponding to the new interface configuration file using a resource identifier corresponding to the new interface configuration file. Specifically, the parameter configuration instruction may be used to create a new application programming interface, and a new interface configuration file corresponding to the application programming interface is created through the first parameter configuration instruction. The new interface configuration file contains a resource identifier, and the resource identifier can be used to register new routing information corresponding to the new interface configuration file; it can be understood that the application programming interface corresponding to the new interface configuration file after the routing information is registered can be accessed by the outside world.
[0056] In another specific embodiment, the parameter configuration instruction is a second parameter configuration instruction for modifying an interface configuration file; accordingly, configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction may include: modifying the original interface configuration file based on the second parameter configuration instruction to obtain a modified interface configuration file; deleting the original routing information corresponding to the original interface configuration file, and registering the new routing information corresponding to the modified interface configuration file using the resource identifier corresponding to the modified interface configuration file. Specifically, the parameter configuration instruction may be an instruction to modify an interface configuration file corresponding to an existing application programming interface, modifying the original interface configuration file through the second parameter configuration instruction to obtain a modified interface configuration file; and the routing information corresponding to the resource identifier of the original interface configuration file needs to be deleted, and a new routing information needs to be registered according to the resource identifier of the modified interface configuration file.
[0057] In a specific embodiment, before reading the corresponding bus data from the target data bus, it may also include: determining the monitored object in the monitored device; collecting the real-time status data of the monitored object through the data acquisition thread and / or process, and saving the real-time status data to the target data bus to obtain the bus data of the target data bus. It can be understood that before reading the status data of the device from the data bus according to the interface configuration file, the status data of the device needs to be stored in the data bus; specifically, the device needs to be monitored first to determine the monitored object in the device, and then the real-time status data of each monitored object in the device can be collected through the data acquisition thread and / or process; and then the collected real-time status data is stored in the data bus, so as to facilitate the subsequent reading of relevant data from the data bus through the interface configuration file.
[0058] In another specific embodiment, the real-time status data of the monitored object is collected through a data collection thread and / or process, and the real-time status data is saved to the target data bus to obtain bus data of the target data bus, which may include: determining each current monitored component and each monitored service in the monitored device according to a preset monitored list, and creating a data collection thread and / or process for collecting real-time status data of each monitored component and each monitored service; based on a preset data collection cycle, using the data collection thread and / or process to collect status data of each monitored component and each monitored service, respectively, to obtain To obtain the real-time status data of each component to be monitored and each service to be monitored; or, when the monitored device triggers an event that meets the preset status change conditions, the status data of each component to be monitored and each service to be monitored in the monitored device are collected through the data collection thread and / or process respectively, so as to obtain the real-time status data of each component to be monitored and each service to be monitored; the collected real-time status data is saved to the target data bus to obtain the bus data of the target data bus; accordingly, the method also includes: if the bus data in the target data bus changes, then trigger the corresponding data change notification. Specifically, in the process of monitoring the device and collecting the corresponding status data, it is first necessary to determine the several components and several services that need to be monitored in the monitored device, and obtain the devices to be monitored and the services to be monitored; because the components or services to be monitored are different, the information to be collected is also different, so data collection threads or processes for collecting the real-time status data of each component to be monitored or each service to be monitored can be created respectively, and the relevant status data can be monitored and obtained in real time in a targeted manner. Furthermore, the data collection methods can also be divided into two types. One is to regularly use the relevant data collection threads or processes to collect the status data of each device to be monitored or each service to be monitored based on the pre-set data collection cycle, so as to collect the corresponding real-time status data; the second is to collect the relevant changed status data according to the status change of each component to be monitored and each service to be monitored. For example, when the monitored device triggers certain status change events, such as power on / off, service restart and other events, data collection when the status data changes can reduce the consumption of collection resources; through these two methods, the real-time status information of each component to be monitored and each service to be monitored can be obtained, and then the collected real-time status data is stored in the pre-set data bus, and the data bus uniformly saves the real-time status data of the device, so as to directly obtain the relevant data from the data bus through the interface configuration file. In addition, when the data in the data bus is updated, the corresponding data change notification can be triggered, so as to read the real-time status data from the data bus through the interface configuration file.In a specific embodiment, the bus can complete the storage and acquisition of monitored data and interface configuration files, and send a signal of attribute change when the data in the Dbus (data bus) changes, so as to facilitate Redfish monitoring and reduce resource consumption.
[0059] In a specific embodiment, Figure 2 As shown in the figure, on the left is the monitoring and updating of data such as components and BMC services, and on the right is the generation and updating of the Redfish API configuration file through the web (webpage) or Redfish. After the Redfish module monitors the signal of the change of the Redfish API configuration file, it completes the loading of dynamic routes and the inspection and preloading of data structures for the configured API. Users can use the Redfish interface corresponding to the configuration file to access or set certain BMC service information and status, which is achieved by updating the corresponding attributes of Dbus.
[0060] Specifically, you can view and configure the parameters of the API automatically generated by Redfish on the BMC web page, or you can view and configure related parameters directly through Redfish. The web configuration has better visualization effects, and Redfish configuration can be more conveniently batch operated using scripts and other tools. The parameters that need to be configured are URL, request method, json fields in the request body and response body, and the Dbus Service, Path, Interface, and Property corresponding to the json fields. In order to facilitate users to view the configuration, both Web and Redfish can query the corresponding relationship of parameter configuration. The configuration file corresponding to the API uses the json format. The SNMP (Simple Network Management Protocol) service custom response body is used as a reference example. The URL (Uniform ResourceLocator) is a custom URL and is a required field. @odata.id and @odata.type are also required fields. @odata.type is the version of the schema, which is a specification-required field. @odata.id is the URI (Uniform Resource Identifier) of the current resource. AdapterName, CPLDVersion, BIOSVersion, and VendorID are custom fields. Their key values are Netfunction, cmd, index of the structure, structure, and structure member monitored by the component in the database (data bus).
[0061] {
[0062] "URL":" / redfish / v1 / OemServices / SnmpService",
[0063] "@odata.id":" / redfish / v1 / OemServices / SnmpService",
[0064] "@odata.type":"#OemSnmpService.v1_1_0.SnmpService ",
[0065] "SnmpV3Enable":"xyz.openbmc.Network.SNMP / xyz / openbmc / network / snmp / manager / SNMPGetConf Network.SNMPConf. SNMPGetConf SnmpV3Enable",
[0066] "SnmpV3AuthProtocol":"xyz.openbmc.Network.SNMP / xyz / openbmc / network / snmp / manager / SNMPGetConf Network.SNMPConf. SNMPGetConfSnmpV3AuthProtocol",
[0067] "SnmpV3PrivProtocol":"xyz.openbmc.Network.SNMP / xyz / openbmc / network / snmp / manager / SNMPGetConf Network.SNMPConf. SNMPGetConfSnmpV3PrivProtocol",
[0068] "SnmpV3AuthUserName":"xyz.openbmc.Network.SNMP / xyz / openbmc / network / snmp / manager / SNMPGetConf Network.SNMPConf. SNMPGetConf SnmpV3AuthUserName "
[0069] …
[0070] }
[0071] Furthermore, when updating the interface configuration file corresponding to the API, the Redfish module monitors whether there is a new addition or change in the original configuration file. The Redfish module will register a new route in the Redfish module for the URI in the configuration file according to the changed configuration file. If the route is not registered, the outside world cannot access the interface. If the configuration file is a new file, a new route is registered in the Redfish module. If the configuration file is a modified file, the Redfish module deletes the original route and registers a new route so that the corresponding interface configuration file can be found through the route later.
[0072] like Figure 3 As shown in the figure, the monitoring process of components and other BMC services can create different threads or processes according to the different principles and mechanisms of the information to be obtained, monitor and obtain the required information in real time, and complete the acquisition and update of corresponding attributes through Dbus; specifically, it can include network card monitoring, Raid (Redundant Array of IndependentDisks) monitoring, SNMP service monitoring and SMTP (Simple Mail Transfer Protocol); the information to be obtained can be divided into dynamic information and static information, and the dynamic information can be updated by polling at fixed intervals, and updated at certain intervals; while the static information is updated only when the information changes (such as system power on and off, restarting BMC, starting and restarting the service to be monitored, etc.), and this update method can reduce resource consumption and improve resource utilization. The updating of Dbus attributes is to determine its unique Property through the Service, Path, Interface, and Property corresponding to the monitored information, and update the corresponding Property of the bus.
[0073] Step S12: based on the pre-registered routing information corresponding to the target resource locator, search for the corresponding target interface configuration file from the preset interface configuration file; the interface configuration file includes a resource locator, first field information representing an interface format, and second field information representing an interface response body format bound to the first field information.
[0074] In the present application, after obtaining the access request initiated by the user through the client through the above steps, the pre-registered routing information can be found according to the corresponding resource locator, and the corresponding target interface configuration file can be found from the interface configuration files of several pre-set application programming interfaces through the routing information; it can be understood that the target interface configuration file contains first field information representing the interface format and second field information of the corresponding interface response body format, that is, the target interface configuration file defines the data format in the process of interaction with the user, as well as the format of the response body for responding to the access request and related field information; the corresponding data can be obtained through the second field information of the response body format, so as to respond to the access request through the obtained data.
[0075] Step S13, using the second field information in the target interface configuration file, reading corresponding bus data from the target data bus of the device to be monitored, generating a corresponding response message based on the read bus data, and returning the response message to the client; the bus data includes status data of the device to be monitored.
[0076] In the embodiment of the present application, the target interface configuration file corresponding to the access request can be obtained through the above steps; it can be understood that the target interface configuration file contains the second field information of the response body format for responding to the access request, and the corresponding bus data can be read from the preset target data bus through the second field information. Further, the preset target data bus is used to store the status data of the monitored device; in other words, the corresponding status data corresponding to the device to be monitored can be obtained from the data bus through the second field information in the interface configuration file. It should be pointed out that the present application constructs a binding relationship between the data field in the bus and the field of the response body through the interface configuration file, and the status data corresponding to the device can be obtained from the bus through the interface configuration file. After that, the data obtained from the bus can be organized into a message format to obtain a response message, so as to send the response message to the client, complete the call of the application programming interface corresponding to the interface configuration file, and obtain the status data of the device.
[0077] In a specific embodiment, the method of using the second field information in the target interface configuration file to read the corresponding bus data from the target data bus of the device to be monitored and generating the corresponding response message based on the read bus data may include: reading a number of bus data matching the second field information in the target interface configuration file from the target data bus of the device to be monitored; using the several bus data to form a response body file matching the interface response body format corresponding to the second field information, and assembling the response body file into a message form based on a preset message format to obtain a corresponding response message. Specifically, in the process of reading the corresponding bus data from the data bus through the interface configuration file and generating a response message for feedback of the access request, first, a number of bus data matching the second field information in the target interface configuration file is read from the data bus, that is, a number of bus data corresponding to the response body is read, and then the interface response body format of the target interface configuration file is used to form a response body file matching the target interface configuration file; further, in order to respond to the access request initiated by the user through the client, the response body file needs to be assembled into a message format to obtain a response message; then the response message can be sent to the client to complete the data access process.
[0078] In another specific embodiment, when a user initiates an access request, after the corresponding target bus data is obtained through the interface configuration file corresponding to the API, and before the target bus data is updated, the target bus data can be saved separately in a target area, so that when the user's access request is obtained again before the target bus data is updated, there is no need to look up the relevant interface configuration file, and the target bus data in the target area can be directly used to respond to the access request.
[0079] It can be seen that the present application can pre-set the configuration file and routing information corresponding to the application programming interface, and can save the status information of the currently monitored device to the data bus. The bus data used to respond to the access request can be directly obtained from the data bus through the configuration file. In this way, the data access process is simplified through the configuration file corresponding to the application programming interface, and the status data of the monitored device is saved through the data bus, which improves the convenience of obtaining data. The data in the bus can be combined through the configuration file to obtain a large amount of data at a single time, thereby improving the user experience of data access.
[0080] like Figure 4 As shown, the embodiment of the present application discloses a device status monitoring method, which specifically includes:
[0081] In the embodiment of the present application, the configuration file of the API needs to be configured first. The viewing and configuration of the API parameters automatically generated by Redfish can be completed on the web page of the BMC, or the relevant parameters can be viewed and configured directly through Redfish. The web configuration has a better visualization effect, and the Redfish configuration can be more convenient to perform batch operations using tools such as scripts. The parameters that need to be configured are the URL, request method, json fields in the request body and response body, and the Service, Path, Interface, and Property of Dbus corresponding to the json fields. Furthermore, when the Redfish module monitors that there are new or existing configuration files, it will register a new route in the Redfish module with the URI in the configuration file according to the changed configuration file. If the route is not registered, the outside world cannot access the interface. If the configuration file is a newly added file, a new route is registered in the Redfish module. If the configuration file is a modified file, the Redfish module deletes the original route and registers a new route.
[0082] Correspondingly, component monitoring and other BMC services can monitor and obtain the required information in real time, and complete the acquisition and update of corresponding attributes through Dbus. Users can initiate access requests through the client to access the BMC Redfish server. The server finds the route registered in the corresponding Redfish module according to the accessed URL, and finds the corresponding API interface configuration file through the route; according to the configuration information in the file, the information related to the API in the bus can be obtained, specifically by reading the Dbus attributes to obtain the response data of the API corresponding to the interface configuration file for responding to the access request; and the response body json of this API needs to be composed according to the json fields configured in the interface configuration file, and the json composed message is sent to the client. After the client receives the message and parses it, the response data of the API corresponding to the interface configuration file for the initiated access request can be obtained.
[0083] It can be seen from this that the present application can use Dbus as a storage medium, and according to the nature and characteristics of Dbus, complete the monitoring of components or BMC services and the storage and acquisition of configuration files related to the Redfish API, and update and generate the interface configuration files corresponding to the API through Redfish and the web to build a binding relationship between the Dbus fields and the fields in the API; the present application can combine the low latency and low overhead characteristics of Dbus, and adopt a mechanism triggered by user access to pass the API-related data corresponding to the interface configuration file to ensure the timeliness of the data.
[0084] like Figure 5 As shown, the embodiment of the present application discloses a device for monitoring the state of an equipment, comprising:
[0085] An access request acquisition module 11, used to acquire an access request initiated by a client based on a target resource locator;
[0086] The configuration file search module 12 is used to search for the corresponding target interface configuration file from the preset interface configuration file based on the pre-registered routing information corresponding to the target resource locator; the interface configuration file includes the resource locator, the first field information representing the interface format, and the second field information representing the interface response body format bound to the first field information;
[0087] The message generation module 13 is used to use the second field information in the target interface configuration file to read the corresponding bus data from the target data bus of the device to be monitored, generate a corresponding response message based on the read bus data, and return the response message to the client; the bus data includes the status data of the device to be monitored.
[0088] It can be seen that the present application can pre-set the configuration file and routing information corresponding to the application programming interface, and can save the status information of the currently monitored device to the data bus. The bus data used to respond to the access request can be directly obtained from the data bus through the configuration file. In this way, the data access process is simplified through the configuration file corresponding to the application programming interface, and the status data of the monitored device is saved through the data bus, which improves the convenience of obtaining data. A large amount of data can be obtained at a time through the configuration file, thereby improving the user experience of data access.
[0089] In a specific embodiment, the device may further include:
[0090] A parameter configuration instruction acquisition module, used to acquire parameter configuration instructions for configuring the application programming interface through a preset configuration interface; the parameter configuration instructions include configuration instructions for the resource locator, request method, request body and response body field formats;
[0091] The file configuration module is used to configure the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction to obtain the interface configuration file corresponding to each of the application programming interfaces.
[0092] In another specific embodiment, the file configuration module may include:
[0093] A first file configuration unit, configured to configure a new interface configuration file corresponding to the application programming interface based on a first parameter configuration instruction;
[0094] The first routing registration unit is used to register the new routing information corresponding to the new interface configuration file by using the resource identifier corresponding to the new interface configuration file.
[0095] In another specific embodiment, the file configuration module may include:
[0096] A second file configuration unit, used to modify the original interface configuration file based on the second parameter configuration instruction to obtain a modified interface configuration file;
[0097] The second routing registration unit is used to delete the original routing information corresponding to the original interface configuration file, and register the new routing information corresponding to the modified interface configuration file using the resource identifier corresponding to the modified interface configuration file.
[0098] In a specific embodiment, the device may further include:
[0099] A module for determining the corresponding object to be monitored, used to determine the object to be monitored in the device to be monitored;
[0100] The status data acquisition module is used to acquire the real-time status data of the monitored object through a data acquisition thread and / or process, and save the real-time status data to the target data bus to obtain the bus data of the target data bus.
[0101] In another specific embodiment, the state data acquisition module may include:
[0102] A thread and / or process creation unit, used to determine the current components to be monitored and the services to be monitored in the device to be monitored according to a preset list to be monitored, and to create a data acquisition thread and / or process for acquiring real-time status data of the components to be monitored and the services to be monitored;
[0103] A first data acquisition unit, configured to respectively acquire status data of each component to be monitored and each service to be monitored by using the data acquisition thread and / or process based on a preset data acquisition cycle, so as to obtain real-time status data of each component to be monitored and each service to be monitored;
[0104] A second data acquisition unit is used to collect the status data of each component to be monitored and each service to be monitored in the device to be monitored through the data acquisition thread and / or process when it is monitored that the device to be monitored triggers an event that meets the preset state change condition, so as to obtain the real-time status data of each component to be monitored and each service to be monitored;
[0105] A data storage unit, used for storing the collected real-time status data to the target data bus to obtain bus data of the target data bus;
[0106] Accordingly, the device may further include:
[0107] The change notification module is used to trigger a corresponding data change notification when the bus data in the target data bus changes.
[0108] In a specific embodiment, the message generation module 13 may include:
[0109] A data reading unit, used for reading a number of bus data matching the second field information in the target interface configuration file from a target data bus of the device to be monitored;
[0110] The message generation unit is used to use the plurality of bus data to form a response body file that matches the interface response body format corresponding to the second field information, and assemble the response body file into a message form based on a preset message format to obtain a corresponding response message.
[0111] Furthermore, the present application also discloses an electronic device. Figure 6 It is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the device status monitoring method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0112] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0113] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0114] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the device status monitoring method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0115] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed device status monitoring method. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0116] An embodiment of the present application discloses a computer program product, including a computer program / instruction, which implements the steps of the aforementioned device status monitoring method when executed by a processor.
[0117] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0118] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0119] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0120] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0121] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A device status monitoring method, characterized in that: include: Obtaining the access request initiated by the client based on the target resource locator; Based on the pre-registered routing information corresponding to the target resource locator, searching for a corresponding target interface configuration file from a preset interface configuration file; The interface configuration file includes a resource locator, first field information representing an interface format, and second field information representing an interface response body format bound to the first field information; Utilizing the second field information in the target interface configuration file, corresponding bus data is read from the target data bus of the device to be monitored, a corresponding response message is generated based on the read bus data, and the response message is returned to the client; the bus data includes status data of the device to be monitored.
2. The device status monitoring method according to claim 1, characterized in that: Before obtaining the access request initiated by the client based on the target resource locator, the method further includes: Obtaining parameter configuration instructions for configuring the application programming interface through a preset configuration interface; the parameter configuration instructions include configuration instructions for resource locators, request methods, request bodies, and formats of various fields of response bodies; The interface configuration files corresponding to the application programming interfaces are configured based on the parameter configuration instructions to obtain interface configuration files corresponding to each of the application programming interfaces.
3. The device status monitoring method according to claim 2, characterized in that: The parameter configuration instruction is a first parameter configuration instruction for creating a new interface configuration file; Accordingly, configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction includes: configuring a new interface configuration file corresponding to the application programming interface based on the first parameter configuration instruction; The new routing information corresponding to the new interface configuration file is registered using the resource identifier corresponding to the new interface configuration file.
4. The device status monitoring method according to claim 2, characterized in that: The parameter configuration instruction is a second parameter configuration instruction for modifying an interface configuration file; Accordingly, configuring the interface configuration file corresponding to the application programming interface based on the parameter configuration instruction includes: Modify the original interface configuration file based on the second parameter configuration instruction to obtain a modified interface configuration file; The original routing information corresponding to the original interface configuration file is deleted, and the new routing information corresponding to the modified interface configuration file is registered using the resource identifier corresponding to the modified interface configuration file.
5. The device status monitoring method according to claim 1, characterized in that: Before reading the corresponding bus data from the target data bus, the method further includes: Determine the monitored object in the monitored device; The real-time status data of the object to be monitored is collected through a data collection thread and / or process, and the real-time status data is saved to the target data bus to obtain bus data of the target data bus.
6. The device status monitoring method according to claim 5, characterized in that: The real-time status data of the object to be monitored is collected through a data collection thread and / or process, and the real-time status data is saved to the target data bus to obtain bus data of the target data bus, including: Determine the current components to be monitored and the services to be monitored in the device to be monitored according to the preset list to be monitored, and create a data acquisition thread and / or process for acquiring real-time status data of the components to be monitored and the services to be monitored; Based on a preset data collection cycle, the status data of each component to be monitored and each service to be monitored are collected using the data collection thread and / or process to obtain real-time status data of each component to be monitored and each service to be monitored; Or, when it is monitored that the device to be monitored triggers an event that meets the preset state change condition, the state data of each component to be monitored and each service to be monitored in the device to be monitored are collected respectively through the data collection thread and / or process to obtain the real-time state data of each component to be monitored and each service to be monitored; The real-time state data collected is saved to the target data bus to obtain bus data of the target data bus; Accordingly, the method further includes: If the bus data in the target data bus changes, a corresponding data change notification is triggered.
7. The device status monitoring method according to any one of claims 1 to 6, characterized in that: The using the second field information in the target interface configuration file to read corresponding bus data from the target data bus of the device to be monitored, and generating a corresponding response message based on the read bus data, comprises: Reading a plurality of bus data matching the second field information in the target interface configuration file from the target data bus of the device to be monitored; The plurality of bus data are used to form a response body file that matches the interface response body format corresponding to the second field information, and the response body file is assembled into a message form based on a preset message format to obtain a corresponding response message.
8. A device for monitoring equipment status, characterized in that: include An access request acquisition module, used to acquire an access request initiated by a client based on a target resource locator; A configuration file search module, configured to search for a corresponding target interface configuration file from preset interface configuration files based on pre-registered routing information corresponding to the target resource locator; The interface configuration file includes a resource locator, first field information representing an interface format, and second field information representing an interface response body format bound to the first field information; A message generation module is used to use the second field information in the target interface configuration file to read corresponding bus data from the target data bus of the device to be monitored, generate a corresponding response message based on the read bus data, and return the response message to the client; the bus data includes status data of the device to be monitored.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program to implement the steps of the device status monitoring method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the device status monitoring method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Server hard disk state monitoring method and device, equipment and storage medium
CN120123180A
Request processing method, storage medium, electronic equipment and program product
CN120371760A
Request processing method, storage medium, electronic device and program product
CN120371760B