Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api_db.php?topClients should behave like api.php?topClients and return configurable number of records #1736

Open
zimjjan opened this issue Feb 15, 2021 · 3 comments

Comments

@zimjjan
Copy link

zimjjan commented Feb 15, 2021

Versions

  • Pi-hole: 5.1.2
  • AdminLTE: 5.1.1
  • FTL: 5.2

Platform

  • OS and version: Docker
  • Platform:

Expected behavior

Calling api_db.php?topClients=25 should return 25 records.

Actual behavior / bug

Always returns 10.

(In addition, aggregation is done in php, so there is not even a performance advantage in doing so.)

Steps to reproduce

Call API as mentioned above.

@yubiuser
Copy link
Member

api_db.php uses the long-term database instead of the data directly from memory (as api.php) does.
The former has a hard-coded limit of ten clients
https://github.com/pi-hole/AdminLTE/blob/1521dfe3f46eb7bfd87a0644a1fadcf5bfd0f7f9/api_db.php#L182

You could get the information via SQL directly from the database. In v6.0 Pi-hole will get a completely new API, which might allow (@DL6ER ?) querying any number of top clients from the long-term database as well.

https://deploy-preview-338--pihole-docs.netlify.app/api/

@DL6ER
Copy link
Member

DL6ER commented Feb 15, 2021

A quick look at the code says: Yes, this is already supported in the v6.0 code:

https://github.com/pi-hole/FTL/blob/01bb3bce23fa6009c1a7fd5130546f7ff14fed02/src/api/stats_database.c#L171-L173

Please note that the linked documentation is still lacking somewhat behind the development and will be soon replaced by a documentation inbuilt into FTL (this has the benefit of being always correct for the version you have at hand).

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants