mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
Update the CLI interface.
- server and auth are now arguments rather than required options.
This commit is contained in:
parent
83f57c6e47
commit
2ad0bfab39
3 changed files with 23 additions and 17 deletions
21
README.md
21
README.md
|
@ -4,6 +4,17 @@
|
||||||
|
|
||||||
Argos is an HTTP monitoring service. It's meant to be simple to configure and simple to use.
|
Argos is an HTTP monitoring service. It's meant to be simple to configure and simple to use.
|
||||||
|
|
||||||
|
Todo:
|
||||||
|
|
||||||
|
- [ ] Use Postgresql as a database
|
||||||
|
- [ ] Use background tasks for alerting
|
||||||
|
- [ ] Add a command to generate new authentication tokens
|
||||||
|
- [ ] Task for database cleanup (to run periodically)
|
||||||
|
- [ ] Handles multiple alerting backends (email, sms, gotify)
|
||||||
|
- [ ] Expose a simple read-only website.
|
||||||
|
- [ ] Add a way to specify the severity of the alerts in the config
|
||||||
|
- [ ] Do not send "expected" and "got" values in case check-status and body-contains suceeded
|
||||||
|
|
||||||
Features :
|
Features :
|
||||||
|
|
||||||
- [x] Uses `.yaml` files for configuration ;
|
- [x] Uses `.yaml` files for configuration ;
|
||||||
|
@ -13,16 +24,6 @@ Features :
|
||||||
- [x] Handle jobs failures on the clients
|
- [x] Handle jobs failures on the clients
|
||||||
- [x] Exposes an HTTP API that can be consumed by other systems ;
|
- [x] Exposes an HTTP API that can be consumed by other systems ;
|
||||||
- [x] Checks can be distributed on the network thanks to a job queue ;
|
- [x] Checks can be distributed on the network thanks to a job queue ;
|
||||||
- [x] Change the naming and use service/agent.
|
|
||||||
- [x] Packaging (and `argos agent` / `argos service` commands)
|
|
||||||
- [x] Endpoints are protected by an authentication token
|
|
||||||
- [x] Task frequency can be defined in the configuration
|
|
||||||
- [ ] Add a command to generate new authentication tokens
|
|
||||||
- [ ] Local task for database cleanup (to run periodically)
|
|
||||||
- [ ] Handles multiple alerting backends (email, sms, gotify) ;
|
|
||||||
- [ ] Exposes a simple read-only website.
|
|
||||||
- [ ] Add a way to specify the severity of the alerts in the config
|
|
||||||
- [ ] No need to return the expected and got values in case it worked in check-status and body-contains
|
|
||||||
|
|
||||||
Implemented checks :
|
Implemented checks :
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import click
|
||||||
|
|
||||||
from argos import logging
|
from argos import logging
|
||||||
from argos.agent import run_agent
|
from argos.agent import run_agent
|
||||||
from argos.logging import logger
|
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
|
@ -14,13 +13,17 @@ def cli():
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("--server", required=True, help="Server URL")
|
@click.argument("server")
|
||||||
@click.option("--auth", required=True, help="The authentication token")
|
@click.argument("auth")
|
||||||
@click.option("--max-tasks", default=10, help="Maximum number of concurrent tasks")
|
@click.option(
|
||||||
|
"--max-tasks",
|
||||||
|
default=10,
|
||||||
|
help="Number of concurrent tasks this agent can run",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--wait-time",
|
"--wait-time",
|
||||||
default=10,
|
default=10,
|
||||||
help="Wait time (in seconds) between two polls on the server",
|
help="Waiting time between two polls on the server (seconds)",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--log-level",
|
"--log-level",
|
||||||
|
@ -28,7 +31,10 @@ def cli():
|
||||||
type=click.Choice(logging.LOG_LEVELS, case_sensitive=False),
|
type=click.Choice(logging.LOG_LEVELS, case_sensitive=False),
|
||||||
)
|
)
|
||||||
def agent(server, auth, max_tasks, wait_time, log_level):
|
def agent(server, auth, max_tasks, wait_time, log_level):
|
||||||
"""Runs an agent"""
|
"""Get and run tasks to the provided server. Will wait for new tasks.
|
||||||
|
|
||||||
|
Usage: argos agent https://argos.server "auth-token-here"
|
||||||
|
"""
|
||||||
logging.set_log_level(log_level)
|
logging.set_log_level(log_level)
|
||||||
asyncio.run(run_agent(server, auth, max_tasks, wait_time))
|
asyncio.run(run_agent(server, auth, max_tasks, wait_time))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ from argos.schemas.utils import string_to_duration
|
||||||
# This file contains the pydantic schemas.
|
# This file contains the pydantic schemas.
|
||||||
# For the database models, check in argos.server.models.
|
# For the database models, check in argos.server.models.
|
||||||
|
|
||||||
|
|
||||||
Severity = Literal["warning", "error", "critical"]
|
Severity = Literal["warning", "error", "critical"]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue