diff options
Diffstat (limited to 'packaging/cmake/pkg-files/deb/netdata')
-rw-r--r-- | packaging/cmake/pkg-files/deb/netdata/conffiles | 5 | ||||
-rw-r--r-- | packaging/cmake/pkg-files/deb/netdata/etc/default/netdata | 3 | ||||
-rwxr-xr-x | packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata | 56 | ||||
-rwxr-xr-x | packaging/cmake/pkg-files/deb/netdata/postinst | 53 | ||||
-rwxr-xr-x | packaging/cmake/pkg-files/deb/netdata/postrm | 55 | ||||
-rwxr-xr-x | packaging/cmake/pkg-files/deb/netdata/preinst | 26 |
6 files changed, 198 insertions, 0 deletions
diff --git a/packaging/cmake/pkg-files/deb/netdata/conffiles b/packaging/cmake/pkg-files/deb/netdata/conffiles new file mode 100644 index 000000000..1ec902547 --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/conffiles @@ -0,0 +1,5 @@ +/etc/default/netdata +/etc/init.d/netdata +/etc/logrotate.d/netdata +/etc/netdata/netdata.conf +/etc/netdata/netdata-updater.conf diff --git a/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata b/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata new file mode 100644 index 000000000..0bc847fe7 --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata @@ -0,0 +1,3 @@ +# Extra arguments to pass to netdata +# +EXTRA_OPTS="-P /var/run/netdata/netdata.pid" diff --git a/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata b/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata new file mode 100755 index 000000000..c2706caa5 --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata @@ -0,0 +1,56 @@ +#!/bin/sh +# Start/stop the netdata daemon. +# +### BEGIN INIT INFO +# Provides: netdata +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Real-time charts for system monitoring +# Description: Netdata is a daemon that collects data in realtime (per second) +# and presents a web site to view and analyze them. The presentation +# is also real-time and full of interactive charts that precisely +# render all collected values. +### END INIT INFO + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +DESC="netdata daemon" +NAME=netdata +DAEMON=/usr/sbin/netdata +PIDFILE=/var/run/netdata/netdata.pid +SCRIPTNAME=/etc/init.d/"$NAME" + +test -f $DAEMON || exit 0 + +. /lib/lsb/init-functions + +[ -r /etc/default/netdata ] && . /etc/default/netdata + +case "$1" in +start) log_daemon_msg "Starting real-time system monitoring" "netdata" + start_daemon -p $PIDFILE $DAEMON -P $PIDFILE $EXTRA_OPTS + log_end_msg $? + ;; +stop) log_daemon_msg "Stopping real-time system monitoring" "netdata" + killproc -p $PIDFILE $DAEMON + RETVAL=$? + [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE + log_end_msg $RETVAL + # wait for plugins to exit + sleep 1 + ;; +restart|force-reload) log_daemon_msg "Restarting real-time system monitoring" "netdata" + $0 stop + $0 start + ;; +status) + status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $? + ;; +*) log_action_msg "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" + exit 2 + ;; +esac +exit 0 diff --git a/packaging/cmake/pkg-files/deb/netdata/postinst b/packaging/cmake/pkg-files/deb/netdata/postinst new file mode 100755 index 000000000..97593c23b --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/postinst @@ -0,0 +1,53 @@ +#!/bin/sh + +set -e + +case "$1" in + configure|reconfigure) + if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata + fi + + if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata + fi + + if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata + fi + + if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata + fi + + if ! dpkg-statoverride --list /usr/share/netdata/www > /dev/null 2>&1; then + dpkg-statoverride --update --add root netdata 0755 /usr/share/netdata/www + fi + + dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1 + + grep /usr/libexec/netdata /var/lib/dpkg/info/netdata.list | xargs -n 30 chown root:netdata + + for f in ndsudo cgroup-network local-listeners ioping.plugin; do + chmod 4750 "/usr/libexec/netdata/plugins.d/${f}" || true + done + + ;; +esac + +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + deb-systemd-helper unmask 'netdata.service' >/dev/null || true + + if deb-systemd-helper --quiet was-enabled 'netdata.service'; then + deb-systemd-helper enable 'netdata.service' >/dev/null || true + else + deb-systemd-helper update-state 'netdata.service' >/dev/null || true + fi + + if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke restart 'netdata.service' >/dev/null || true + fi +fi + +exit 0 diff --git a/packaging/cmake/pkg-files/deb/netdata/postrm b/packaging/cmake/pkg-files/deb/netdata/postrm new file mode 100755 index 000000000..7a636863b --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/postrm @@ -0,0 +1,55 @@ +#!/bin/sh + +set -e + +case "$1" in + remove) ;; + + purge) + if dpkg-statoverride --list | grep -qw /var/cache/netdata; then + dpkg-statoverride --remove /var/cache/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata/www; then + dpkg-statoverride --remove /var/lib/netdata/www + fi + + if dpkg-statoverride --list | grep -qw /usr/share/netdata/www; then + dpkg-statoverride --remove /usr/share/netdata/www + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata/registry; then + dpkg-statoverride --remove /var/lib/netdata/registry + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata; then + dpkg-statoverride --remove /var/lib/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/run/netdata; then + dpkg-statoverride --remove /var/run/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/log/netdata; then + dpkg-statoverride --remove /var/log/netdata + fi + ;; + + *) ;; + +esac + +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask 'netdata.service' >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge 'netdata.service' >/dev/null || true + deb-systemd-helper unmask 'netdata.service' >/dev/null || true + fi +fi + +exit 0 diff --git a/packaging/cmake/pkg-files/deb/netdata/preinst b/packaging/cmake/pkg-files/deb/netdata/preinst new file mode 100755 index 000000000..6dcf201d6 --- /dev/null +++ b/packaging/cmake/pkg-files/deb/netdata/preinst @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +case "$1" in + install) + if ! getent group netdata > /dev/null; then + addgroup --quiet --system netdata + fi + + if ! getent passwd netdata > /dev/null; then + adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata + fi + + for item in docker nginx varnish haproxy adm nsd proxy squid ceph nobody I2C; do + if getent group $item > /dev/null 2>&1; then + usermod -a -G $item netdata + fi + done + # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/* + # for reading VMs/containers names, CPU and memory limits on Proxmox. + if [ -d "/etc/pve" ] && getent group "www-data" > /dev/null 2>&1; then + usermod -a -G www-data netdata + fi + ;; +esac |