Disclosure of Invention
The embodiment of the application aims to provide an energy consumption monitoring method, an energy consumption monitoring device, a server and a computer readable storage medium, which can improve the efficiency of monitoring the power consumption of equipment in an internet data center machine room and facilitate an administrator to timely control the energy consumption of corresponding equipment in the machine room.
In order to achieve the above object, an embodiment of the present application is achieved by:
in a first aspect, an embodiment of the present application provides an energy consumption monitoring method, where the method includes: receiving an acquisition request sent by a user terminal; acquiring target power consumption data of target equipment from a preset database, wherein the target equipment is at least one electronic equipment corresponding to the acquisition request in an internet data center, and the preset database is used for storing all power consumption data of each electronic equipment in the internet data center; and sending the target power consumption data of the target equipment to the user terminal.
In the above embodiment, all the power consumption data of each electronic device in the internet data center are stored by using the preset database, and when the corresponding power consumption data needs to be acquired through the user terminal, the server already stores all the power consumption data, so that after receiving the acquisition request of the user terminal, the server does not need to acquire the power consumption data from the internet data center based on the acquisition request of the user terminal, but directly acquires the corresponding power consumption data from the preset database, thereby being beneficial to improving the efficiency of acquiring the power consumption data, realizing asynchronous acquisition of the power consumption and being beneficial to realizing automatic monitoring of the power consumption of each device in the internet data center.
With reference to the first aspect, in some optional embodiments, the preset database includes a first database and a second database;
obtaining target power consumption data of target equipment from a preset database, wherein the target power consumption data comprises:
The target power consumption data of the target device is obtained from the first database and/or the second database, the first database is used for storing all power consumption data of each electronic device in the internet data center, the second database is used for storing current power consumption data of each electronic device in the internet data center, and the target power consumption data comprises at least one of power consumption data of the target device in the first database and current power consumption data in the second database.
In the above-described embodiment, all the power consumption data is stored with the first database, and the current power consumption data is stored separately with the second database, so that the amount of data in the second database is much smaller than that of the first database. When the user needs to acquire the current power consumption data of the target device, the current power consumption data can be directly acquired from the second database, so that the quick acquisition of the current power consumption data is facilitated, and the efficiency of acquiring the current power consumption data is improved.
With reference to the first aspect, in some optional embodiments, before receiving the acquisition request sent by the user terminal, the method further includes:
Acquiring current power consumption data of each electronic device in the internet data center according to a preset period;
And storing the current power consumption data of each electronic device in the second database.
In the above embodiment, the current power consumption data of each device in the internet data center is periodically acquired and stored in the second database, so that the timeliness of the power consumption data stored in the second database is improved.
With reference to the first aspect, in some optional implementations, after the acquiring the current power consumption data of each electronic device in the internet data center according to the preset period and before the storing the current power consumption data of each electronic device in the second database, the method further includes:
And deleting the power consumption data stored in the second database.
In the above embodiment, by deleting the power consumption data stored in the second database last time, it is possible to ensure that the power consumption data stored in the second database are all the current latest power consumption data.
With reference to the first aspect, in some optional embodiments, obtaining target power consumption data of a target device from the first database and/or the second database includes:
obtaining all power consumption data of the target equipment in a preset duration from the first database through Redis, and/or
Obtaining current power consumption data of the target device from the second database through Redis, wherein the target power consumption data comprises at least one of all power consumption data of the target device within a preset duration and the current power consumption data of the target device.
In the above embodiment, the Redis is a memory-based database, and the target power consumption data is obtained through the Redis, which is beneficial to improving the speed of reading the target power consumption data.
With reference to the first aspect, in some optional implementations, sending the target power consumption data of the target device to the user terminal includes:
And sending the maximum rated power consumption data and the current power consumption data of the target equipment included in the target power consumption data to the user terminal so that the user terminal displays the maximum rated power consumption data and the current power consumption data through Web.
In the embodiment, the user terminal displays the target power consumption data, so that an administrator can conveniently and intuitively check the power consumption conditions of various devices, and the remote monitoring of the power consumption of the devices is facilitated.
With reference to the first aspect, in some optional embodiments, the method further includes:
And when the target equipment does not execute tasks or the current power consumption data of the target equipment is larger than the maximum rated power consumption, controlling the target equipment to stop running.
In the embodiment, when the target device does not execute the task or the current power consumption data is larger than the maximum rated power consumption, the target device is controlled to stop running, so that the power consumption of the internet data center can be reduced, and the overload condition of the target device is avoided.
In a second aspect, the present application also provides an energy consumption monitoring device, the device comprising:
the receiving unit is used for receiving the acquisition request sent by the user terminal;
The power consumption acquisition unit is used for acquiring target power consumption data of target equipment from a preset database, wherein the target equipment is at least one electronic equipment corresponding to the acquisition request in an internet data center, and the preset database is used for storing all power consumption data of each electronic equipment in the internet data center;
and the sending unit is used for sending the target power consumption data of the target equipment to the user terminal.
In a third aspect, the present application also provides a server, including a processor and a memory coupled to each other, where the memory stores a computer program, which when executed by the processor, causes the server to perform the method described above.
In a fourth aspect, the present application also provides a computer readable storage medium having a computer program stored therein, which when run on a computer causes the computer to perform the above-described method.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. It should be noted that the terms "first," "second," and the like are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance. The following embodiments and features of the embodiments may be combined with each other without conflict.
Referring to fig. 1, the present application provides a server 10, where the server 10 may establish a communication connection with each electronic device 21 in the internet data center 20 (INTERNET DATA CENTER, IDC) through a network for data interaction, for example, the server 10 may monitor the energy consumption of each electronic device 21 in the internet data center 20 (INTERNET DATA CENTER, IDC). For example, the electronic device 21 may store and record its own power consumption data in its own specified file, and when the server 10 needs to acquire the power consumption data of the electronic device 21, the electronic device 21 may send the stored and recorded power consumption data from the specified file to the server 10. The specified file may be flexibly set according to actual situations, for example, the specified file may be a log file for storing power consumption data.
The server 10 may also establish a communication connection with the user terminal 30 over a network for data interaction. For example, an administrator may obtain the power consumption of each electronic device 21 in the internet data center 20 from the server 10 through the user terminal 30.
The internet data center 20 may provide the clients with internet basic platform services, various value added services (such as database services and data backup services), and the number and types of the electronic devices 21 included in the internet data center 20 may be flexibly determined according to actual situations. For example, the electronic device 21 may be, but is not limited to, a host device, a rack-mounted server, or the like.
Referring to fig. 2, the server 10 may include a processing module 11 and a storage module 12. The storage module 12 stores a computer program which, when executed by said processing module 11, enables the server 10 to perform the steps of the energy consumption monitoring method described below. The computer program corresponding to the energy consumption monitoring method can be realized by an MVC (Model View Controller, model interface controller) architecture based on an Egg framework. The Egg framework is a Web application framework of open source codes, and is convenient for the expansion of function plug-ins.
It should be noted that the server 10 may further include other modules, for example, the server 10 may further include a communication module 13. The processing module 11, the storage module 12 and the communication module 13 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
Referring to fig. 3, the embodiment of the present application further provides an energy consumption monitoring method, which can be applied to the above-mentioned server 10, and the steps of the method are executed or implemented by the server 10. The method may comprise the steps of:
Step S110, receiving an acquisition request sent by a user terminal;
Step S120, acquiring target power consumption data of target equipment from a preset database, wherein the target equipment is at least one electronic equipment corresponding to the acquisition request in an Internet data center, and the preset database is used for storing all power consumption data of each electronic equipment in the Internet data center;
And step S130, the target power consumption data of the target equipment is sent to the user terminal.
In the above embodiment, all the power consumption data of each electronic device in the internet data center are stored by using the preset database, and when the corresponding power consumption data needs to be acquired through the user terminal, the server 10 already stores all the power consumption data, so that after receiving the acquisition request of the user terminal, the server 10 does not need to acquire the power consumption data from the internet data center based on the acquisition request of the user terminal, but directly acquires the corresponding power consumption data from the preset database, thereby being beneficial to improving the efficiency of acquiring the power consumption data, realizing asynchronous acquisition of the power consumption and being beneficial to realizing automatic monitoring of the power consumption of each device in the internet data center.
The steps of the method will be described in detail below, as follows:
in step S110, the user terminal may transmit an acquisition request to the server 10, so that the server 10 responds to the acquisition request when receiving the acquisition request. Wherein the acquisition request is for acquiring target power consumption data of the target device from the server 10. The user terminal may be, but is not limited to, a personal computer, a smart phone, etc.
The target equipment can be one or more electronic equipment in an internet data center room, and can be flexibly determined according to actual conditions. For example, the target device may be all electronic devices in the machine room. The target power consumption data may include, but is not limited to, current power consumption data of the target device, maximum rated power consumption data, all power consumption data of the target device within a preset time period, and the like. The preset duration can be flexibly determined according to actual conditions. Wherein the power consumption data may be the power of the electronic device. For example, the maximum rated power consumption data is the maximum rated power of the electronic device.
Understandably, when the administrator needs to view the power consumption situation of the corresponding device in the internet data center, an acquisition request may be sent to the server 10 through the browser of the user terminal, where the acquisition request carries information such as the number of the target device to be acquired, the period of the power consumption data to be acquired, and the like. In the machine room of the internet data center, different electronic devices have different numbers so as to be convenient for distinguishing.
In step S120, after receiving the acquisition request, the server 10 may parse the acquisition request to extract the number of the electronic device to be acquired, the period of the power consumption data to be acquired, and the like from the acquisition request.
After extracting the request content in the acquisition request, the server 10 may acquire the power consumption data of the corresponding electronic device from the preset database according to the request content.
The preset database may be one database or two databases. When the preset database is two databases, the two databases may be the first database and the second database respectively.
The first database may be used to store all power consumption data for each electronic device in the internet data center. Or the first database may store all historical power consumption data except the current power consumption data of each device.
The second database is for storing current power consumption data for each electronic device in the internet data center. Thus, when the user needs to acquire the current power consumption data, the server 10 can directly realize the rapid reading and response of the current power consumption data from the second database, which is beneficial to improving the response rate of acquiring the current power consumption data.
In this embodiment, the first database may be, but is not limited to, an InfluxDB database and the second database may be, but is not limited to, a MySQL database. Wherein, in the InfluxDB database, each piece of data has a time stamp, so the database is suitable for storing the data which changes along with time, and is beneficial to later analysis of the trend of the data along with time. In the MySQL database, the database has small volume, high speed, low total possession cost, open source code and easy maintenance. The InfluxDB database refers to a time sequence database, and the MySQL database refers to a relational database, which are all databases well known to those skilled in the art.
It should be noted that the first database and the second database may be other databases different from the InfluxDB database and the MySQL database, and the types of the databases are not specifically limited herein.
When the preset database is a database, the preset database may be the first database, that is, the preset database may be the InfluxDB database, and all power consumption data of each device in the machine room may be stored.
In step S130, after acquiring the target power consumption data of the target device, the server 10 may transmit the target power consumption data of the target device to the user terminal, thereby completing the response to the acquisition request.
When receiving the target power consumption data of the target equipment, the user terminal can display the target power consumption data of the target equipment through a browser so that an administrator can intuitively check the data, and thus, the automatic monitoring of each equipment in the IDC machine room can be realized.
As an optional implementation manner, if the preset database includes the first database and the second database, step S120 may include:
The target power consumption data of the target device is obtained from the first database and/or the second database, the first database is used for storing all power consumption data of each electronic device in the internet data center, the second database is used for storing current power consumption data of each electronic device in the internet data center, and the target power consumption data comprises at least one of power consumption data of the target device in the first database and current power consumption data in the second database.
Understandably, the server 10 may flexibly acquire corresponding power consumption data from the first database and the second database according to the request content of the acquisition request.
For example, if the request content of the acquisition request indicates that it is desired to acquire the power consumption data of the target device in all periods (including the current time and all periods before the current time), the server 10 may acquire all the power consumption data of the target device from the first database.
If the request content of the acquisition request indicates that the acquisition of the current power consumption data of the target device is desired, the server 10 may acquire the current power consumption data of the target device from the second database. Because only the current power consumption data of each electronic device is stored in the second database, that is, the data amount stored in the second database is far smaller than the data amount stored in the first database, the server 10 can quickly search and acquire the current power consumption data of the target device in the second database, so that the quick acquisition of the current power consumption data is facilitated, and the response rate of the request is improved.
If the request content of the acquisition request indicates that all the historical power consumption data of the target device is expected to be acquired (the current power consumption data of the target device may not be included in the historical power consumption data), and the current power consumption data of the target device is expected to be acquired. At this time, the server 10 may acquire all the historical power consumption data of the target device from the first database, and acquire the current power consumption data of the target device from the second database.
In this embodiment, the server 10 may transfer part of the power consumption data in the preset database to a Redis (Remote Dictionary Server, remote dictionary service) database in the memory of the server 10 in advance, and the step of obtaining the target power consumption data of the target device from the first database and/or the second database may include:
Obtaining all power consumption data of the target device in a preset time period from the first database through Redis, and/or obtaining current power consumption data of the target device from the second database through Redis, wherein the target power consumption data comprises at least one of all power consumption data of the target device in the preset time period and current power consumption data of the target device.
Understandably, redis is a memory-based database that can also be persisted. The data recorded in the database of the Redis is stored in the memory of the server 10. The data stored in the first database (e.g. the InfluxDB database), the second database (e.g. the MySQL database) is typically stored in a hard disk of the server 10. The rate at which the server 10 reads the same data (same byte size) from its own memory is typically faster than the rate at which the data is read from the hard disk. The server 10 obtains the target power consumption data of the target device through the dis, which is beneficial to improving the rate of obtaining the target data.
In this embodiment, the preset duration may be flexibly determined according to an actual situation, and may be any preset duration before the current time. For ease of distinction, this preset time period may be referred to as a first preset time period. The server 10 may preprocess the corresponding power consumption data in the preset database. The pretreatment process can be as follows: and storing the power consumption data in the first database within a second preset time period and the current power consumption data in the second database in the Redis. The second preset time length comprises the first preset time length, and can be flexibly determined according to actual conditions.
Based on the preprocessing, when receiving the acquisition request, the server 10 may acquire the target power consumption of the target device from the dis, and if there is no power consumption data to be acquired in the dis, acquire the target power consumption data of the target device from the first database and the second database.
As an alternative embodiment, if the preset database includes the first database and the second database, before step S110, the method may include step S101 and step S103, as follows:
Step S101, current power consumption data of each electronic device in the Internet data center are obtained according to a preset period;
Step S103, storing the current power consumption data of each electronic device in the second database.
In this embodiment, the preset period may be flexibly determined according to the actual situation. Understandably, the server 10 may create a periodic task in advance, which may acquire current power consumption data of each electronic device in the internet data center at a preset period, and store the acquired data in the second database.
The current power consumption data of each device that the server 10 acquires from the internet data center at a single time may be: the power consumption data of each electronic device at the current moment, or a data set formed by the power consumption data of each electronic device at a plurality of different moments during the period from the last time of acquiring the power consumption data to the current acquisition of the power consumption data.
It should be noted that the periodically acquired power consumption data may also be stored in the first database, so that the first database may store and record the power consumption data of each device in all periods.
As an alternative embodiment, after step S101 and before step S103, the method may further include step S102, as follows:
step S102, deleting the power consumption data stored in the previous time in the second database.
It is to be understood that, during executing steps S101 to S102, if the power consumption data to be deleted in the second database is already stored in the first database, the power consumption data stored in the second database is deleted before the current power consumption data is stored in the second database, and then the current power consumption data obtained in step S101 is stored in the second database, so that it can be ensured that the power consumption data stored in the second database is the latest power consumption data of each electronic device, so as to improve the timeliness of the current power consumption data.
If the power consumption data to be deleted in the second database is not stored in the first database during the execution of steps S101 to S102, the power consumption data to be deleted in the second database is stored in the first database before the power consumption data stored in the second database last time is deleted, then the power consumption data stored in the second database last time is deleted, and finally the current power consumption data acquired in step S101 is stored in the second database. In this way, omission of power consumption data can be avoided.
As an alternative embodiment, step S130 may include: and sending the maximum rated power consumption data and the current power consumption data of the target equipment included in the target power consumption data to the user terminal so that the user terminal displays the maximum rated power consumption data and the current power consumption data through Web.
In this embodiment, the target power consumption data may include, but is not limited to, maximum rated power consumption data of the target device, current power consumption data, historical power consumption data, and the like. When receiving the target power consumption data, the user terminal can display various power consumption data in the target equipment through the Web browser, so that an administrator can visually check the power consumption condition of the target equipment in the machine room. The administrator can select the number and the type of the target devices according to actual conditions, so that the administrator can flexibly adjust the monitoring objects according to requirements.
As an alternative embodiment, the method may further comprise: and when the target equipment does not execute tasks or the current power consumption data of the target equipment is larger than the maximum rated power consumption, controlling the target equipment to stop running.
It will be appreciated that the server 10 may also monitor the performance of tasks by various devices in the internet data center. The tasks can be flexibly determined according to actual situations, including but not limited to reading data, backing up data and the like. If the target equipment does not execute the task, the target equipment is not required to run, and at the moment, the target equipment can be controlled to be stopped or in a standby state so as to reduce the power consumption of the whole internet data center.
In addition, if the current power consumption data of the target equipment is larger than the maximum rated power consumption, the target equipment is in overload operation, and the target equipment can be controlled to stop operation at the moment so as to avoid burning out of the target equipment due to overload.
Referring to fig. 4, an embodiment of the present application further provides an energy consumption monitoring device 200, which can be applied to the server 10 described above, for executing each step in the method. The energy consumption monitoring device 200 comprises at least one software functional module which may be stored in the memory module 12 in the form of software or Firmware (Firmware) or cured in the Operating System (OS) of the server 10. The processing module 11 is configured to execute executable modules stored in the storage module 12, such as software functional modules and computer programs included in the energy consumption monitoring device 200.
The energy consumption monitoring apparatus 200 may include a receiving unit 210, a power consumption obtaining unit 220, and a transmitting unit 230, and may perform the following operation steps:
a receiving unit 210, configured to receive an acquisition request sent by a user terminal;
A power consumption obtaining unit 220, configured to obtain target power consumption data of a target device from a preset database, where the target device is at least one electronic device in an internet data center corresponding to the obtaining request, and the preset database is used to store all power consumption data of each electronic device in the internet data center;
and a sending unit 230, configured to send the target power consumption data of the target device to the user terminal.
Optionally, the preset database includes a first database and a second database, and the power consumption obtaining unit 220 may be further configured to: the target power consumption data of the target device is obtained from the first database and/or the second database, the first database is used for storing all power consumption data of each electronic device in the internet data center, the second database is used for storing current power consumption data of each electronic device in the internet data center, and the target power consumption data comprises at least one of power consumption data of the target device in the first database and current power consumption data in the second database.
Optionally, before the receiving unit 210 performs step S110, the power consumption obtaining unit 220 is further configured to:
Acquiring current power consumption data of each electronic device in the internet data center according to a preset period;
And storing the current power consumption data of each electronic device in the second database.
Optionally, the energy consumption monitoring device 200 may further comprise a data deletion unit. After the power consumption obtaining unit 220 obtains the current power consumption data of each electronic device in the internet data center according to a preset period, and before the current power consumption data of each electronic device is stored in the second database, the data deleting unit is configured to delete the stored power consumption data in the second database.
Alternatively, the power consumption obtaining unit 220 may be further configured to: obtaining all power consumption data of the target device in a preset time period from the first database through Redis, and/or obtaining current power consumption data of the target device from the second database through Redis, wherein the target power consumption data comprises at least one of all power consumption data of the target device in the preset time period and current power consumption data of the target device.
Optionally, the sending unit 230 may be further configured to: and sending the maximum rated power consumption data and the current power consumption data of the target equipment included in the target power consumption data to the user terminal so that the user terminal displays the maximum rated power consumption data and the current power consumption data through Web.
Optionally, the energy consumption monitoring apparatus 200 may further include a control unit, configured to control the target device to stop operating when the target device does not perform a task or the current power consumption data of the target device is greater than the maximum rated power.
In this embodiment, the processing module 11 may be an integrated circuit chip with signal processing capability. The processing module 11 may be a general purpose processor. For example, the processor may be a central Processing unit (Central Processing Unit, CPU), digital signal processor (DIGITAL SIGNAL Processing, DSP), application Specific Integrated Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic, discrete hardware components, which may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the application.
The memory module 12 may be, but is not limited to, random access memory, read only memory, programmable read only memory, erasable programmable read only memory, electrically erasable programmable read only memory, and the like. In this embodiment, the storage module 12 may be used to store power consumption data for each device in the IDC room. Of course, the storage module 12 may also be used to store a program, which is executed by the processing module 11 upon receiving an execution instruction.
The communication module 13 is used for establishing communication connection between the server 10 and other devices through a network, and transmitting and receiving data through the network.
It will be appreciated that the architecture shown in fig. 2 is merely a schematic illustration of one architecture of the server 10, and that the server 10 may include many more components than those shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
It should be noted that, for convenience and brevity of description, the specific working process of the server 10 described above may refer to the corresponding process of each step in the foregoing method, and will not be described in detail herein.
The embodiment of the application also provides a computer readable storage medium. The computer-readable storage medium has stored therein a computer program which, when run on a computer, causes the computer to perform the energy consumption monitoring method as described in the above embodiments.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented in hardware, or by means of software plus a necessary general hardware platform, and based on this understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disc, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective implementation scenario of the present application.
In summary, the present application provides an energy consumption monitoring method, an energy consumption monitoring device, a server and a computer readable storage medium. The method comprises the following steps: receiving an acquisition request sent by a user terminal; acquiring target power consumption data of target equipment from a preset database, wherein the target equipment is at least one electronic equipment corresponding to an acquisition request in an internet data center, and the preset database is used for storing all power consumption data of each electronic equipment in the internet data center; and sending the target power consumption data of the target equipment to the user terminal. In the scheme, after the server receives the acquisition request of the user terminal, the server does not need to acquire the power consumption data from the Internet data center based on the acquisition request of the user terminal, but directly acquires the corresponding power consumption data from the preset database, so that the efficiency of acquiring the power consumption data is improved, the asynchronous acquisition of the power consumption is realized, and the automatic monitoring of the power consumption of each device of the Internet data center is realized.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus, system and method may be implemented in other manners as well. The above-described apparatus, system, and method embodiments are merely illustrative, for example, flow charts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.