3 # reload the user profile
4 [ -f /etc/profile ] && . /etc/profile
6 # fix PKG_CHECK_MODULES error
7 if [ -d /usr/share/aclocal ]
9 ACLOCAL_PATH=${ACLOCAL_PATH-/usr/share/aclocal}
16 # you can set CFLAGS before running installer
17 CFLAGS="${CFLAGS--O3}"
19 # keep a log of this command
20 printf "\n# " >>netdata-installer.log
21 date >>netdata-installer.log
22 printf "CFLAGS=\"%s\" " "${CFLAGS}" >>netdata-installer.log
23 printf "%q " "$0" "${@}" >>netdata-installer.log
24 printf "\n" >>netdata-installer.log
35 ${ME} <installer options>
37 Valid <installer options> are:
39 --install /PATH/TO/INSTALL
41 If your give: --install /opt
42 netdata will be installed in /opt/netdata
46 Do not (re)start netdata.
51 Do not wait for the user to press ENTER.
52 Start immediately building it.
55 --libs-are-really-here
57 If you get errors about missing zlib,
58 or libuuid but you know it is available,
59 you have a broken pkg-config.
60 Use this option to allow it continue
61 without checking pkg-config.
63 Netdata will by default be compiled with gcc optimization -O3
64 If you need to pass different CFLAGS, use something like this:
66 CFLAGS="<gcc options>" ${ME} <installer options>
68 For the installer to complete successfully, you will need
69 these packages installed:
71 gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel)
72 uuid-dev (or libuuid-devel)
74 For the plugins, you will at least need:
81 md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null)"
82 get_git_config_signatures() {
85 [ ! -d "conf.d" ] && echo >&2 "Wrong directory." && return 1
86 [ -z "${md5sum}" -o ! -x "${md5sum}" ] && echo >&2 "No md5sum command." && return 1
88 echo >configs.signatures.tmp
90 for x in $(find conf.d -name \*.conf)
94 for c in $(git log --follow "conf.d/${x}" | grep ^commit | cut -d ' ' -f 2)
96 git checkout ${c} "conf.d/${x}" || continue
97 s="$(cat "conf.d/${x}" | md5sum | cut -d ' ' -f 1)"
98 echo >>configs.signatures.tmp "${x}:${s}"
101 git checkout HEAD "conf.d/${x}" || break
104 cat configs.signatures.tmp |\
108 echo "declare -A configs_signatures=("
112 echo " ['${md5}']='${file}'"
115 } >configs.signatures
117 rm configs.signatures.tmp
123 while [ ! -z "${1}" ]
125 if [ "$1" = "--install" ]
127 NETDATA_PREFIX="${2}/netdata"
129 elif [ "$1" = "--zlib-is-really-here" -o "$1" = "--libs-are-really-here" ]
133 elif [ "$1" = "--dont-start-it" ]
137 elif [ "$1" = "--dont-wait" ]
141 elif [ "$1" = "--help" -o "$1" = "-h" ]
145 elif [ "$1" = "get_git_config_signatures" ]
147 get_git_config_signatures && exit 0
152 echo >&2 "I cannot understand option '$1'."
161 Nice to see you are giving it a try!
163 You are about to build and install netdata to your system.
165 It will be installed at these locations:
167 - the daemon at ${NETDATA_PREFIX}/usr/sbin/netdata
168 - config files at ${NETDATA_PREFIX}/etc/netdata
169 - web files at ${NETDATA_PREFIX}/usr/share/netdata
170 - plugins at ${NETDATA_PREFIX}/usr/libexec/netdata
171 - cache files at ${NETDATA_PREFIX}/var/cache/netdata
172 - db files at ${NETDATA_PREFIX}/var/lib/netdata
173 - log files at ${NETDATA_PREFIX}/var/log/netdata
174 - pid file at ${NETDATA_PREFIX}/var/run
176 This installer allows you to change the installation path.
177 Press Control-C and run the same command with --help for help.
181 if [ "${UID}" -ne 0 ]
183 if [ -z "${NETDATA_PREFIX}" ]
185 cat <<-NONROOTNOPREFIX
187 Sorry! This will fail!
189 You are attempting to install netdata as non-root, but you plan to install it
192 Please set an installation prefix, like this:
194 $0 ${@} --install /tmp
196 or, run the installer as root:
200 We suggest to install it as root, or certain data collectors will not be able
201 to work. Netdata drops root privileges when running. So, if you plan to keep
202 it, install it as root to get the full functionality.
211 You are about to install netdata as a non-root user.
212 Netdata will work, but a few data collection modules that
213 require root access will fail.
215 If you installing permanently on your system, run the
225 if [ "$(type autoreconf 2> /dev/null)" ]
233 set -- $(autoreconf -V | sed -ne '1s/.* \([^ ]*\)$/\1/p')
234 eval $maj=\$1 $min=\$2
236 autoconf_maj_min AMAJ AMIN
241 elif [ "$AMAJ" -eq 2 -a "$AMIN" -ge 60 ]
245 echo "Found autotools $AMAJ.$AMIN"
248 echo "No autotools found"
251 if [ ! "$have_autotools" ]
255 echo "Will skip autoreconf step"
259 -------------------------------------------------------------------------------
260 autotools 2.60 or later is required
262 Sorry, you do not seem to have autotools 2.60 or later, which is
263 required to build from the git sources of netdata.
265 You can either install a suitable version of autotools and automake
266 or download a netdata package which does not have these dependencies.
268 Source packages where autotools have already been run are available
270 https://firehol.org/download/netdata/
272 The unsigned/master folder tracks the head of the git tree and released
273 packages are also available.
279 if [ ${DONOTWAIT} -eq 0 ]
281 if [ ! -z "${NETDATA_PREFIX}" ]
283 read -p "Press ENTER to build and install netdata to '${NETDATA_PREFIX}' > "
285 read -p "Press ENTER to build and install netdata to your system > "
292 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
294 Sorry! NetData failed to build...
296 You many need to check these:
298 1. The package uuid-dev (or libuuid-devel) has to be installed.
300 If your system cannot find libuuid, although it is installed
301 run me with the option: --libs-are-really-here
303 2. The package zlib1g-dev (or zlib-devel) has to be installed.
305 If your system cannot find zlib, although it is installed
306 run me with the option: --libs-are-really-here
308 3. You need basic build tools installed, like:
310 gcc make autoconf automake pkg-config
312 Autoconf version 2.60 or higher is required.
314 If you still cannot get it to build, ask for help at github:
316 https://github.com/firehol/netdata/issues
325 printf >>netdata-installer.log "# "
326 printf >>netdata-installer.log "%q " "${@}"
327 printf >>netdata-installer.log " ... "
330 printf >&2 ":-----------------------------------------------------------------------------\n"
331 printf >&2 "Running command:\n"
333 printf >&2 "%q " "${@}"
341 printf >>netdata-installer.log "FAILED!\n"
343 printf >>netdata-installer.log "OK\n"
349 if [ ${LIBS_ARE_HERE} -eq 1 ]
352 echo >&2 "ok, assuming libs are really installed."
353 export ZLIB_CFLAGS=" "
354 export ZLIB_LIBS="-lz"
355 export UUID_CFLAGS=" "
356 export UUID_LIBS="-luuid"
359 trap build_error EXIT
361 if [ "$have_autotools" ]
363 run ./autogen.sh || exit 1
367 --prefix="${NETDATA_PREFIX}/usr" \
368 --sysconfdir="${NETDATA_PREFIX}/etc" \
369 --localstatedir="${NETDATA_PREFIX}/var" \
370 --with-zlib --with-math --with-user=netdata \
371 CFLAGS="${CFLAGS}" || exit 1
373 # remove the build_error hook
376 if [ -f src/netdata ]
378 echo >&2 "Cleaning a possibly old compilation ..."
382 echo >&2 "Compiling netdata ..."
385 declare -A configs_signatures=()
386 if [ -f "configs.signatures" ]
388 source "configs.signatures" || echo >&2 "ERROR: Failed to load configs.signatures !"
391 # migrate existing configuration files
392 # for node.d and charts.d
393 if [ -d "${NETDATA_PREFIX}/etc/netdata" ]
395 # the configuration directory exists
397 if [ ! -d "${NETDATA_PREFIX}/etc/netdata/charts.d" ]
399 run mkdir "${NETDATA_PREFIX}/etc/netdata/charts.d"
402 # move the charts.d config files
403 for x in apache ap cpu_apps cpufreq example exim hddtemp load_average mem_apps mysql nginx nut opensips phpfpm postfix sensors squid tomcat
405 for y in "" ".old" ".orig"
407 if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" -a ! -f "${NETDATA_PREFIX}/etc/netdata/charts.d/${x}.conf${y}" ]
409 run mv -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" "${NETDATA_PREFIX}/etc/netdata/charts.d/${x}.conf${y}"
414 if [ ! -d "${NETDATA_PREFIX}/etc/netdata/node.d" ]
416 run mkdir "${NETDATA_PREFIX}/etc/netdata/node.d"
419 # move the node.d config files
420 for x in named sma_webbox snmp
422 for y in "" ".old" ".orig"
424 if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" -a ! -f "${NETDATA_PREFIX}/etc/netdata/node.d/${x}.conf${y}" ]
426 run mv -f "${NETDATA_PREFIX}/etc/netdata/${x}.conf${y}" "${NETDATA_PREFIX}/etc/netdata/node.d/${x}.conf${y}"
432 # backup user configurations
433 installer_backup_suffix="${PID}.${RANDOM}"
434 for x in $(find "${NETDATA_PREFIX}/etc/netdata/" -name '*.conf' -type f)
438 # make a backup of the configuration file
439 cp -p "${x}" "${x}.old"
441 if [ -z "${md5sum}" -o ! -x "${md5sum}" ]
443 # we don't have md5sum - keep it
444 cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}"
446 # find it relative filename
447 f="${x/*\/etc\/netdata\//}"
450 md5="$(cat "${x}" | ${md5sum} | cut -d ' ' -f 1)"
453 if [ -f "conf.d/${f}" ]
455 cp "conf.d/${f}" "${x}.orig"
458 if [ "${configs_signatures[${md5}]}" = "${f}" ]
460 # it is a stock version - don't keep it
461 echo >&2 "File '${x}' is stock version."
463 # edited by user - keep it
464 echo >&2 "File '${x}' has been edited by user."
465 cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}"
469 elif [ -f "${x}.installer_backup.${installer_backup_suffix}" ]
471 rm -f "${x}.installer_backup.${installer_backup_suffix}"
475 echo >&2 "Installing netdata ..."
476 run make install || exit 1
478 # restore user configurations
479 for x in $(find "${NETDATA_PREFIX}/etc/netdata/" -name '*.conf' -type f)
481 if [ -f "${x}.installer_backup.${installer_backup_suffix}" ]
483 cp -p "${x}.installer_backup.${installer_backup_suffix}" "${x}"
484 rm -f "${x}.installer_backup.${installer_backup_suffix}"
488 NETDATA_ADDED_TO_DOCKER=0
491 getent group netdata > /dev/null
494 echo >&2 "Adding netdata user group ..."
495 run groupadd -r netdata
498 getent passwd netdata > /dev/null
501 echo >&2 "Adding netdata user account ..."
502 run useradd -r -g netdata -c netdata -s $(which nologin || echo '/bin/false') -d / netdata
505 getent group docker > /dev/null
508 # find the users in the docker group
509 docker=$(getent group docker | cut -d ':' -f 4)
510 if [[ ",${docker}," =~ ,netdata, ]]
512 # netdata is already there
515 # netdata is not in docker group
516 echo >&2 "Adding netdata user to the docker group (needed to get container names) ..."
517 run usermod -a -G docker netdata
519 # let the uninstall script know
520 NETDATA_ADDED_TO_DOCKER=1
523 if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ]
525 echo >&2 "Adding netdata logrotate configuration ..."
526 run cp system/netdata.logrotate /etc/logrotate.d/netdata
531 # -----------------------------------------------------------------------------
532 # load options from the configuration file
534 # create an empty config if it does not exist
535 [ ! -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ] && touch "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
537 # function to extract values from the config file
539 local key="${1}" value="${2}" line=
541 if [ -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
543 line="$( grep "^[[:space:]]*${key}[[:space:]]*=[[:space:]]*" "${NETDATA_PREFIX}/etc/netdata/netdata.conf" | head -n 1 )"
544 [ ! -z "${line}" ] && value="$( echo "${line}" | cut -d '=' -f 2 | sed -e "s/^[[:space:]]\+//g" -e "s/[[:space:]]\+$//g" )"
552 [ ! "${UID}" = "0" ] && defuser="${USER}"
553 NETDATA_USER="$( config_option "run as user" "${defuser}" )"
555 NETDATA_WEB_USER="$( config_option "web files owner" "${defuser}" )"
556 NETDATA_WEB_GROUP="$( config_option "web files group" "${NETDATA_WEB_USER}" )"
560 NETDATA_DEBUG="$( config_option "debug flags" ${defdebug} )"
564 NETDATA_PORT="$( config_option "default port" ${defport} )"
565 NETDATA_PORT2="$( config_option "port" ${defport} )"
567 if [ "${NETDATA_PORT}" != "${NETDATA_PORT2}" ]
569 if [ "${NETDATA_PORT2}" != "${defport}" ]
571 NETDATA_PORT="${NETDATA_PORT2}"
576 NETDATA_LIB_DIR="$( config_option "lib directory" "${NETDATA_PREFIX}/var/lib/netdata" )"
577 NETDATA_CACHE_DIR="$( config_option "cache directory" "${NETDATA_PREFIX}/var/cache/netdata" )"
578 NETDATA_WEB_DIR="$( config_option "web files directory" "${NETDATA_PREFIX}/usr/share/netdata/web" )"
579 NETDATA_LOG_DIR="$( config_option "log directory" "${NETDATA_PREFIX}/var/log/netdata" )"
580 NETDATA_CONF_DIR="$( config_option "config directory" "${NETDATA_PREFIX}/etc/netdata" )"
581 NETDATA_RUN_DIR="${NETDATA_PREFIX}/var/run"
584 # -----------------------------------------------------------------------------
585 # prepare the directories
587 # this is needed if NETDATA_PREFIX is not empty
588 if [ ! -d "${NETDATA_RUN_DIR}" ]
590 mkdir -p "${NETDATA_RUN_DIR}" || exit 1
594 echo >&2 "Fixing directories (user: ${NETDATA_USER})..."
595 for x in "${NETDATA_WEB_DIR}" "${NETDATA_CONF_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}" "${NETDATA_LIB_DIR}" "${NETDATA_CONF_DIR}/python.d" "${NETDATA_CONF_DIR}/charts.d" "${NETDATA_CONF_DIR}/node.d"
599 echo >&2 "Creating directory '${x}'"
600 run mkdir -p "${x}" || exit 1
605 if [ "${x}" = "${NETDATA_WEB_DIR}" ]
607 run chown -R "${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}" "${x}" || echo >&2 "WARNING: Cannot change the ownership of the files in directory ${x} to ${NETDATA_WEB_USER}:${NETDATA_WEB_GROUP}..."
609 run chown -R "${NETDATA_USER}:${NETDATA_USER}" "${x}" || echo >&2 "WARNING: Cannot change the ownership of the files in directory ${x} to ${NETDATA_USER}..."
613 run chmod 0755 "${x}" || echo >&2 "WARNING: Cannot change the permissions of the directory ${x} to 0755..."
618 run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
619 run chmod 0755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
620 run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
623 # fix apps.plugin to be setuid to root
624 run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
625 run chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
629 # -----------------------------------------------------------------------------
630 # check if we can re-start netdata
632 if [ ${DONOTSTART} -eq 1 ]
634 if [ ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
636 echo >&2 "Generating empty config file in: ${NETDATA_PREFIX}/etc/netdata/netdata.conf"
637 echo "# Get config from http://127.0.0.1:${NETDATA_PORT}/netdata.conf" >"${NETDATA_PREFIX}/etc/netdata/netdata.conf"
639 if [ "${UID}" -eq 0 ]
641 chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
643 chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
645 echo >&2 "OK. It is now installed and ready."
649 # -----------------------------------------------------------------------------
650 # stop a running netdata
653 [ -z "$1" -o ! -f "/proc/$1/stat" ] && return 1
654 [ "$(cat "/proc/$1/stat" | cut -d '(' -f 2 | cut -d ')' -f 1)" = "netdata" ] && return 0
658 stop_netdata_on_pid() {
659 local pid="$1" ret=0 count=0
661 isnetdata $pid || return 0
663 printf >&2 "Stopping netdata on pid $pid ..."
664 while [ ! -z "$pid" -a $ret -eq 0 ]
668 echo >&2 "Cannot stop the running netdata on pid $pid."
672 count=$(( count + 1 ))
674 run kill $pid 2>/dev/null
677 test $ret -eq 0 && printf >&2 "." && sleep 2
683 echo >&2 "SORRY! CANNOT STOP netdata ON PID $pid !"
687 echo >&2 "netdata on pid $pid stopped."
694 echo >&2 "Stopping a (possibly) running netdata..."
696 for p in $(cat "${NETDATA_RUN_DIR}/netdata.pid" 2>/dev/null) \
697 $(cat /var/run/netdata.pid 2>/dev/null) \
698 $(cat /var/run/netdata/netdata.pid 2>/dev/null) \
699 $(pidof netdata 2>/dev/null)
701 stop_netdata_on_pid $p
705 # -----------------------------------------------------------------------------
706 # check netdata for systemd
709 # if the directory /etc/systemd/system does not exit, it is not systemd
710 [ ! -d /etc/systemd/system ] && return 1
712 # if pid 1 is systemd, it is systemd
713 [ "$(basename $(readlink /proc/1/exe) 2>/dev/null)" = "systemd" ] && return 0
715 # if systemd is running, it is systemd
716 pidof systemd >/dev/null 2>&1 && return 0
718 # else, it is not systemd
723 if [ "${UID}" -eq 0 ]
728 # systemd is running on this system
730 if [ ! -f /etc/systemd/system/netdata.service ]
732 echo >&2 "Installing systemd service..."
733 run cp system/netdata.service /etc/systemd/system/netdata.service && \
734 run systemctl daemon-reload && \
735 run systemctl enable netdata
737 run service netdata stop
741 run service netdata restart && started=1
744 if [ ${started} -eq 0 ]
746 # check if we can use the system service
747 run service netdata stop
749 run service netdata restart && started=1
750 if [ ${started} -eq 0 ]
752 run service netdata start && started=1
757 if [ ${started} -eq 0 ]
759 # still not started...
763 echo >&2 "Starting netdata..."
764 run ${NETDATA_PREFIX}/usr/sbin/netdata -P ${NETDATA_RUN_DIR}/netdata.pid "${@}"
768 echo >&2 "SORRY! FAILED TO START NETDATA!"
771 echo >&2 "OK. NetData Started!"
777 # -----------------------------------------------------------------------------
778 # save a config file, if it is not already there
780 if [ ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
783 echo >&2 "-------------------------------------------------------------------------------"
785 echo >&2 "Downloading default configuration from netdata..."
788 # remove a possibly obsolete download
789 [ -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ] && rm "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new"
791 # disable a proxy to get data from the local netdata
796 wget 2>/dev/null -O "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "http://localhost:${NETDATA_PORT}/netdata.conf"
800 if [ $ret -ne 0 -o ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ]
802 curl -s -o "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "http://localhost:${NETDATA_PORT}/netdata.conf"
806 if [ $ret -eq 0 -a -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ]
808 mv "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
809 echo >&2 "New configuration saved for you to edit at ${NETDATA_PREFIX}/etc/netdata/netdata.conf"
811 if [ "${UID}" -eq 0 ]
813 chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
815 chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
817 echo >&2 "Cannnot download configuration from netdata daemon using url 'http://localhost:${NETDATA_PORT}/netdata.conf'"
818 [ -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ] && rm "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new"
822 # -----------------------------------------------------------------------------
825 ksm_is_available_but_disabled() {
828 -------------------------------------------------------------------------------
829 Memory de-duplication instructions
831 You have kernel memory de-duper (called Kernel Same-page Merging,
832 or KSM) available, but it is not currently enabled.
836 echo 1 >/sys/kernel/mm/ksm/run
837 echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs
839 If you enable it, you will save 40-60% of netdata memory.
844 ksm_is_not_available() {
847 -------------------------------------------------------------------------------
848 Memory de-duplication not present in your kernel
850 It seems you do not have kernel memory de-duper (called Kernel Same-page
851 Merging, or KSM) available.
853 To enable it, you need a kernel built with CONFIG_KSM=y
855 If you can have it, you will save 40-60% of netdata memory.
860 if [ -f "/sys/kernel/mm/ksm/run" ]
862 if [ $(cat "/sys/kernel/mm/ksm/run") != "1" ]
864 ksm_is_available_but_disabled
870 # -----------------------------------------------------------------------------
871 # Check for version.txt
873 if [ ! -s web/version.txt ]
877 -------------------------------------------------------------------------------
878 Version update check warning
880 The way you downloaded netdata, we cannot find its version. This means the
881 Update check on the dashboard, will not work.
883 If you want to have version update check, please re-install it
884 following the procedure in:
886 https://github.com/firehol/netdata/wiki/Installation
891 # -----------------------------------------------------------------------------
892 # apps.plugin warning
894 if [ "${UID}" -ne 0 ]
896 cat <<-SETUID_WARNING
898 -------------------------------------------------------------------------------
899 apps.plugin needs privileges
901 Since you have installed netdata as a normal user, to have apps.plugin collect
902 all the needed data, you have to give it the access rights it needs, by running
903 either of the following sets of commands:
905 To run apps.plugin with escalated capabilities:
907 sudo chown root:${NETDATA_USER} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
908 sudo chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
909 sudo setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
911 or, to run apps.plugin as root:
913 sudo chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
914 sudo chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
916 apps.plugin is performing a hard-coded function of data collection for all
917 running processes. It cannot be instructed from the netdata daemon to perform
918 any task, so it is pretty safe to do this.
923 # -----------------------------------------------------------------------------
924 # Keep un-install info
926 cat >netdata-uninstaller.sh <<-UNINSTALL
929 # this script will uninstall netdata
931 if [ "\$1" != "--force" ]
933 echo >&2 "This script will REMOVE netdata from your system."
934 echo >&2 "Run it again with --force to do it."
938 echo >&2 "Stopping a possibly running netdata..."
939 for p in \$(pidof netdata); do kill \$p; done
943 if [ ! -z "\$1" -a -d "\$1" ]
946 echo "Deleting directory '\$1' ..."
951 if [ ! -z "${NETDATA_PREFIX}" -a -d "${NETDATA_PREFIX}" ]
953 # installation prefix was given
955 deletedir "${NETDATA_PREFIX}"
958 # installation prefix was NOT given
960 if [ -f "${NETDATA_PREFIX}/usr/sbin/netdata" ]
962 echo "Deleting ${NETDATA_PREFIX}/usr/sbin/netdata ..."
963 rm -i "${NETDATA_PREFIX}/usr/sbin/netdata"
966 deletedir "${NETDATA_PREFIX}/etc/netdata"
967 deletedir "${NETDATA_PREFIX}/usr/share/netdata"
968 deletedir "${NETDATA_PREFIX}/usr/libexec/netdata"
969 deletedir "${NETDATA_PREFIX}/var/lib/netdata"
970 deletedir "${NETDATA_PREFIX}/var/cache/netdata"
971 deletedir "${NETDATA_PREFIX}/var/log/netdata"
974 if [ -f /etc/logrotate.d/netdata ]
976 echo "Deleting /etc/logrotate.d/netdata ..."
977 rm -i /etc/logrotate.d/netdata
980 if [ -f /etc/systemd/system/netdata.service ]
982 echo "Deleting /etc/systemd/system/netdata.service ..."
983 rm -i /etc/systemd/system/netdata.service
986 getent passwd netdata > /dev/null
990 echo "You may also want to remove the user netdata"
992 echo " userdel netdata"
995 getent group netdata > /dev/null
999 echo "You may also want to remove the group netdata"
1001 echo " groupdel netdata"
1004 getent group docker > /dev/null
1005 if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ]
1008 echo "You may also want to remove the netdata user from the docker group"
1010 echo " gpasswd -d netdata docker"
1014 chmod 750 netdata-uninstaller.sh
1016 # -----------------------------------------------------------------------------
1021 -------------------------------------------------------------------------------
1023 OK. NetData is installed and it is running.
1025 -------------------------------------------------------------------------------
1027 By default netdata listens on all IPs on port ${NETDATA_PORT},
1028 so you can access it with:
1030 http://this.machine.ip:${NETDATA_PORT}/
1032 To stop netdata, just kill it, with:
1036 To start it, just run it:
1038 ${NETDATA_PREFIX}/usr/sbin/netdata
1044 echo >&2 "Uninstall script generated: ./netdata-uninstaller.sh"