cPanel/Stats
cPanel module

Stats

5 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="Stats", 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_bandwidth GET#

Return bandwidth statistics for all domains

This function retrieves a list of bandwidth records for the domains on a cPanel account.

Note:

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

Warning:

This function requires the _Bandwidth Stats_ feature. To enable this feature, use WHM's _Feature Manager_ interface (_WHM >> Home >> Packages >> Feature Manager_).

timezonestringOptional
The timezone in which to report the data, in Olson tz format. Note: This parameter defaults to the server's timezone.

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

bytesinteger
The domain's bandwidth usage, in bytes.
domainstring
The domain for which to display bandwidth statistics. Note: The function only returns this value if the protocol return's value is http.
month_startinteger
The beginning of the report window.
protocolstring
The protocol for which to provide data. http imap smtp pop3 * ftp
One of: http imap smtp pop3 ftp

get_site_errors GET#

Return specified domain access log

This function returns entries from a domain's error log.

domainstringRequired
The domain for which to return error log entries.
logstringOptional
The Apache log file to query. This parameter defaults to error. error - The /var/log/apache2/error_log file. suexec - The /var/log/apache2/suexec_log file.
maxlinesintegerOptional
The number of lines to retrieve from the error log.

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

dateinteger
The date that the system recorded the error.
entrystring
The error log entry.

get_stats_daily GET#

Return daily AwStats statistics for a domain

This function returns the daily AwStats statistics for a domain.

domainstringRequired
The domain to retrieve statistics for. Must be owned by the current cPanel user.

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

domainstring
The domain associated with the returned daily stats.
statsobject
A map of date strings (YYYY-MM-DD) to daily statistics. Up to 45 days of history are returned. Gaps between the first available stat and yesterday are filled with zeros.

list_sites GET#

Return Analog statistics for all domains

This function displays the Analog statistics for the domains on a cPanel account.

enginestringRequired
The statistics engine. webalizer analog
trafficstringOptional
The web traffic type. http ftp

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

all_domainsinteger
Whether the statistics file's filepath is for all the domains on a cPanel account. 1 - All domains. 0 - An individual domain.
One of: 0 1
domainstring
The domain for which to display statistics.
pathstring
The filepath to the statistics file.
sslinteger
Whether the function generates statistics from SSL requests. 1 - Generates statistics for SSL requests. 0 - Generates statistics for non-SSL requests.
One of: 0 1

list_stats_by_domain GET#

Return Analog statistics for specified domain

This function returns a domain's Analog statistics.

domainstringRequired
The domain from which to retrieve statistics.
enginestringRequired
The statistics engine. analog is the only possible value.
sslintegerOptional
Whether to return statistics from SSL requests. 1 - Return statistics for SSL requests. 0 - Return statistics for non-SSL requests.

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

dateinteger
The current date and time.
urlstring
The URL of the file from which the system generates statistics reports.