1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-24 08:58:49 -05:00

Added new dump-stats command

This new command will dump the existing packetstats from the
last time it was written to disk.
This commit is contained in:
Hemna 2024-11-05 11:33:19 -05:00
parent c4bf89071a
commit add18f1a6f

View File

@ -11,6 +11,7 @@ from rich.table import Table
import aprsd import aprsd
from aprsd import cli_helper from aprsd import cli_helper
from aprsd.main import cli from aprsd.main import cli
from aprsd.threads.stats import StatsStore
# setup the global logger # setup the global logger
@ -154,3 +155,18 @@ def fetch_stats(ctx, host, port):
watch_table.add_row(key, value["last"]) watch_table.add_row(key, value["last"])
console.print(watch_table) console.print(watch_table)
@cli.command()
@cli_helper.add_options(cli_helper.common_options)
@click.pass_context
@cli_helper.process_standard_options
def dump_stats(ctx):
"""Dump the current stats from the running APRSD instance."""
console = Console()
console.print(f"APRSD Fetch-Stats started version: {aprsd.__version__}")
ss = StatsStore()
ss.load()
stats = ss.data
console.print(stats)