• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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