• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Rest API

minty-arthur

New Pleskian
Server operating system version
Ubuntu 20.04
Plesk version and microupdate number
Ubuntu 20.04
Is there an possibility where i can get the traffic usage per server, customer, domain/subscription.
I cannot find a way to view the traffic statistics from the last 10 minutes for example.

I hope somebody has an answer for me.

Kind regards,

Arthur
 
I cannot find a way to view the traffic statistics from the last 10 minutes for example.
Table DomainsTraffic in psa database has a field date: 2021-09-30 where no minutes are provided. So I don't think it's possible to get traffic statistics for any number of minutes.

As for Rest API request, you can try to use SQL query call like:

Code:
# plesk db "select domains.name, round(sum(DomainsTraffic.http_in)/1024/1024,2) as 'HTTP_IN (MB)', round(sum(DomainsTraffic.http_out)/1024/1024,2) as 'HTTP_OUT (MB)', round(sum(DomainsTraffic.ftp_in)/1024/1024,2) as 'FTP_IN (MB)', round(sum(DomainsTraffic.ftp_out)/1024/1024,2) as 'FTP_OUT (MB)', round(sum(DomainsTraffic.smtp_in)/1024/1024,2) as 'SMTP_IN (MB)', round(sum(DomainsTraffic.smtp_out)/1024/1024,2) as 'SMTP_OUT (MB)', round(sum(DomainsTraffic.pop3_imap_in)/1024/1024,2) as 'POP3_IMAP_IN (MB)', round(sum(DomainsTraffic.pop3_imap_out)/1024/1024,2) as 'POP3_IMAP_OUT (MB)' from domains, DomainsTraffic where id=dom_id AND date>='2022-05-01' AND date<='2022-05-18' GROUP BY dom_id;"

for example.
The similar query you use for ClientsTraffic table.
That's what just occurred to me. Maybe there are more convenient ways.
 
What do i need to select?
Unfortunately, I do not have the exact instructions to solve your problem. I have only given you a direction for further possible solutions. It is not at all certain that it can work, but you are welcome to try. I have given you everything you need to do this.
Perhaps someone in the community can suggest a more accurate solution.
 
In the rest api you need to choose a type to execute an command.
[
"action-log",
"admin",
"admin_alias",
"anonftp",
"apache",
"aps",
"autoresponder",
"blupgrade",
"branding",
"branding_theme",
"certificate",
"client",
"client_pref",
"cloning",
"crontab_shell",
"custom_plan_items",
"custombutton",
"database",
"database-registrar",
"database-server",
"dbbackup",
"dns",
"domain",
"domain_addon_service_plan",
"domain_pref",
"domain_restriction",
"domain_template",
"domalias",
"dsn",
"event_handler",
"extension",
"ftpsubaccount",
"grey_listing",
"hotlink_protection",
"http2_pref",
"init_conf",
"interface_template",
"ip_ban",
"ip_pool",
"ipmanage",
"keyinfo",
"license",
"locales",
"mail",
"maillist",
"mailserver",
"migrate",
"nginx",
"notification",
"objectInfo",
"optimization_settings",
"passwords",
"php_handler",
"php_settings",
"pleskbackup",
"pleskrestore",
"poweruser",
"product_info",
"protdir",
"repair",
"report",
"reseller",
"reseller_pref",
"reseller_template",
"role",
"secret_key",
"server_dns",
"server_filesharing",
"server_pref",
"service",
"service_node",
"settings",
"site",
"skeleton",
"spamassassin",
"subdomain",
"subscription",
"task-manager",
"traffic",
"turboaddr",
"user",
"virtdir",
"vps_optimized",
"webstat",
"webuser"
]

one of those types above. Then you can fill in request body params.
 
Yes, there seems to be no way to call either db or mysql commands.
So, it turns out that with Rest API you will not be able to achieve what you want.
 
Back
Top