Disclosure of Invention
Aiming at the problems in the prior art, the embodiment of the invention provides an IaaS cloud platform resource charging method and device.
The embodiment of the invention provides an IaaS cloud platform resource charging method, which comprises the following steps:
after the cloud platform use requirements of the users are detected, determining corresponding requirement configuration attributes according to the use requirements, and configuring corresponding user cloud spaces according to the requirement configuration attributes;
polling a metering system of the cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is usage data of a user cloud space;
acquiring event data in a message queue of the user cloud space through the billing agent;
performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data;
when abnormal data exists in the integrated data, determining corresponding abnormal data, acquiring previous and subsequent data of the abnormal data, determining time information of the abnormal data in the user cloud space according to attributes of the previous and subsequent data, acquiring corresponding standard data according to the time information, and replacing the abnormal data with the standard data;
and calculating the final cost of the user according to the modified integration data by combining the charging standard.
In one embodiment, the method further comprises:
when the previous data and the next data are sampling data, acquiring a polling period of the billing agent and sampling time of the previous data and the next data;
determining the sampling time of the abnormal data according to the polling period of the billing agent and the sampling time of the previous and subsequent data, and determining the time information of the abnormal data in the user cloud space according to the sampling time of the abnormal data;
when the previous data and the next data are event data, acquiring events and event life cycles corresponding to the previous data and the next data;
and determining an event and an event life cycle corresponding to the abnormal data according to the event and the event life cycle corresponding to the previous and next data, and determining the time information of the abnormal data in the user cloud space according to the event and the event life cycle corresponding to the abnormal data.
In one embodiment, the method further comprises:
acquiring a polling period of the charging agent and an event life cycle corresponding to the event data;
and detecting whether abnormal data exist in the integrated data according to the polling period and the time life cycle.
In one embodiment, the method further comprises:
detecting whether an abnormal event occurs on the cloud platform;
when the cloud platform is detected to have abnormal events, acquiring the occurrence time periods of the abnormal events, and acquiring historical data of the occurrence time periods to replace data of corresponding time periods in the integrated data.
In one embodiment, the method further comprises:
and when abnormal data does not exist in the integrated data, calculating the final cost of the user according to the integrated data by combining the charging standard.
In one embodiment, the method further comprises:
and acquiring a preset format, and carrying out standardized processing on the sampling data and the event data according to the preset format to obtain integrated data after integration.
The embodiment of the invention provides an IaaS cloud platform resource charging device, which comprises:
the system comprises a detection module, a configuration module and a configuration module, wherein the detection module is used for determining a corresponding demand configuration attribute according to a use demand of a cloud platform of a user after detecting the use demand, and configuring a corresponding user cloud space according to the demand configuration attribute;
the polling module is used for polling a metering system of the cloud platform through a preset billing agent to acquire sampling data in the metering system, wherein the sampling data is usage data of a user cloud space;
the first acquisition module is used for acquiring event data in a message queue of the user cloud space through the billing agent;
the integration module is used for performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data;
a second obtaining module, configured to determine corresponding abnormal data when abnormal data exists in the integrated data, obtain previous and subsequent data of the abnormal data, determine time information of the abnormal data in the user cloud space according to attributes of the previous and subsequent data, obtain corresponding standard data according to the time information, and replace the abnormal data with the standard data;
and the calculation module is used for calculating the final cost of the user according to the modified integration data by combining the charging standard.
In one embodiment, the apparatus further comprises:
a third obtaining module, configured to obtain a polling period of the billing agent and sampling time of the previous and subsequent data when the previous and subsequent data are sampling data;
the first determining module is used for determining the sampling time of the abnormal data according to the polling period of the billing agent and the sampling time of the previous and subsequent data, and determining the time information of the abnormal data in the user cloud space according to the sampling time of the abnormal data;
the fourth acquisition module is used for acquiring events and event life cycles corresponding to the previous and next data when the previous and next data are event data;
and the second determining module is used for determining the event and the event life cycle corresponding to the abnormal data according to the event and the event life cycle corresponding to the previous and next data, and determining the time information of the abnormal data in the user cloud space according to the event and the event life cycle corresponding to the abnormal data.
The embodiment of the invention provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the steps of the IaaS cloud platform resource charging method are realized when the processor executes the program.
An embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the IaaS cloud platform resource billing method described above.
According to the IaaS cloud platform resource charging method and device provided by the embodiment of the invention, after the cloud platform use requirements of users are detected, the corresponding requirement configuration attributes are determined according to the use requirements, and the corresponding user cloud space is configured according to the requirement configuration attributes; polling a metering system of a cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is the use data of a user cloud space; acquiring event data in a message queue of a user cloud space through a billing agent; performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data; when abnormal data exists in the integrated data, determining corresponding abnormal data, acquiring data before and after the abnormal data, determining time information of the abnormal data in a user cloud space according to attributes of the data before and after, acquiring corresponding standard data according to the time information, and replacing the abnormal data with the standard data; and calculating the final cost of the user according to the modified integration data by combining the charging standard. Therefore, when the IaaS cloud platform data is abnormal, the abnormal data can be traced and modified, and the accuracy of final calculation cost is further ensured.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow diagram of an IaaS cloud platform resource charging method provided in an embodiment of the present invention, and as shown in fig. 1, an embodiment of the present invention provides an IaaS cloud platform resource charging method, including:
step S101, after detecting the cloud platform use requirement of the user, determining the corresponding requirement configuration attribute according to the use requirement, and configuring the corresponding user cloud space according to the requirement configuration attribute.
Specifically, after detecting the use requirement of the user for the cloud platform, the cloud platform server determines the corresponding requirement configuration attribute according to the use requirement of the user, where the use requirement of the user may be a space size of 60GB serving for 30 days, or a processor with 4 cores and eight threads serving for 24 hours, and after determining the requirement configuration attribute that the cloud platform needs to provide according to the use requirement of the user, the cloud platform server may further calculate the basic cost required by the user according to a charging standard preset by the cloud platform, and correspondingly configure the corresponding user cloud space for the user, such as creating a corresponding user cloud host.
Step S102, polling a metering system of the cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is usage data of a user cloud space.
Specifically, the metering system of the cloud platform is polled through a preset billing agent, wherein the billing agent is software capable of autonomously acquiring and feeding back relevant data of a user cloud space, the metering system is a system which is owned by the cloud platform and meters user usage data, the data of the metering system is periodically sampled data, and the billing agent periodically acquires the sampled data in the metering system, for example, the usage data of a user cloud host every 1 hour.
Step S103, acquiring event data in the message queue of the user cloud space through the billing agent.
Specifically, the billing agent obtains event data in a message queue of the cloud space of the user, where the event data is a usage event of the user, and specifically may include an event that the user starts to use, the user changes a usage mode (including start and end times of the mode), the user ends to use, and the like, which may cause a change in the billing mode.
And step S104, performing data integration on the sampling data and the event data to obtain integrated data, and detecting whether abnormal data exists in the integrated data.
Specifically, data integration is performed on the sampling data and the event data to obtain integrated data after integration, a preset format can be obtained in the specific integration process, data is prepared in a standardized mode according to the preset format, then it is guaranteed that subsequent processing steps can perform unified processing on the data, and then whether abnormal data exist in the integrated data or not is detected.
In addition, the step of detecting whether abnormal data exists in the integrated data may be: acquiring a polling cycle of the billing agent and an event life cycle corresponding to the event data, wherein the polling cycle refers to the cycle time of the billing agent acquiring the metering system of the cloud platform, the event life cycle corresponding to the event data refers to the time when the user starts to use, the user changes the use mode (including the start time and the end time of the mode), the user ends to use and other events change, and then detecting whether data abnormality exists in the integrated data according to the polling cycle and the time life cycle.
Step S105, when abnormal data exists in the integrated data, corresponding abnormal data is determined, front and back data of the abnormal data are obtained, time information of the abnormal data in the user cloud space is determined according to attributes of the front and back data, corresponding standard data are obtained according to the time information, and the abnormal data are replaced by the standard data.
Specifically, when there is abnormal data in the integrated data, there is a possibility that: and determining corresponding abnormal data and acquiring preceding and following data of the abnormal data, determining time information of the abnormal data in a user cloud space according to the attributes of the preceding and following data, acquiring corresponding standard data in historical data of the user cloud space according to the time information after determining the time information of the abnormal data in the user cloud space, and replacing abnormal data with the standard data.
In addition, the step of determining the time information of the abnormal data in the user cloud space according to the attributes of the previous and next data may be divided into:
when the front data and the back data are sampling data, the abnormal data are also the sampling data, and then the polling period of the billing agent and the sampling time of the front data and the back data are obtained; the sampling time of the abnormal data can be determined according to the polling period of the billing agent and the sampling time of the previous and subsequent data, and the time information of the abnormal data in the user cloud space can be determined according to the sampling time of the abnormal data, for example, when the previous and subsequent data are sampling data of 6 points and 8 points respectively, the abnormal data is sampling data of 7 points;
when the current back data is event data, indicating that the abnormal data is also the event data, acquiring events and event life cycles corresponding to the front and back data; determining an event and an event life cycle corresponding to the abnormal data according to the event and the event life cycle corresponding to the previous and subsequent data, and determining time information of the abnormal data in the user cloud space according to the event and the event life cycle corresponding to the abnormal data, wherein for example, the previous and subsequent data are the start time of the event 1 and the start time of the event 2, and the abnormal data are the end time of the event 1.
In addition, when an abnormal event is detected to occur on the cloud platform, where the abnormal event occurs, such as a situation that the cloud platform fails to receive the user data, for example, a network is disconnected, the processing method may acquire an occurrence time period of the abnormal event, and acquire historical data of the user cloud space in the occurrence time period to replace data in a corresponding time period in the integrated data.
And step S106, combining the charging standard, and calculating to obtain the final cost of the user according to the modified integration data.
After the modified integrated data of the user on the cloud platform use condition is obtained, the final cost of the user can be calculated by combining the preset charging standard.
In addition, when there is no abnormal data in the integrated data, the final cost of the user may be calculated according to the integrated data without performing the data modification step in step S105 and directly combining the charging standard.
According to the IaaS cloud platform resource charging method provided by the embodiment of the invention, after the cloud platform use requirements of users are detected, the corresponding requirement configuration attributes are determined according to the use requirements, and the corresponding user cloud space is configured according to the requirement configuration attributes; polling a metering system of a cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is the use data of a user cloud space; acquiring event data in a message queue of a user cloud space through a billing agent; performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data; when abnormal data exists in the integrated data, determining corresponding abnormal data, acquiring data before and after the abnormal data, determining time information of the abnormal data in a user cloud space according to attributes of the data before and after, acquiring corresponding standard data according to the time information, and replacing the abnormal data with the standard data; and calculating the final cost of the user according to the modified integration data by combining the charging standard. Therefore, when the IaaS cloud platform data is abnormal, the abnormal data can be traced, and the accuracy of final calculation cost is further ensured.
Fig. 2 is a device for charging resources of an IaaS cloud platform according to an embodiment of the present invention, including: the system comprises a detection module S201, a polling module S202, a first acquisition module S203, an integration module S204, a second acquisition module S205 and a calculation module S206, wherein:
the detection module S201 is configured to determine a corresponding requirement configuration attribute according to a use requirement after detecting the use requirement of the cloud platform of the user, and configure a corresponding cloud space of the user according to the requirement configuration attribute.
The polling module S202 is used for polling the metering system of the cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is usage data of a user cloud space.
A first obtaining module S203, configured to obtain, through the billing agent, event data in the message queue of the user cloud space.
And the integration module S204 is used for performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data.
A second obtaining module S205, configured to determine corresponding abnormal data when there is abnormal data in the integrated data, obtain previous and subsequent data of the abnormal data, determine time information of the abnormal data in the user cloud space according to attributes of the previous and subsequent data, obtain corresponding standard data according to the time information, and replace the abnormal data with the standard data.
And the calculating module S206 is used for calculating the final cost of the user according to the modified integration data by combining the charging standard.
In one embodiment, the apparatus may further comprise:
and the third acquisition module is used for acquiring the polling period of the billing agent and the sampling time of the previous and next data when the previous and next data are sampling data.
And the first determining module is used for determining the sampling time of the abnormal data according to the polling period of the billing agent and the sampling time of the previous and subsequent data, and determining the time information of the abnormal data in the user cloud space according to the sampling time of the abnormal data.
And the fourth acquisition module is used for acquiring the events and the event life cycles corresponding to the previous and next data when the previous and next data are event data.
And the second determining module is used for determining the event and the event life cycle corresponding to the abnormal data according to the event and the event life cycle corresponding to the previous and next data, and determining the time information of the abnormal data in the user cloud space according to the event and the event life cycle corresponding to the abnormal data.
In one embodiment, the apparatus may further comprise:
and the fifth acquisition module is used for acquiring the polling period of the billing agent and the event life cycle corresponding to the event data.
And the second detection module is used for detecting whether abnormal data exist in the integrated data according to the polling cycle and the time life cycle.
In one embodiment, the apparatus may further comprise:
and the third detection module is used for detecting whether the cloud platform has abnormal events.
The sixth obtaining module is configured to, when it is detected that an abnormal event occurs in the cloud platform, obtain an occurrence time period of the abnormal event, and obtain historical data of the occurrence time period to replace data of a corresponding time period in the integrated data.
In one embodiment, the apparatus may further comprise:
and the second calculation module is used for calculating the final cost of the user according to the integrated data by combining the charging standard when abnormal data does not exist in the integrated data.
In one embodiment, the apparatus may further comprise:
and the seventh acquisition module is used for acquiring a preset format, and carrying out standardized processing on the sampling data and the event data according to the preset format to obtain integrated data after integration.
For specific limitations of the IaaS cloud platform resource charging apparatus, reference may be made to the above limitations on the IaaS cloud platform resource charging method, which is not described herein again. All or part of each module in the IaaS cloud platform resource charging device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Fig. 3 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 3: a processor (processor)301, a memory (memory)302, a communication Interface (Communications Interface)303 and acommunication bus 304, wherein theprocessor 301, thememory 302 and thecommunication Interface 303 complete communication with each other through thecommunication bus 304. Theprocessor 301 may call logic instructions in thememory 302 to perform the following method: the IaaS cloud platform resource charging method comprises the steps of determining corresponding demand configuration attributes according to use requirements after the use requirements of a cloud platform of a user are detected, and configuring corresponding user cloud spaces according to the demand configuration attributes; polling a metering system of a cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is the use data of a user cloud space; acquiring event data in a message queue of a user cloud space through a billing agent; performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data; when abnormal data exists in the integrated data, determining corresponding abnormal data, acquiring data before and after the abnormal data, determining time information of the abnormal data in a user cloud space according to attributes of the data before and after, acquiring corresponding standard data according to the time information, and replacing the abnormal data with the standard data; and calculating the final cost of the user according to the modified integration data by combining the charging standard.
Furthermore, the logic instructions in thememory 302 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the transmission method provided in the foregoing embodiments when executed by a processor, and for example, the method includes: the IaaS cloud platform resource charging method comprises the steps of determining corresponding demand configuration attributes according to use requirements after the use requirements of a cloud platform of a user are detected, and configuring corresponding user cloud spaces according to the demand configuration attributes; polling a metering system of a cloud platform through a preset billing agent to obtain sampling data in the metering system, wherein the sampling data is the use data of a user cloud space; acquiring event data in a message queue of a user cloud space through a billing agent; performing data integration on the sampling data and the event data to obtain integrated data after integration, and detecting whether abnormal data exists in the integrated data; when abnormal data exists in the integrated data, determining corresponding abnormal data, acquiring data before and after the abnormal data, determining time information of the abnormal data in a user cloud space according to attributes of the data before and after, acquiring corresponding standard data according to the time information, and replacing the abnormal data with the standard data; and calculating the final cost of the user according to the modified integration data by combining the charging standard.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.