Commit graph

176 commits

Author SHA1 Message Date
Luc Didry
2ab9afabc9
— Use alerts config in handle_alert 2023-12-14 16:31:51 +01:00
Luc Didry
39eace6152
💄 — Add link to task view in notifications 2023-12-14 16:31:51 +01:00
Luc Didry
04aaa3d8d7
Merge branch 'fix-16' into fix-15 2023-12-14 16:31:37 +01:00
Luc Didry
dc49f0bb3e
🚨 — Fix pylint warnings 2023-12-14 16:25:46 +01:00
Luc Didry
67bacc226a
🚨 — Fix pylint warnings 2023-12-14 16:25:46 +01:00
Luc Didry
ec97d98231
🎨 — Split mail in subject + content 2023-12-14 16:25:46 +01:00
Luc Didry
abe4f418b7
— Implement gotify alerts. Fix #16 2023-12-14 16:25:46 +01:00
Luc Didry
2ffea278dd
🎨 — Improve mail alerting code 2023-12-14 16:25:46 +01:00
Luc Didry
de1f0cc22a
— Implement mail alerts. Fix #15 2023-12-14 16:25:46 +01:00
Luc Didry
3600c2b4f7 🩹 — Update pydantic schema for alerts 2023-12-14 15:20:46 +01:00
Luc Didry
fec8395039 🩹 — Raise checks timeout 2023-12-14 15:20:46 +01:00
Luc Didry
c909f7179b 📝 — Improve documentation 2023-12-14 15:20:46 +01:00
Luc Didry
4930286380 🐛 — Fix cog not working 2023-12-14 15:20:45 +01:00
Luc Didry
e10f4e9c2d Use Pylint 2023-12-14 15:20:33 +01:00
Luc Didry
ca09506a11 💄 — Improve links in footer 2023-12-04 17:25:37 +01:00
Luc Didry
d1462684fe 💄 — Add link to repository in footer (Fix #17) 2023-12-04 10:41:48 +01:00
Luc Didry
88b1ca4d9e 🐛 — Fix get_severity_counts returned result 2023-11-28 17:20:00 +01:00
94049bc0ff Merge branch 'djlint' into 'main'
🚨👷 — Add djlint in CI + fix djlint warnings

See merge request framasoft/framaspace/argos!10
2023-11-22 15:36:12 +00:00
Luc Didry
207c4c54fc 📝 — Update agent doc (on using the env vars) 2023-11-22 16:00:54 +01:00
Luc Didry
61c3dd3fa7 🚨👷 — Add djlint in CI + fix djlint warnings 2023-11-22 15:54:37 +01:00
Luc Didry
b21399792e Merge branch 'almet/fix-serverstart' into 'main'
Call uvicorn via python rather than subprocess

See merge request framasoft/framaspace/argos!8
2023-11-22 13:13:43 +00:00
eaff5e8989 Merge branch 'fix-13' into 'main'
 — Allow to use env vars for agent’s token and server URL. Fix #13

Closes #13

See merge request framasoft/framaspace/argos!9
2023-11-22 13:12:20 +00:00
c09527f561 Replace dict.set() by dict.setdefault() 2023-11-22 14:10:31 +01:00
Luc Didry
fd6fdfefa9 — Allow to use env vars for agent’s token and server URL. Fix #13
Avoid to leak the token in `htop` for ex.
2023-11-22 13:48:42 +01:00
e652659fb6 Merge branch 'quick-overview' into 'main'
💄 — Quick supervision overview on homepage

See merge request framasoft/framaspace/argos!7
2023-11-22 12:34:17 +00:00
27857c182a Make queries.get_severity_counts() return a dict 2023-11-22 13:25:33 +01:00
fa9e79d72c Call uvicorn via python rather than subprocess 2023-11-22 13:15:32 +01:00
Luc Didry
1f33110e68 🚨 — HTML linting 2023-11-21 16:11:10 +01:00
Luc Didry
d2a12aea30 💄 — Quick supervision overview on homepage 2023-11-21 16:11:03 +01:00
6e408e1cf7 Allow defining db pool size and max overflow in the settings 2023-11-16 17:08:05 +01:00
Luc Didry
43078da6a1 🔧 — Default SQLAlchemy pool size is too low for production
Defaults values:
- pool_size=5
- max_overflow=10

We should have a setting in the configuration file for that.
2023-11-16 17:08:05 +01:00
76528b0e24 Use new Pydantic ConfigDict. Fixes #10 2023-11-16 01:00:20 +01:00
33becdd753 Accept all HTTP returned status for the SSL check.
Fixes #7
2023-10-30 15:53:23 +01:00
0e08bc8be6 Allow exceptions for advanced checks.
- See more information about this in #7
2023-10-30 15:02:13 +01:00
e20b1fcabe Merge branch 'improve-logs' into 'main'
🔊 — Improve alerting log

See merge request framasoft/framaspace/argos!4
2023-10-26 10:46:09 +00:00
Luc Didry
09047fe69a 🔊 — Improve alerting log 2023-10-25 16:49:59 +02:00
Luc Didry
5ef8600034 🐛 — Fix SSL check cert
Some (stupid) services don’t answer the same way when getting requested with HEAD or GET.
Like GET -> 200, HEAD -> 405.
https://github.com/h2non/imaginary is an example of such a service.
2023-10-25 14:52:17 +02:00
aee1545814 Deduplicate checks from settings. Fixes #5
- Allow the database to have duplicates (previous calls were causing a server crash)
- Add tests scenarii for duplication
2023-10-25 00:00:25 +02:00
7997e9bbcd Remove debug code 2023-10-24 18:51:33 +02:00
b105004f3b Add the number of agents in the index template 2023-10-24 18:01:13 +02:00
5bca4fa261 argos server cleandb now keep a number of results per task 2023-10-20 02:40:06 +02:00
158e7ac44c Create a new http client on agent retry 2023-10-20 01:35:30 +02:00
85735add01 Updates while reading the code with Luc. 2023-10-19 18:10:41 +02:00
a9f823fbfa 🌱 Let's start with the Gitlab CI 2023-10-18 23:17:23 +02:00
9885a5809a Add an 'argos server clean' command that needs to be run periodically to clean the db 2023-10-18 21:45:10 +02:00
54379d04c4 hostname is now used as agent_id, and stored in the db 2023-10-18 21:29:09 +02:00
cd243d92dc Refactor argos agent to use classes 2023-10-18 17:48:42 +02:00
31edb95cb8 Don't let the agents fail. Retry on error 2023-10-18 17:28:27 +02:00
55d59283f8 Better formatting for domain page 2023-10-18 17:04:54 +02:00
d6c048fb5b Speed-up SQL queriying by using DISTINCT statement 2023-10-18 16:31:47 +02:00
6338d7d9e6 Add a way to know when the last checks have been run 2023-10-18 12:43:55 +02:00
dd2dc14351 Issue a warning when using a temporary db. 2023-10-18 12:41:58 +02:00
e437f48b34 Changed checks to accept ints for expected values.
(In the configuration)
2023-10-18 12:32:33 +02:00
0ea9ad4c6e Added logging option for the server command 2023-10-18 12:31:54 +02:00
bf24f87fd7 Add more information on database configuration, and allow using a .env file 2023-10-18 02:37:00 +02:00
75a8af37f0 Added a few more template files 2023-10-18 02:23:36 +02:00
a97a57d06c Remove old imports from checks.py 2023-10-17 23:50:34 +02:00
2ad0bfab39 Update the CLI interface.
- server and auth are now arguments rather than required options.
2023-10-17 19:24:53 +02:00
83f57c6e47 Started working on a simple web interface.
- The web interface is exposed at /, and the api
  at /api.
- Include picocss for a minimal CSS framework
- Added some queries and models.Task properties
  to access the latest results
2023-10-13 09:43:47 +02:00
e2d8066746 Update API endpoints and test cases
- Adjusted test cases in test_api.py
  - Updated test_db fixture to delete the database between each test.
  - Consolidated test cases for tasks retrieval and results
2023-10-12 00:16:06 +02:00
43f8aabb2c Refactor server codebase for testing.
- Restructured server module to separate the application creation and configuration.
- Moved code dealing with SQLAlchemy database
  setup and teardown to the main application file.
- Moved functions related to configuration file loading to `argos.server.settings`.
- Fixed SQLAchemy expressions in `argos.server.queries`.
- Implemented a more granular system of setting checks' schedule on the server.
- Introduced frequency scheduling on per-website basis in the YAML config.
- Introduced Pytest fixtures for handling test database and authorized HTTP client in `tests/conftest.py`.
- Included a first test for the api
- Implemented changes to models to accommodate changes to task scheduling.
- Fixed errors concerning database concurrency arising from changes to the application setup.
2023-10-11 23:52:33 +02:00
e540eee9b3 Add the ability to convert to days, hours, minutes 2023-10-11 15:46:05 +02:00
daa22708c4 Make it possible to specify the frequency with '1d' 2023-10-11 11:11:57 +02:00
ca6584c803 Loop the agents and enhance the selection of tasks on the server 2023-10-10 19:24:50 +02:00
d35be89f4b Support !include filename in the yaml files.
- run isort on the codebase
2023-10-10 11:45:33 +02:00
cdfb1e30ac Add authorization headers
- Service endpoints now require an authentication
- Changed the location of the commands, which are now in `commands.py`
- There is now only one "argos" command which can start the server or an agent.
2023-10-10 11:30:16 +02:00
43e1767002 Refactor check config vlidation
- Refactored the `get_check_by_name` method to `get_registered_check` in the
  BaseCheck class and added a `get_registered_checks` method to get all the
  registered checks.
- Added a validation in the `WebsitePath` class to ensure that a check exists
  when parsing the configuration file.
- Updated the existing test for parsing SSL duration and added new tests to
  validate path parsing and check existence validation.
2023-10-10 10:04:46 +02:00
42ec15c6f4 Working SSL checks, refactoring of the codebase.
- Start implementing some tests using pytest
- Packaged using pyproject.toml
- Implemented SSL checks using httpx
- Checks can now run partially on the server, to access the configuration and determine the severity of the error if any
- Used black to format all the files
- Added an utility to convert strings like "3d" and "3w" to days
- The internal representation of SSL thresholds is now a list of tuples
- Models were lacking some relationship between Tasks and Results
2023-10-09 19:33:58 +02:00
d3c4f1e87b Implement SSL certificate expiration check
- Added pyOpenSSL to Pipfile and Pipfile.lock for SSL certificate expiration check implementation
- Implemented SSLCertificateExpiration check in checks.py
- Updated config.yaml with new test cases
- Minor changes and clean up in base.py and config.py
2023-10-07 00:19:36 +02:00
ff4588bc39 Refactor argos check and cli modules
- Added a simple way to have a registry for the checks.
- Use a Result dataclass to send back results from the workers
2023-10-05 11:36:36 +02:00
835ee50c1f Log errors that occured on the client side 2023-10-05 11:10:39 +02:00
fa092ad75b "/response" endpoint is now functional 2023-10-05 11:05:51 +02:00
f41e74d402 Refactor code to handle job failures on clients
- Added error handler `SerializableException` in models.py which gets error details from base exception
- Added an API to get the results back from the clients
2023-10-05 00:48:26 +02:00
0a4850c1ed First iterations of the client / server.
- Added new libraries to Pipfile: httpx and click
- Refactored the file structure
- Added new functionality in logging.py to set log level
- README.md now includes information about running the server, running the client, and a sample configuration file
- Started working on checks logic
2023-10-03 11:44:52 +02:00
8ac5cdb529 Updated models.py and queries.py
- Removed the `Definition` class and added the `Task` class. It contains all information needed to run the jobs on the workers.
- Added the `Result` class. It stores the results returned by workers.
- In queries.py, updated the `update_from_config` function. Now it checks for the existence of tasks with the same URL, check, and expected result before adding new ones.
2023-10-02 13:03:06 +02:00
eea465af5c Start working with FastAPI 2023-10-02 12:15:57 +02:00