CN112000317A - Resource charging method and device, electronic equipment and storage medium - Google Patents

Resource charging method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112000317A
CN112000317A CN202010868248.5A CN202010868248A CN112000317A CN 112000317 A CN112000317 A CN 112000317A CN 202010868248 A CN202010868248 A CN 202010868248A CN 112000317 A CN112000317 A CN 112000317A
Authority
CN
China
Prior art keywords
resource
charging
metering
data
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010868248.5A
Other languages
Chinese (zh)
Inventor
陈鸽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202010868248.5A priority Critical patent/CN112000317A/en
Publication of CN112000317A publication Critical patent/CN112000317A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0283Price estimation or determination

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Development Economics (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • Data Mining & Analysis (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Game Theory and Decision Science (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

The application discloses a resource charging method, a device, an electronic device and a storage medium, wherein the method comprises the following steps: after receiving a metering and charging instruction, initializing a charging resource list through a database script, wherein the charging resource list comprises: resource type, resource operation; according to the charging resource list, sequentially configuring and operating a charging resource acquisition task and a charging resource metering task; acquiring operation data of resource operation corresponding to the resource type; calculating the resource usage amount according to the operation data, the resource metering type and the resource metering index set; and calculating the resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price. After receiving the metering and charging instruction, the method initializes the charging resource list through the database script, configures the resource stimulating task and the charging resource metering task, realizes the acquisition of the operation data corresponding to the resource operation, and then calculates the resource usage and the resource cost.

Description

Resource charging method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of resource charging technologies, and in particular, to a resource charging method and apparatus, an electronic device, and a storage medium.
Background
In the cloud computing era, with the increasingly wide application field of cloud services, for a public cloud computing platform, only three services of computing, networking and storage are often insufficient, and under the background that the internet is applied in hundreds of flowers at present, the cloud resource information computing consumption and cost technology is also one of the key technologies of the cloud computing platform and plays a crucial role in the cloud computing platform. In addition, under the background that big data analysis is more and more prevalent, reliable and convenient management of metering and charging of cloud resources becomes more important. Therefore, the cloud resource metering and charging become an important service for creating value for users by the cloud computing platform in a reasonable way. In the related technology, a mode of independently writing codes is adopted for metering statistics, when the metering of a new resource is added, the codes need to be rewritten, and the efficiency is low.
Therefore, how to provide a solution to the above technical problem is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The application aims to provide a resource charging method, a resource charging device, electronic equipment and a storage medium, which are convenient to operate and high in charging efficiency. The specific scheme is as follows:
the application provides a resource charging method, which comprises the following steps:
after receiving a metering and charging instruction, initializing a charging resource list through a database script, wherein the charging resource list comprises: resource type, resource operation;
according to the charging resource list, sequentially configuring and operating a charging resource acquisition task and a charging resource metering task;
acquiring operation data of the resource operation corresponding to the resource type;
calculating the resource usage amount according to the operation data, the resource metering type and the resource metering index set;
and calculating the resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price.
Preferably, configuring and running the charging resource collection task includes:
configuring the charging resource acquisition task;
configuring a charging resource inquiring interface according to the database script, and inquiring resource list data according to the charging resource inquiring interface;
configuring a resource auditing interface which needs to acquire the resource operation, and inquiring resource auditing list data according to the resource auditing interface;
processing the resource list data and the resource audit list data.
Preferably, said processing said resource list data and said resource audit list data comprises:
filtering invalid state data in the resource list data;
converting other data except the invalid state data into a first acquisition object, and setting the attribute of the first acquisition object;
filtering invalid resource operation data in the resource audit list data;
and converting other data except the invalid resource operation data into a second acquisition object, and setting the attribute of the second acquisition object.
Preferably, configuring and running the charging resource metering task comprises:
configuring the charging resource metering task;
inquiring the resource list data or the resource audit list data of all the current resource types to obtain the operation data;
and determining the resource usage amount of each resource index of the resource type according to the configured metering index set, the metering type and the operation data.
Preferably, the calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price includes:
judging whether the current charging is the first charging or the periodic charging;
and if the current charging is the first charging, calculating the resource charge corresponding to the resource usage according to the preset charging resource metering index set, the charging type and the index unit price.
Preferably, the calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price includes:
calculating initial resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price;
and calculating according to the initial resource cost and the discount value to obtain the resource cost.
The application provides a resource charging device, including:
the initialization module is used for initializing a charging resource list through a database script after receiving a metering charging instruction, wherein the charging resource list comprises: resource type, resource operation;
the configuration module is used for sequentially configuring and operating a charging resource acquisition task and a charging resource metering task according to the charging resource list;
an obtaining module, configured to obtain operation data of the resource operation corresponding to the resource type
The resource usage determining module is used for calculating the resource usage according to the operation data, the resource metering type and the resource metering index set;
and the resource charge determining module is used for calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price.
Preferably, the configuration module includes:
the first configuration unit is used for configuring the charging resource acquisition task;
the query unit is used for configuring a query charging resource interface according to the database script and querying resource list data according to the query charging resource interface;
the second configuration unit is used for configuring a resource auditing interface which needs to acquire the resource operation and inquiring resource auditing list data according to the resource auditing interface;
and the processing unit is used for processing the resource list data and the resource audit list data.
The application provides an electronic device, including:
a memory for storing a computer program;
a processor for implementing the steps of the resource charging method as described above when executing the computer program.
The present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the resource charging method as described above.
The application provides a resource charging method, which comprises the following steps: after receiving a metering and charging instruction, initializing a charging resource list through a database script, wherein the charging resource list comprises: resource type, resource operation; according to the charging resource list, sequentially configuring and operating a charging resource acquisition task and a charging resource metering task; acquiring operation data of resource operation corresponding to the resource type; calculating the resource usage amount according to the operation data, the resource metering type and the resource metering index set; and calculating the resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price.
Therefore, after the metering and charging instruction is received, the charging resource list is initialized through the database script, the resource stimulating task and the charging resource metering task are configured, the collection of operation data corresponding to resource operation is achieved, then the resource usage is calculated, and then the resource cost of each index is calculated according to the resource usage, the resource charging type, the resource charging index and the resource unit price.
The application also provides a resource charging device, an electronic device and a computer readable storage medium, all having the above beneficial effects, which are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a resource charging method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a metering implementation provided by an embodiment of the present application;
fig. 3 is a schematic diagram of a charging implementation process provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a resource charging apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. 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 application.
In the related technology, a mode of independently writing codes is adopted for metering statistics, when the metering of a new resource is added, the codes need to be rewritten, and the efficiency is low. Based on the above technical problems, the present embodiment provides a resource charging method, after receiving a metering and charging instruction, the resource operation can be automatically collected by using a database script to obtain operation data, and the metering and charging operation is performed, so as to finally implement resource metering and charging, and the method is convenient to operate and high in charging efficiency. Referring to fig. 1 specifically, fig. 1 is a flowchart of a resource charging method provided in an embodiment of the present application, which specifically includes:
s101, after receiving a metering and charging instruction, initializing a charging resource list through a database script;
the charging resource list includes: resource type, resource operation;
in this embodiment, the receiving of the metering and charging instruction may be receiving the metering and charging instruction after the user logs in. Or after the user triggers the target operation on the cloud platform, the user receives the metering and charging instruction. In this embodiment, the metering charging instruction may be an instruction for a specific resource type, and may of course be an instruction for all resource types, and this embodiment is not limited to this, as long as the purpose of this embodiment can be achieved.
In this embodiment, a database script is preset, and resource charging can be automatically implemented according to the database script. Furthermore, metering and charging of other resource types can be added in a mode of configuring the database script, metering and charging of newly added resources can be completed only by configuring the database script, and the expansibility is high.
The embodiment is applied to the cloud sea environment of Kubernetes, and all modules of the environment run normally; a database script initializes a charging resource list required by a charging module, wherein the charging resource list comprises but is not limited to a resource type, a resource state, an interface parameter, an interface return object, an interface object data conversion mode and the like; and then configuring and operating a charging resource timing acquisition task, namely a charging resource list, in the cloud environment.
S102, sequentially configuring and operating a charging resource acquisition task and a charging resource metering task according to a charging resource list;
further, configuring and running a charging resource acquisition task, including: configuring a charging resource acquisition task; configuring a charging resource inquiring interface according to the database script, and inquiring resource list data according to the charging resource inquiring interface; configuring a resource auditing interface needing to acquire resource operation, and inquiring resource auditing list data according to the resource auditing interface; the resource list data and the resource audit list data are processed.
Firstly, charging resource acquisition tasks are added into task modules in the cloud sea environment, the charging resource acquisition tasks are configured, the task execution time can be set to be 1 point 30 in the morning, and certainly, other time can be set, and users can perform self-defined setting. Secondly, a charging resource inquiring interface is configured according to the database script, then resource list data of a charging resource module is inquired according to the charging resource inquiring interface, further, data is obtained in a paging mode during inquiring so as to enable the interface to be overtime, and when the module interfaces can not be communicated, the task is ended. And thirdly, configuring a resource audit interface of the life cycle module according to all resource operations of the charging resources required to be collected, configured by the database script, and inquiring resource audit list data of the charging resources according to the resource audit interface. And finally, processing the inquired resource list data and the resource audit list data of the life cycle module according to the database script. It will be appreciated that the resource list data corresponds to a first measurement and the resource audit list data corresponds to a periodic measurement.
Further, processing the resource list data and the resource audit list data includes: filtering invalid state data in the resource list data; converting other data except the invalid state data into a first acquisition object, and setting the attribute of the first acquisition object; filtering invalid resource operation data in the resource audit list data; and converting other data except the invalid resource operation data into a second acquisition object, and setting the attribute of the second acquisition object.
For the resource list data, processing the queried resource list data of the computing module, firstly filtering the state of the charging resource list data, removing the list data in an invalid state, converting other data into a first collection object, and setting the attribute of the first collection object, wherein the attribute includes but is not limited to: resource type, domain, department, VDC (resource pool of cloud management platform), user, resource name, resource operation, resource index detail and resource operation time.
For the resource audit list data, processing the queried resource audit list data of the life cycle module, firstly filtering the operation of the resource audit list data, removing list data of invalid operation, setting the attribute of a second acquisition object when the other data state is the second acquisition object, wherein the attribute includes but is not limited to: resource type, domain, department, VDC, user, resource name, resource operation, resource index details, and resource operation time, wherein the resource index details include, but are not limited to: type, CPU, memory, storage, network card, floating IP. And updating the resource name, the user and the resource index details according to the resource operation of different resource types. It will be appreciated that operational data may be determined from the attributes.
Further, configuring and running a charging resource timing metering task in the cloud environment, specifically, configuring and running a charging resource metering task, includes: configuring a charging resource metering task; inquiring the resource list data or resource audit list data of all current resource types to obtain operation data; and determining the resource usage amount of each resource index of the resource type according to the configured measurement index set, the measurement type and the operation data.
Charging resource metering tasks are added into task modules in the cloud sea environment, the charging resource metering tasks are configured, the task execution time is set to be 30 a.m. 2 by default, and certainly, other time can be set by users in a self-defined mode. Then, a charging resource metering task is executed. Firstly, whether the current metering is the first metering or the periodic metering is confirmed, if the current charging resource type resource has no metering data, the current metering is the first metering, and if the current charging resource type resource has the metering data, the current metering is the periodic metering. If the measurement is carried out for the first time, the resource list data of all the current charging resource type resources are inquired, then the usage amount of each index of the charging resource type resources is calculated according to the configured charging resource measurement index set, namely the measurement index set, and the configured measurement type of the charging resources, and then the generated use case of each index of the charging resource type resources is stored in a database. And if the resource is periodically measured, determining the resource usage amount of each resource index of the resource type according to the configured measurement index set and the measurement type according to the incremental operation data in the resource audit list data. Wherein, the measurement index set comprises: any one or more of CPU, memory, storage, network, floating IP, etc. The measurement type represents the unit used for measurement, and can be time, memory size, times, number and the like. Different indexes correspond to different metering types, and different resource usage amounts are finally obtained.
S103, acquiring operation data of resource operation corresponding to the resource type;
a resource operation in this application is an operation in a lifecycle that includes, but is not limited to, a create operation, a modify operation, and a delete operation. The operation data for obtaining the resource operation corresponding to the resource type may include the resource operation time, the operation frequency, or other data, which is not limited in this embodiment, as long as the purpose of this embodiment can be achieved.
S104, calculating the resource usage amount according to the operation data, the resource metering type and the resource metering index set;
in this embodiment, the resource measurement types include measurement types of different resource indicators in different resource types, and specifically, the unit used for measurement includes, but is not limited to, time, memory size, number of times, and the like. The resource measurement index set includes measurement index sets under multiple resource types, and specifically, the measurement index set includes: any one or more of CPU, memory, storage, network, floating IP, etc. It is understood that resource types include, but are not limited to: cloud host computer, cloud hard disk, cloud physics machine. Referring to fig. 2, when the resource type is a cloud host, fig. 2 is a schematic diagram of a metering implementation process according to an embodiment of the present disclosure.
And S105, calculating the resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price.
Referring to fig. 3, when the resource type is a cloud host, fig. 3 is a schematic diagram of a charging implementation process provided in an embodiment of the present application.
Further, calculating the resource cost according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price, including: judging whether the current charging is the first charging or the periodic charging; and if the current charging is the first charging, calculating the resource charge corresponding to the resource usage according to a preset charging resource metering index set, a charging type and an index unit price.
Specifically, in this embodiment, a resource charging task is added to a task module in a cloud environment, the resource charging task is configured, the execution time of the resource charging task is set to be 3 am 30 by default, and of course, other times are also possible, and a user can perform user-defined setting as long as the purpose of this embodiment can be achieved. In this embodiment, whether the current charging is the first charging or the periodic charging is determined, if the current charging resource type resource has no charge data, it indicates that the current charging is the first charging, and if the current charging resource type resource has charge data, it indicates that the current charging is the periodic charging. If the charging is carried out for the first time, the resource usage list data of all the charging resource type resources at present is inquired, then the cost of the usage of each index of the charging resource type resources is calculated according to the configured charging resource charging index set, the configured charging type of the charging resources and the configured index unit price of the charging resources, and then the generated cost of the usage of each index of the resources of the charging resource type is stored in a database. If the charging is periodic charging, the resource charge is directly determined.
Further, calculating the resource cost according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price, including: calculating initial resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price; and calculating according to the initial resource cost and the discount value to obtain the resource cost.
To sum up, in this embodiment, a reasonable platform is simply operated and set up, so that a method for implementing a metering and charging configuration model of charging resources under a cloud platform can be reasonably and simply completed, the coupling is low (completely loosely coupled with other modules), the expansibility is high (metering and charging of a resource is increased, and metering and charging of a newly added resource can be completed only by configuring an initialization script), an operation usage analysis result of the charging resources is provided for a user, an operation cost analysis result of the charging resources is provided for the user, cost of host resources is saved for the user, and the user can conveniently manage the charging resources under the cloud platform.
The embodiment specifically includes initializing the resource type, the interface parameters, the interface return object, the interface object data conversion mode and the like to be charged through a database script, completing the initialization of basic data, entering the acquisition module through the task module in the cloud management platform in a timing task manner, acquiring the charging resource list data of the charging resource module and the life cycle module in a timing manner, entering the metering module in a timing task manner through the task module in the cloud management platform in a timing task manner to meter the resource usage amount of the charging resource in a timing manner, entering the metering module in a timing task manner through the task module in the cloud management platform in a timing manner to calculate the resource charge of the charging resource in a timing manner, and finally realizing the metering and charging of the. It can be seen that, in the embodiment, the resource metering and charging mode is changed from the traditional physical disk granularity to the charging resource granularity, a large number of charging resource instances running on a single metering and charging unit physical storage can be individually measured according to each metering and charging index, and a user can effectively manage charging resources according to the result of the metering and charging of the charging resources, so that the user can uniformly know the resource usage of the charging resources of the current platform, provide basic support for the expansion and reduction of resources, and finally realize the effective utilization and skill target of the physical resources.
Based on the technical scheme, after receiving the metering and charging instruction, the embodiment initializes the charging resource list through the database script, configures the resource stimulating task and the charging resource metering task, realizes the acquisition of operation data corresponding to resource operation, then calculates the resource usage amount, and then calculates the resource charge of each index according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price.
Based on the foregoing embodiments, this embodiment provides a specific resource charging method, and specifically, a charging method implemented by a cloud-sea charging resource metering and charging model based on Kubernetes, including:
it is necessary to have a Kubernetes cloud environment where the various modules operate properly.
S1, initializing the charging resource list of charging module, wherein the charging resource list includes resource type, resource state, interface parameter, interface return object, interface object data conversion mode, etc.
And S2, configuring and operating the charging resource acquisition task in the cloud environment.
Firstly, the method comprises the following steps: charging resource acquisition tasks are added into task modules in the cloud sea environment, the charging resource acquisition tasks for charging resource timing acquisition are configured, and the execution time of the tasks is set to be 30 points in the morning by default.
Secondly, the method comprises the following steps: and configuring a charging resource query interface according to an initialization script (database script), querying resource list data of a charging resource module according to the interface, and acquiring data by paging to prevent the interface from overtime and prevent the module interface from being communicated with the task to finish.
Thirdly, the method comprises the following steps: and configuring all charging resource operations to be acquired according to the initialization script to query a resource audit interface of the life cycle module, and querying resource audit list data of the charging resources by using the resource audit interface, when the module interface can not be communicated with the task, ending the task.
Fourthly: and processing the inquired resource list data and the resource audit list data of the life cycle module according to the initialization script.
Processing the queried resource list data of the computing module, firstly filtering the state of the resource list data, removing the list data in an invalid state, converting other data into a collection object, and setting the attribute of the collection object, wherein the attribute includes but is not limited to: resource type, domain, department, VDC, user, resource name, resource operation, resource index detail and resource operation time.
Processing the resource audit list data of the queried life cycle module, firstly filtering the operation of the resource audit list data, removing list data of invalid operation, setting the attribute of the collection object by taking other data states as the collection object, wherein the attribute comprises but is not limited to: resource type, domain, department, VDC, user, resource name, resource operation, resource index detail (type, CPU, memory, storage, network card, floating IP) and resource operation time), and updating the resource name, the user and the resource index detail according to different types of operation.
And S3, configuring and operating the metering and charging resource metering task in the cloud sea environment.
Firstly, the method comprises the following steps: charging resource metering tasks are added into task modules in the cloud sea environment, charging resource metering tasks of charging resource timing metering are configured, and the execution time of the tasks is set to be 30 points 2 a.m. by default.
Secondly, the method comprises the following steps: and executing the charging resource metering task. Firstly, whether the current metering is the first metering or the periodic metering is confirmed, if the current charging resource type resource has no metering data, the current metering is the first metering, and if the current charging resource type resource has the metering data, the current metering is the periodic metering. If the measurement is carried out for the first time, the resource operation list data of all the current charging resource type resources are inquired, then the usage amount of each index of the charging resource type resources is calculated according to the configured charging resource measurement index set and the configured measurement type of the charging resources, and then the generated use case of each index of the charging resource type resources is stored in a database.
And S4, configuring and operating the charging resource timing charging task in the cloud environment.
Firstly, the method comprises the following steps: charging resource charging tasks are added in a task module in a cloud sea environment, charging resource timing charging tasks are configured, and the default setting of task execution time is 30 points 3 a.m.
Secondly, the method comprises the following steps: firstly, whether the current charging is the first charging or the periodic charging is confirmed, if the current charging resource type resource has no charge data, the current charging is the first charging, and if the current charging resource type resource has the charge data, the current charging is the periodic charging. If the charging is carried out for the first time, the resource usage list data of all the charging resource type resources at present is inquired, then the cost of the usage of each index of the charging resource type resources is calculated according to the configured charging resource charging index set, the configured charging type of the charging resources and the configured index unit price of the charging resources, and then the generated cost of the usage of each index of the resources of the charging resource type is stored in a database.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a resource charging device provided in an embodiment of the present application, where the resource charging device described below and the resource charging method described above may be referred to in a corresponding manner, and all relevant modules are disposed in a cloud management platform, and fig. 4 is a schematic structural diagram of the resource charging device provided in the embodiment of the present application, and includes:
the initialization module 401 is configured to initialize a charging resource list through a database script after receiving a metering and charging instruction, where the charging resource list includes: resource type, resource operation;
a configuration module 402, configured to sequentially configure and run a charging resource acquisition task and a charging resource metering task according to the charging resource list;
an obtaining module 403, configured to obtain operation data of a resource operation corresponding to a resource type
A resource usage determining module 404, configured to calculate resource usage according to the operation data, the resource metering type, and the resource metering index set;
and the resource charge determining module 405 is configured to calculate the resource charge according to the resource usage amount, the resource charging type, the resource charging index, and the resource unit price.
Preferably, the configuration module 402 includes:
the first configuration unit is used for configuring a charging resource acquisition task;
the query unit is used for configuring a query charging resource interface according to the database script and querying resource list data according to the query charging resource interface;
the second configuration unit is used for configuring a resource audit interface needing to acquire resource operation and inquiring resource audit list data according to the resource audit interface;
and the processing unit is used for processing the resource list data and the resource audit list data.
Preferably, the processing unit comprises:
the first filtering subunit is used for filtering invalid state data in the resource list data;
the first conversion subunit is used for converting other data except the invalid state data into a first acquisition object and setting the attribute of the first acquisition object;
the second filtering subunit is used for filtering invalid resource operation data in the resource audit list data;
and the second conversion subunit is used for converting other data except the invalid resource operation data into a second acquisition object and setting the attribute of the second acquisition object.
Preferably, the configuration module comprises:
the charging resource metering task configuration unit is used for configuring a charging resource metering task;
the query unit is used for querying the resource list data or the resource audit list data of all current resource types to obtain operation data;
and the resource usage determining unit is used for determining the resource usage of each resource index of the resource type according to the configured metering index set, the metering type and the operation data.
Preferably, the resource fee determination module 405 includes:
the judging unit is used for judging whether the current charging is the first charging or the periodic charging;
and the resource charge determining unit is used for calculating the resource charge corresponding to the resource usage according to a preset charging resource metering index set, a charging type and an index unit price if the current charging is the first charging.
Preferably, the resource fee determination module 405 includes:
the initial resource charge determining unit is used for calculating the initial resource charge according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price;
and the resource cost determining unit is used for calculating according to the initial resource cost and the discount value to obtain the resource cost.
Since the embodiments of the apparatus portion and the method portion correspond to each other, please refer to the description of the embodiments of the method portion for the embodiments of the apparatus portion, which is not repeated here.
In the following, an electronic device provided by an embodiment of the present application is introduced, and the electronic device described below and the method described above may be referred to correspondingly.
The present embodiment provides an electronic device, including:
a memory for storing a computer program;
a processor for implementing the steps of the resource charging method as described above when executing the computer program.
Since the embodiment of the electronic device portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the electronic device portion, which is not repeated here.
The following describes a computer-readable storage medium provided by embodiments of the present application, and the computer-readable storage medium described below and the method described above may be referred to correspondingly.
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the above-mentioned resource charging method.
Since the embodiment of the computer-readable storage medium portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the computer-readable storage medium portion, which is not repeated here.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
A resource charging method, an apparatus, an electronic device, and a computer-readable storage medium provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A resource charging method is characterized by comprising the following steps:
after receiving a metering and charging instruction, initializing a charging resource list through a database script, wherein the charging resource list comprises: resource type, resource operation;
according to the charging resource list, sequentially configuring and operating a charging resource acquisition task and a charging resource metering task;
acquiring operation data of the resource operation corresponding to the resource type;
calculating the resource usage amount according to the operation data, the resource metering type and the resource metering index set;
and calculating the resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price.
2. The resource charging method according to claim 1, wherein configuring and running a charging resource collection task comprises:
configuring the charging resource acquisition task;
configuring a charging resource inquiring interface according to the database script, and inquiring resource list data according to the charging resource inquiring interface;
configuring a resource auditing interface which needs to acquire the resource operation, and inquiring resource auditing list data according to the resource auditing interface;
processing the resource list data and the resource audit list data.
3. The resource billing method of claim 2 wherein the processing the resource listing data and the resource audit list data comprises:
filtering invalid state data in the resource list data;
converting other data except the invalid state data into a first acquisition object, and setting the attribute of the first acquisition object;
filtering invalid resource operation data in the resource audit list data;
and converting other data except the invalid resource operation data into a second acquisition object, and setting the attribute of the second acquisition object.
4. The resource charging method of claim 2, wherein configuring and running a charging resource metering task comprises:
configuring the charging resource metering task;
inquiring the resource list data or the resource audit list data of all the current resource types to obtain the operation data;
and determining the resource usage amount of each resource index of the resource type according to the configured metering index set, the metering type and the operation data.
5. The resource charging method according to claim 1, wherein the calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index, and the resource unit price comprises:
judging whether the current charging is the first charging or the periodic charging;
and if the current charging is the first charging, calculating the resource charge corresponding to the resource usage according to the preset charging resource metering index set, the charging type and the index unit price.
6. The resource charging method according to claim 1, wherein the calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index, and the resource unit price comprises:
calculating initial resource cost according to the resource usage, the resource charging type, the resource charging index and the resource unit price;
and calculating according to the initial resource cost and the discount value to obtain the resource cost.
7. A resource charging apparatus, comprising:
the initialization module is used for initializing a charging resource list through a database script after receiving a metering charging instruction, wherein the charging resource list comprises: resource type, resource operation;
the configuration module is used for sequentially configuring and operating a charging resource acquisition task and a charging resource metering task according to the charging resource list;
an obtaining module, configured to obtain operation data of the resource operation corresponding to the resource type
The resource usage determining module is used for calculating the resource usage according to the operation data, the resource metering type and the resource metering index set;
and the resource charge determining module is used for calculating the resource charge according to the resource usage amount, the resource charging type, the resource charging index and the resource unit price.
8. The resource charging apparatus according to claim 7, wherein the configuration module comprises:
the first configuration unit is used for configuring the charging resource acquisition task;
the query unit is used for configuring a query charging resource interface according to the database script and querying resource list data according to the query charging resource interface;
the second configuration unit is used for configuring a resource auditing interface which needs to acquire the resource operation and inquiring resource auditing list data according to the resource auditing interface;
and the processing unit is used for processing the resource list data and the resource audit list data.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the resource charging method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the resource charging method according to any one of claims 1 to 6.
CN202010868248.5A 2020-08-26 2020-08-26 Resource charging method and device, electronic equipment and storage medium Pending CN112000317A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010868248.5A CN112000317A (en) 2020-08-26 2020-08-26 Resource charging method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010868248.5A CN112000317A (en) 2020-08-26 2020-08-26 Resource charging method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112000317A true CN112000317A (en) 2020-11-27

Family

ID=73471561

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010868248.5A Pending CN112000317A (en) 2020-08-26 2020-08-26 Resource charging method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112000317A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112365300A (en) * 2020-12-07 2021-02-12 厦门锐特信息技术有限公司 Billing engine
CN112764675A (en) * 2020-12-30 2021-05-07 中国人寿保险股份有限公司上海数据中心 Real-time charging management method and system for cloud resources
CN115134179A (en) * 2022-06-30 2022-09-30 济南浪潮数据技术有限公司 Cloud resource metering and charging device, method, equipment and storage medium
CN113822701B (en) * 2021-08-28 2023-12-26 济南浪潮数据技术有限公司 Cloud platform third party resource computing method, device, equipment and readable medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521662A (en) * 2011-11-29 2012-06-27 曙光信息产业(北京)有限公司 Consumption charging method in cloud computing environment
CN102546190A (en) * 2011-11-28 2012-07-04 上海理想信息产业(集团)有限公司 Search method of universal fee packets of cloud computing resources
CN103067185A (en) * 2012-12-28 2013-04-24 无锡城市云计算中心有限公司 Accounting method in cloud computing system
CN104156811A (en) * 2014-08-04 2014-11-19 浪潮电子信息产业股份有限公司 Bill generation method based on in-cloud OS
WO2018081544A1 (en) * 2016-10-31 2018-05-03 Mastercard International Incorporated Automatic account-on-file management system and methods
CN108833123A (en) * 2018-04-11 2018-11-16 无锡华云数据技术服务有限公司 Based on according to quantity cloud host charging method and device
CN110503534A (en) * 2019-08-27 2019-11-26 山东大学 Cloud computing service resource dynamic dispatching method and system based on price expectation
CN111177169A (en) * 2019-12-30 2020-05-19 厦门网宿有限公司 Charging method, electronic device and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546190A (en) * 2011-11-28 2012-07-04 上海理想信息产业(集团)有限公司 Search method of universal fee packets of cloud computing resources
CN102521662A (en) * 2011-11-29 2012-06-27 曙光信息产业(北京)有限公司 Consumption charging method in cloud computing environment
CN103067185A (en) * 2012-12-28 2013-04-24 无锡城市云计算中心有限公司 Accounting method in cloud computing system
CN104156811A (en) * 2014-08-04 2014-11-19 浪潮电子信息产业股份有限公司 Bill generation method based on in-cloud OS
WO2018081544A1 (en) * 2016-10-31 2018-05-03 Mastercard International Incorporated Automatic account-on-file management system and methods
CN108833123A (en) * 2018-04-11 2018-11-16 无锡华云数据技术服务有限公司 Based on according to quantity cloud host charging method and device
CN110503534A (en) * 2019-08-27 2019-11-26 山东大学 Cloud computing service resource dynamic dispatching method and system based on price expectation
CN111177169A (en) * 2019-12-30 2020-05-19 厦门网宿有限公司 Charging method, electronic device and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112365300A (en) * 2020-12-07 2021-02-12 厦门锐特信息技术有限公司 Billing engine
CN112764675A (en) * 2020-12-30 2021-05-07 中国人寿保险股份有限公司上海数据中心 Real-time charging management method and system for cloud resources
CN113822701B (en) * 2021-08-28 2023-12-26 济南浪潮数据技术有限公司 Cloud platform third party resource computing method, device, equipment and readable medium
CN115134179A (en) * 2022-06-30 2022-09-30 济南浪潮数据技术有限公司 Cloud resource metering and charging device, method, equipment and storage medium
CN115134179B (en) * 2022-06-30 2024-08-20 济南浪潮数据技术有限公司 Cloud resource metering and charging device, method, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112000317A (en) Resource charging method and device, electronic equipment and storage medium
CN107360006B (en) Resource charging method and device
Denaro et al. Early performance testing of distributed software applications
CN103716282A (en) Method and system for correcting IP library
Prodan et al. Evaluating high-performance computing on google app engine
CN111382073A (en) Automatic test case determination method, device, equipment and storage medium
CN110602227B (en) Intelligent contract management method and related device
CN103414577A (en) Accounting system and method for Hadoop platform
CN103095471A (en) Charging method based on usage amount in cloud operating system (OS)
CN115358737A (en) Metering and charging method, device and equipment of cloud service and readable storage medium
CN111177169A (en) Charging method, electronic device and storage medium
CN111756589A (en) Cloud resource management method and device, cloud server and storage medium
CN111966762A (en) Index acquisition method and device
Caracaş et al. Energy-efficiency through micro-managing communication and optimizing sleep
CN114153687A (en) Cost calculation method and system for cloud platform resources and related device
CN111192123A (en) Account checking system based on hybrid cloud computing platform and account checking method thereof
CN114282919B (en) Cloud sea resource charging dynamic cost analysis optimization method and system
CN112054912A (en) Resource charging system and method of OpenStack open source cloud platform
CN112416565A (en) Medium and small enterprise computing community system based on national high-performance computing environment
CN114285848B (en) Quantifiable methods, systems, electronic devices, and readable media for blockchain resources
CN111522635B (en) Computing task processing method, computing task processing device, server and storage medium
CN115134179B (en) Cloud resource metering and charging device, method, equipment and storage medium
Choudhari et al. A Mobile App for Smart Electricity Usage Monitoring
CN115242870B (en) Power consumption data pushing method, device, server and computer readable storage medium
CN111626794B (en) Electricity charge calculation method, device, system, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201127

RJ01 Rejection of invention patent application after publication