cPanel/Bandwidth
cPanel module

Bandwidth

3 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="Bandwidth", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

get_enabled_protocols GET#

Return services monitored in bandwidth data

This function returns a list of the server's enabled protocols.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

The bandwidth protocols that the server records. ftp imap pop3 smtp * http — This value includes all web traffic for the 80 and 443 ports.

get_retention_periods GET#

Return bandwidth retention period

This function retrieves the retention periods for bandwidth data.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

intervalstring
The interval in which the system reports bandwidth data. - daily - hourly - 5min
One of: daily hourly 5min
retentioninteger
The retention period for bandwidth data.

query GET#

Return cPanel account's bandwidth usage report

This function queries an account's bandwidth data and returns a report.

Note:

This function also returns the bandwidth use of a distributed cPanel account.

groupingmixedRequired
How to group the data in the report, in pipe-separated format. This list must contain one or both of the following parameters: A pipe-separated list that contains one or both of the following parameters: domain protocol This parameter can also include only one of the following start time interval types: year year_month year_month_day year_month_day_hour year_month_day_mour_minute Note: This parameter accepts a maximum of three values. * The function nests the return objects in the order that you declare the values in this parameter.
domainsstringOptional
A pipe-separated list of domains for which to provided data. Note: If you do not include this parameter, the function will return data for all domains on the cPanel account. The UNKNOWN "pseudo-domain" refers to data recorded without a specific domain. All traffic except HTTP traffic is recorded without a specific domain.
endintegerOptional
The end date of the report window.
intervalstringOptional
Length of time between bandwidth data samples. daily hourly * 5min Note: The interval's retention period determines availability of the interval's data. Use the Bandwidth::get_retention_periods API to determine an interval's retention period.
protocolsstringOptional
A pipe-separated list of the protocols for which to provide data. http imap smtp pop3 * ftp
startintegerOptional
The start date of the report window.
timezonestringOptional
The timezone in which to report the data.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

The function returns data in a hierarchy of objects that the order of values in the grouping parameter determines. For example: domain - Returns data by domain. domain|protocol - Returns data by protocol and nests it within the object for each domain. domain|year - Returns data by year and nests it within the object for each domain. year|domain - Returns data by domain and nests it within object for each year. * domain|year|protocol - Returns data by protocol and nests it within object for each year, which the result then nests in objects for each domain. The deepest child object contains the bandwidth data in bytes.