Add support for metrics..

This commit is contained in:
Christoph 2025-04-24 18:34:03 +02:00
parent a4c091c2f5
commit 32128041a3

View File

@ -28,6 +28,7 @@ PHP_VERSION=8.3
WEBSITE="cloud-test.oopen.de" WEBSITE="cloud-test.oopen.de"
WEBSITE="cloud-02-test.oopen.de" WEBSITE="cloud-02-test.oopen.de"
WEBSITE="cloud-01.oopen.de" WEBSITE="cloud-01.oopen.de"
WEBSITE="cloud-test-01.oopen.de"
WEB_BASE_DIR="/var/www/${WEBSITE}" WEB_BASE_DIR="/var/www/${WEBSITE}"
NC_INSTALL_DIR="${WEB_BASE_DIR}/nextcloud" NC_INSTALL_DIR="${WEB_BASE_DIR}/nextcloud"
@ -78,7 +79,7 @@ systemctl restart apache2
# proxy_set_header Connection "Upgrade"; # proxy_set_header Connection "Upgrade";
# proxy_set_header Host $host; # proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# } }
# reload nginx # reload nginx
# #
@ -109,6 +110,21 @@ systemctl restart php-${PHP_VERSION}-fpm
# 4 Create Service 'notify_push' # 4 Create Service 'notify_push'
# ================================ # ================================
# #
# Metrics
#
# The push server can expose some basic metrics about the number of connected clients and
# the traffic flowing through the server by setting the METRICS_PORT environment variable.
#
# Once set the metrics are available in a prometheus compatible format at /metrics on the
# configured port. Inside the service file set:
#
# Environment=METRICS_PORT=7868
#
# Run 'curl http://localhost:7868/metrics
#
# Additionally you can manually check the metrics by running the occ notify_push:metrics
# command, this will function even if you haven't setup METRICS_PORT.
#
cat <<EOF > /etc/systemd/system/notify_push.service cat <<EOF > /etc/systemd/system/notify_push.service
[Unit] [Unit]
Description = Push daemon for Nextcloud clients Description = Push daemon for Nextcloud clients
@ -116,7 +132,9 @@ Documentation=https://github.com/nextcloud/notify_push
[Service] [Service]
# Change if you already have something running on this port # Change if you already have something running on this port
Environment=PORT=7867 Environment=PORT=7867A
# Run 'curl http://localhost:7868/metrics' to eee some metrivcs
Environment=METRICS_PORT=7868
Environment=NEXTCLOUD_URL=https://${WEBSITE} Environment=NEXTCLOUD_URL=https://${WEBSITE}
ExecStart=${NC_INSTALL_DIR}/apps/notify_push/bin/x86_64/notify_push ${NC_INSTALL_DIR}/config/config.php ExecStart=${NC_INSTALL_DIR}/apps/notify_push/bin/x86_64/notify_push ${NC_INSTALL_DIR}/config/config.php
# requires the push server to have been build with the systemd feature (enabled by default) # requires the push server to have been build with the systemd feature (enabled by default)