From 39a11836f1f31145ebcd85e599e8d47dab107018 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 13 Jan 2025 18:13:55 +0930 Subject: [PATCH] docs(administration): Add metrics ref: #156 #469 --- Release-Notes.md | 5 ++ .../centurion_erp/administration/index.md | 2 + .../administration/monitoring.md | 51 +++++++++++++++++++ mkdocs.yml | 2 + 4 files changed, 60 insertions(+) create mode 100644 docs/projects/centurion_erp/administration/monitoring.md diff --git a/Release-Notes.md b/Release-Notes.md index 9a5be712..20ce8e45 100644 --- a/Release-Notes.md +++ b/Release-Notes.md @@ -1,3 +1,8 @@ +## Version 1.8.0 + +- Prometheus exporter added. To enable metrics for the database you will have to update the database backend. see the [docs](https://nofusscomputing.com/projects/centurion_erp/administration/monitoring/#django-exporter-setup) for further information. + + ## Version 1.5.0 - When v1.4.0 was release the migrations were not merged. As part of the work conducted on this release the v1.4 migrations have been squashed. This should not have any effect on any system that when they updated to v1.4, they ran the migrations and they **completed successfully**. Upgrading from <1.4.0 to this release should also have no difficulties as the migrations required still exist. There are less of them, however with more work per migration. diff --git a/docs/projects/centurion_erp/administration/index.md b/docs/projects/centurion_erp/administration/index.md index 375ae03f..ded0cb04 100644 --- a/docs/projects/centurion_erp/administration/index.md +++ b/docs/projects/centurion_erp/administration/index.md @@ -17,6 +17,8 @@ This documentation is targeted towards those whom administer the applications de - [Installation](./installation.md) +- [Monitoring](./monitoring.md) + ## Ansible Automation Platform / AWX diff --git a/docs/projects/centurion_erp/administration/monitoring.md b/docs/projects/centurion_erp/administration/monitoring.md new file mode 100644 index 00000000..07cb8b61 --- /dev/null +++ b/docs/projects/centurion_erp/administration/monitoring.md @@ -0,0 +1,51 @@ +--- +title: Monitoring +description: Monitoring documentation for Centurion ERP by No Fuss Computing +date: 2025-01-13 +template: project.html +about: https://github.com/nofusscomputing/centurion_erp +--- + +Monitoring a deployed application is paramount so as to ensure that it is functioning as intended. Without monitoring attempts to fault find an issue become very difficult. Especially when the application has a lot of moving parts. Centurion ERP is no exception. + + +## Monitoring + +To assist in monitoring Centurion ERP, the following features exist: + +- Prometheus exporters + +- logging _[see #436](https://github.com/nofusscomputing/centurion_erp/issues/436) for more details_ + + +## Prometheus Exporters + +Currently we have exporters setup for the following components: + +- Django + +- Celery Worker, (Django) + +- Celery Worker, (Celery) + +- NGinX + + +### Django Exporter Setup + +The Django exporter provides metrics on the Django application and a small number of database details. To setup the Django exporter, the following settings are required: + +``` py +# Metrics default values +METRICS_ENABLED = False # Enable Metrics +METRICS_EXPORT_PORT = 8080 # Port to serve metrics on +METRICS_MULTIPROC_DIR = '/tmp/prometheus' # path the metrics from multiple-process' save to + +``` + +Enabling metrics is as simple as adding `METRICS_ENABLED = True` to your Centurion Config File and having prometheus scrape the endpoint. This setting activates the metrics endpoint for both Centurion API and the Centurion Worker. As such, the setting will need to be set in both containers. + +!!! danger + The prometheus endpoint is not secured. As such you are advised against exposing the port publically. + +Monitoring of database transactions is possible, however does require that you undate your database backend. for instance, if your using postgres db, the normal backend would be `django.db.backends.postgresql_psycopg2`. This backend does not monitor the database, so it must be modified. this is done by using the prometheus backend `django_prometheus.db.backends.`. So the postgres backend will end up being `django_prometheus.db.backends.postgresql_psycopg2`. The prometheus backend "prefix" is the same for **ALL** backends. diff --git a/mkdocs.yml b/mkdocs.yml index 70dfc930..1227ed41 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -67,6 +67,8 @@ nav: - projects/centurion_erp/administration/installation.md + - projects/centurion_erp/administration/monitoring.md + - Development: - projects/centurion_erp/development/index.md