Skip to content

vnstat 配置 MonthRotate 为非 1 的天数后,当前月份流量特定时间内会错误显示为 0.00G | 0.00G #99

@daseinem

Description

@daseinem

有一些机器上的流量不是按自然月刷新的,比如在15日刷新并且将 vnstatMonthRotate 也配置为15,那么在15日之前 vnstat --json m 返回的数据会存在不包含当前自然月流量信息的情况,导致 ServerStatus-Rust 显示的月流量为 0.00G | 0.00G.

vnstat json 输出样例 (省略中间部分月份)

{
    "vnstatversion": "2.6",
    "jsonversion": "2",
    "interfaces": [
        {
            "name": "eth0",
            "alias": "",
            "created": {
                "date": {
                    "year": 2022,
                    "month": 3,
                    "day": 1
                }
            },
            "updated": {
                "date": {
                    "year": 2022,
                    "month": 11,
                    "day": 6
                },
                "time": {
                    "hour": 6,
                    "minute": 25
                }
            },
            "traffic": {
                "total": {
                    "rx": 34838225310,
                    "tx": 537051064160
                },
                "month": [
                    {
                        "id": 1,
                        "date": {
                            "year": 2022,
                            "month": 3
                        },
                        "rx": 120663351707,
                        "tx": 107577662878
                    },
                    {
                        "id": 7,
                        "date": {
                            "year": 2022,
                            "month": 9
                        },
                        "rx": 37335903948,
                        "tx": 23122453659
                    },
                    {
                        "id": 8,
                        "date": {
                            "year": 2022,
                            "month": 10
                        },
                        "rx": 21771011198,
                        "tx": 9919763673
                    }
                ]
            }
        }
    ]
}

stat_server 版本:

❯ /usr/local/ServerStatus/server/stat_server --version
stat_server v1.5.6 GIT:51f17c7, BUILD:2022-11-02 16:17:06 UTC

stat_client 版本:

❯ /usr/local/ServerStatus/client/stat_client --version
stat_client v1.5.6 GIT:51f17c7, BUILD:2022-11-02 16:17:07 UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions