From 257c4149745955436f8996d36222b333e082f351 Mon Sep 17 00:00:00 2001 From: r350178982 <32759763+r350178982@users.noreply.github.com> Date: Fri, 28 Nov 2025 16:27:31 +0800 Subject: [PATCH 1/4] add-metric-docs --- manual/administration/seafile_metrics.md | 48 ++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 49 insertions(+) create mode 100644 manual/administration/seafile_metrics.md diff --git a/manual/administration/seafile_metrics.md b/manual/administration/seafile_metrics.md new file mode 100644 index 00000000..1dd4d1c7 --- /dev/null +++ b/manual/administration/seafile_metrics.md @@ -0,0 +1,48 @@ +# Integrate Seafile Metrics with Third-Party Monitoring Tools +Seafile provides a standardized interface to expose system operational metrics, enabling integration with third-party monitoring tools such as Prometheus and Grafana. +This allows administrators to real-time monitor Seafile service status, including (but not limited to) I/O queue length and background task latency. + + +## Configuration Steps +To enable metric monitoring for Seafile, follow these steps: + +### 1. Enable Metric Exposure +Edit the Seafile configuration file `seahub_settings.py` (located in the Seafile configuration directory) and add the following configuration items. If the items already exist, update their values accordingly: + +```python +# Enable the metric exposure function (set to True to activate) +ENABLE_METRIC = True + +# Authentication username for monitoring tools (e.g., Prometheus) +# Used for HTTP Basic Authentication when accessing Seafile's metric endpoint +METRIC_AUTH_USER = "your_prometheus_username" + +# Authentication password corresponding to the above username +METRIC_AUTH_PWD = "your_prometheus_password" +``` + +> **Note**: Replace `your_prometheus_username` and `your_prometheus_password` with custom credentials (recommend using strong, unique passwords for security). + + +### 2. Configure Third-Party Monitoring Tools +After completing the above Seafile configuration, monitoring tools can retrieve Seafile metrics via the `/metrics` endpoint. Key requirements for tool configuration: + +* Endpoint: Seafile’s metric data is accessible at `http://:/metrics` (replace `` and `` with your Seafile server’s actual IP and port). +* Authentication: Use HTTP Basic Authentication and input the `METRIC_AUTH_USER` and `METRIC_AUTH_PWD` configured in Step 1. +* Data Scraping: For tools like Prometheus, configure a scrape job to periodically pull data from the `/metrics` endpoint (refer to Prometheus documentation for details). + + +For detailed configuration guides of monitoring tools, refer to the official documentation below: + +* [Prometheus Official Documentation - Configuration](https://prometheus.io/docs/prometheus/latest/getting_started/) + Learn how to set up Prometheus scrape jobs, data storage, and metric query rules. +* [Grafana Official Documentation - Prometheus Data Source](https://grafana.com/docs/grafana/latest/datasources/prometheus/) + Learn how to connect Grafana to Prometheus, create visual dashboards, and set up alert rules. + + +## Effect Description +Once the configuration is complete: + +1. Prometheus will periodically scrape Seafile metrics from the `/metrics` endpoint (based on the configured scrape interval). +2. You can create custom visual dashboards in Grafana (e.g., "Seafile Monitoring Dashboard" ) to visualize metrics in real time. +3. Alerts can be set up in Grafana (e.g., trigger an alert when Seafile storage usage exceeds 90%) to proactively monitor system health. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index d63dbc20..304c03f0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -188,6 +188,7 @@ nav: - Seafile FSCK: administration/seafile_fsck.md - Seafile GC: administration/seafile_gc.md - Clean database: administration/clean_database.md + - Integrate Seafile Metrics with Third-Party Monitoring Tools: administration/seafile_metrics.md - Upgrade: - Outline: upgrade/upgrade.md - Upgrade Seafile Docker: upgrade/upgrade_docker.md From 5778a96017229f960ff67ea917c8424ede18cda9 Mon Sep 17 00:00:00 2001 From: r350178982 <32759763+r350178982@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:12:06 +0800 Subject: [PATCH 2/4] update --- manual/administration/seafile_metrics.md | 11 +++++------ mkdocs.yml | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/manual/administration/seafile_metrics.md b/manual/administration/seafile_metrics.md index 1dd4d1c7..1522ae32 100644 --- a/manual/administration/seafile_metrics.md +++ b/manual/administration/seafile_metrics.md @@ -1,8 +1,7 @@ -# Integrate Seafile Metrics with Third-Party Monitoring Tools -Seafile provides a standardized interface to expose system operational metrics, enabling integration with third-party monitoring tools such as Prometheus and Grafana. +# Monitor Seafile with Prometheus +Seafile provides a standardized interface tailored to expose system operational metrics, enabling seamless integration with Prometheus and Grafana. This allows administrators to real-time monitor Seafile service status, including (but not limited to) I/O queue length and background task latency. - ## Configuration Steps To enable metric monitoring for Seafile, follow these steps: @@ -13,7 +12,7 @@ Edit the Seafile configuration file `seahub_settings.py` (located in the Seafile # Enable the metric exposure function (set to True to activate) ENABLE_METRIC = True -# Authentication username for monitoring tools (e.g., Prometheus) +# Authentication username # Used for HTTP Basic Authentication when accessing Seafile's metric endpoint METRIC_AUTH_USER = "your_prometheus_username" @@ -24,8 +23,8 @@ METRIC_AUTH_PWD = "your_prometheus_password" > **Note**: Replace `your_prometheus_username` and `your_prometheus_password` with custom credentials (recommend using strong, unique passwords for security). -### 2. Configure Third-Party Monitoring Tools -After completing the above Seafile configuration, monitoring tools can retrieve Seafile metrics via the `/metrics` endpoint. Key requirements for tool configuration: +### 2. Configure Prometheus +After completing the above Seafile configuration, Prometheus can retrieve Seafile metrics via the `/metrics` endpoint. Key requirements for such configuration: * Endpoint: Seafile’s metric data is accessible at `http://:/metrics` (replace `` and `` with your Seafile server’s actual IP and port). * Authentication: Use HTTP Basic Authentication and input the `METRIC_AUTH_USER` and `METRIC_AUTH_PWD` configured in Step 1. diff --git a/mkdocs.yml b/mkdocs.yml index 304c03f0..92e96c97 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -188,7 +188,7 @@ nav: - Seafile FSCK: administration/seafile_fsck.md - Seafile GC: administration/seafile_gc.md - Clean database: administration/clean_database.md - - Integrate Seafile Metrics with Third-Party Monitoring Tools: administration/seafile_metrics.md + - Monitor Seafile with Prometheus: administration/seafile_metrics.md - Upgrade: - Outline: upgrade/upgrade.md - Upgrade Seafile Docker: upgrade/upgrade_docker.md From 31d60aa7e969e6931c73c736cf74b60bb78abf15 Mon Sep 17 00:00:00 2001 From: r350178982 <32759763+r350178982@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:16:18 +0800 Subject: [PATCH 3/4] Update seafile_metrics.md --- manual/administration/seafile_metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/administration/seafile_metrics.md b/manual/administration/seafile_metrics.md index 1522ae32..cf797194 100644 --- a/manual/administration/seafile_metrics.md +++ b/manual/administration/seafile_metrics.md @@ -1,5 +1,5 @@ # Monitor Seafile with Prometheus -Seafile provides a standardized interface tailored to expose system operational metrics, enabling seamless integration with Prometheus and Grafana. +Seafile provides a standardized interface to expose system operational metrics, enabling integration with Prometheus and Grafana. This allows administrators to real-time monitor Seafile service status, including (but not limited to) I/O queue length and background task latency. ## Configuration Steps From 65a5fdc8a8ffd4445caa55e023fbe900de5d03f5 Mon Sep 17 00:00:00 2001 From: r350178982 <32759763+r350178982@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:10:17 +0800 Subject: [PATCH 4/4] Update seafile_metrics.md --- manual/administration/seafile_metrics.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manual/administration/seafile_metrics.md b/manual/administration/seafile_metrics.md index cf797194..dfce79a0 100644 --- a/manual/administration/seafile_metrics.md +++ b/manual/administration/seafile_metrics.md @@ -20,7 +20,8 @@ METRIC_AUTH_USER = "your_prometheus_username" METRIC_AUTH_PWD = "your_prometheus_password" ``` -> **Note**: Replace `your_prometheus_username` and `your_prometheus_password` with custom credentials (recommend using strong, unique passwords for security). +!!! Note + Replace `your_prometheus_username` and `your_prometheus_password` with custom credentials (recommend using strong, unique passwords for security). ### 2. Configure Prometheus