librenms / librenms

Community-based GPL-licensed network monitoring system
https://www.librenms.org
Other
3.95k stars 2.31k forks source link

Bills Module get_bill broken when used with period=previous #15980

Open ObjectiveWriter opened 7 months ago

ObjectiveWriter commented 7 months ago

The problem

According to the docs one can request the last period for a bill (by id) by sending a request to: /api/v0/bills/:id?period=previous

However no useful data is returned.


curl -H 'X-Auth-Token: -removed-' 'http:/192.168.1.244/api/v0/bills/5?period=previous'
{
    "status": "ok",
    "bills": [],
    "count": 0
}

However the API appears to be somewhat working, as the "history" can be requested.


 curl -H 'X-Auth-Token: -removed-' 'http:/192.168.1.244/api/v0/bills/5/history'
{
    "status": "ok",
    "bill_history": [
        {
            "bill_hist_id": 24,
            "bill_id": 5,
            "updated": "2024-04-25 15:01:01",
......

On the testing setup we have various different historic bills for the bill-id5, so there is data of more than one complete billing period.

Any advice would be apreciated.

Output of ./validate.php

./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS  | 24.4.1 (2024-04-20T14:26:51+00:00)
DB Schema | 2024_04_10_093513_remove_device_perf (291)
PHP       | 8.2.8
Python    | 3.11.2
Database  | MariaDB 10.11.3-MariaDB-1
RRDTool   | 1.7.2
SNMP      | 5.9.3
===========================================

[OK]    Composer Version: 2.7.4
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok

What was the last working version of LibreNMS?

No response

Anything in the logs that might be useful for us?

No response

SwGraf commented 1 month ago

I have also run into this. Any updates on the issue?