Skip to content

Commit 2fbb82d

Browse files
Merge pull request #1444 from feature/custom-prometheus-exporter
Add custom metrics exporter
2 parents 99a3c45 + d42a0c8 commit 2fbb82d

13 files changed

Lines changed: 408 additions & 38 deletions

File tree

bin/ncp-dist-upgrade

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ sleep 2 # avoid systemd thinking that PHP is in a crash/restart loop
8989
$APTINSTALL -t ${release_new} php${php_ver_new}-gmp
9090
#$APTINSTALL -t ${release_new} imagemagick php${php_ver_new}-imagick ghostscript
9191

92+
# Reinstall prometheus-node-exporter, specifically WITH install-recommends to include collectors on bullseye and later
93+
{ dpkg -l | grep '^ii.*prometheus-node-exporter' >/dev/null && apt-get install -y prometheus-node-exporter-collectors; } || true
94+
9295
apt-get autoremove -y
9396
apt-get clean
9497

bin/ncp-update

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# update latest NextCloudPi code from github
44

5+
[[ -z "$DBG" ]] || set -$DBG
6+
57
{
68
[ "$(id -u)" -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; }
79

bin/ncp/BACKUPS/nc-backup-auto.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
88
#
99

10+
tmpl_get_destination() {
11+
(
12+
. /usr/local/etc/library.sh
13+
find_app_param nc-backup-auto DESTDIR
14+
)
15+
}
16+
1017
configure()
1118
{
1219
[[ $ACTIVE != "yes" ]] && {
@@ -44,6 +51,11 @@ EOF
4451
chmod 644 /etc/cron.d/ncp-backup-auto
4552
service cron restart
4653

54+
(
55+
. "${BINDIR}/SYSTEM/metrics.sh"
56+
reload_metrics_config
57+
)
58+
4759
echo "automatic backups enabled"
4860
}
4961

bin/ncp/BACKUPS/nc-backup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
88
#
99

10+
tmpl_get_destination() {
11+
(
12+
. /usr/local/etc/library.sh
13+
find_app_param nc-backup DESTDIR
14+
)
15+
}
16+
1017
install()
1118
{
1219
apt-get update
@@ -123,6 +130,10 @@ EOF
123130

124131
configure()
125132
{
133+
(
134+
. "${BINDIR}/SYSTEM/metrics.sh"
135+
reload_metrics_config
136+
)
126137
ncp-backup "$DESTDIR" "$INCLUDEDATA" "$COMPRESS" "$BACKUPLIMIT"
127138
}
128139

bin/ncp/BACKUPS/nc-snapshot-sync.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@
99
#
1010

1111

12+
tmpl_get_destination() {
13+
(
14+
. /usr/local/etc/library.sh
15+
find_app_param nc-snapshot-sync DESTINATION
16+
)
17+
}
18+
19+
tmpl_is_destination_local() {
20+
(
21+
. /usr/local/etc/library.sh
22+
is_active_app nc-snapshot-sync || exit 1
23+
! [[ "$(find_app_param nc-snapshot-sync DESTINATION)" =~ .*"@".*":".* ]]
24+
)
25+
}
26+
27+
is_active() {
28+
[[ $ACTIVE == "yes" ]]
29+
}
30+
1231
install()
1332
{
1433
apt-get update
@@ -46,6 +65,12 @@ configure()
4665
echo "30 4 */${SYNCDAYS} * * root /usr/local/bin/btrfs-sync -qd $ZIP \"$SNAPDIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-snapsync-auto
4766
chmod 644 /etc/cron.d/ncp-snapsync-auto
4867
service cron restart
68+
69+
(
70+
. "${BINDIR}/SYSTEM/metrics.sh"
71+
reload_metrics_config
72+
)
73+
4974
echo "snapshot sync enabled"
5075
}
5176

bin/ncp/CONFIG/nc-datadir.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ configure()
113113
sed -i "s|logpath =.*nextcloud.log|logpath = ${DATADIR}/nextcloud.log|" /etc/fail2ban/jail.local
114114

115115
restore_maintenance_mode
116+
117+
(
118+
. "${BINDIR}/SYSTEM/metrics.sh"
119+
reload_metrics_config
120+
)
116121
}
117122

118123
# License

bin/ncp/CONFIG/nc-nextcloud.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ EOF
215215
cat > /etc/systemd/system/notify_push.service <<EOF
216216
[Unit]
217217
Description = Push daemon for Nextcloud clients
218-
After = mysql.service
218+
After=mysql.service
219+
After=redis.service
220+
Requires=redis.service
219221
220222
[Service]
221-
Environment = PORT=7867
222-
Environment = NEXTCLOUD_URL=https://localhost
223-
ExecStart = /var/www/nextcloud/apps/notify_push/bin/"${arch}"/notify_push --allow-self-signed /var/www/nextcloud/config/config.php
223+
Environment=PORT=7867
224+
Environment=NEXTCLOUD_URL=https://localhost
225+
ExecStart=/var/www/nextcloud/apps/notify_push/bin/"${arch}"/notify_push --allow-self-signed /var/www/nextcloud/config/config.php
224226
User=www-data
225227
226228
[Install]

0 commit comments

Comments
 (0)