]> arthur.barton.de Git - netdata.git/blob - netdata-installer.sh
Merge pull request #306 from simonnagl/bugfix/safari-misaligned_dial_graphs
[netdata.git] / netdata-installer.sh
1 #!/bin/bash
2
3 # reload the user profile
4 [ -f /etc/profile ] && . /etc/profile
5
6 # fix PKG_CHECK_MODULES error
7 if [ -d /usr/share/aclocal ]
8 then
9         ACLOCAL_PATH=${ACLOCAL_PATH-/usr/share/aclocal}
10         export ACLOCAL_PATH
11 fi
12
13 LC_ALL=C
14
15 # you can set CFLAGS before running installer
16 CFLAGS="${CFLAGS--O3}"
17
18 # keep a log of this command
19 printf "\n# " >>netdata-installer.log
20 date >>netdata-installer.log
21 printf "CFLAGS=\"%s\" " "${CFLAGS}" >>netdata-installer.log
22 printf "%q " "$0" "${@}" >>netdata-installer.log
23 printf "\n" >>netdata-installer.log
24
25 ME="$0"
26 DONOTSTART=0
27 DONOTWAIT=0
28 NETDATA_PREFIX=
29 ZLIB_IS_HERE=0
30
31 usage() {
32         cat <<USAGE
33
34 ${ME} <installer options>
35
36 Valid <installer options> are:
37
38    --install /PATH/TO/INSTALL
39
40         If your give: --install /opt
41         netdata will be installed in /opt/netdata
42
43    --dont-start-it
44
45         Do not (re)start netdata.
46         Just install it.
47
48    --dont-wait
49
50         Do not wait for the user to press ENTER.
51         Start immediately building it.
52
53    --zlib-is-really-here
54
55         If you get errors about missing zlib,
56         but you know it is available,
57         you have a broken pkg-config.
58         Use this option to allow it continue
59         without checking pkg-config.
60
61 Netdata will by default be compiled with gcc optimization -O3
62 If you need to pass different CFLAGS, use something like this:
63
64   CFLAGS="<gcc options>" $ME <installer options>
65
66 For the installer to complete successfully, you will need
67 these packages installed:
68
69    gcc make autoconf automake pkg-config zlib1g-dev
70
71 For the plugins, you will at least need:
72
73    curl node
74
75 USAGE
76 }
77
78 while [ ! -z "${1}" ]
79 do
80         if [ "$1" = "--install" ]
81                 then
82                 NETDATA_PREFIX="${2}/netdata"
83                 shift 2
84         elif [ "$1" = "--zlib-is-really-here" ]
85                 then
86                 ZLIB_IS_HERE=1
87                 shift 1
88         elif [ "$1" = "--dont-start-it" ]
89                 then
90                 DONOTSTART=1
91                 shift 1
92         elif [ "$1" = "--dont-wait" ]
93                 then
94                 DONOTWAIT=1
95                 shift 1
96         elif [ "$1" = "--help" -o "$1" = "-h" ]
97                 then
98                 usage
99                 exit 1
100         else
101                 echo >&2
102                 echo >&2 "ERROR:"
103                 echo >&2 "I cannot understand option '$1'."
104                 usage
105                 exit 1
106         fi
107 done
108
109 cat <<BANNER
110
111 Welcome to netdata!
112 Nice to see you are giving it a try!
113
114 You are about to build and install netdata to your system.
115
116 It will be installed at these locations:
117
118   - the daemon    at ${NETDATA_PREFIX}/usr/sbin/netdata
119   - config files  at ${NETDATA_PREFIX}/etc/netdata
120   - web files     at ${NETDATA_PREFIX}/usr/share/netdata
121   - plugins       at ${NETDATA_PREFIX}/usr/libexec/netdata
122   - cache files   at ${NETDATA_PREFIX}/var/cache/netdata
123   - log files     at ${NETDATA_PREFIX}/var/log/netdata
124   - pid file      at ${NETDATA_PREFIX}/var/run
125
126 This installer allows you to change the installation path.
127 Press Control-C and run the same command with --help for help.
128
129 BANNER
130
131 if [ "${UID}" -ne 0 ]
132         then
133         if [ -z "${NETDATA_PREFIX}" ]
134                 then
135                 cat <<NONROOTNOPREFIX
136
137 Sorry! This will fail!
138
139 You are attempting to install netdata as non-root, but you plan to install it
140 in system paths.
141
142 Please set an installation prefix, like this:
143
144     $0 ${@} --install /tmp
145
146 or, run the installer as root:
147
148     sudo $0 ${@}
149
150 We suggest to install it as root, or certain data collectors will not be able
151 to work. Netdata drops root privileges when running. So, if you plan to keep
152 it, install it as root to get the full functionality.
153
154 NONROOTNOPREFIX
155                 exit 1
156
157         else
158                 cat <<NONROOT
159
160 IMPORTANT:
161 You are about to install netdata as a non-root user.
162 Netdata will work, but a few data collection modules that
163 require root access will fail.
164
165 If you installing permanently on your system, run the
166 installer like this:
167
168     sudo $0 ${@}
169
170 NONROOT
171         fi
172 fi
173
174 have_autotools=
175 if [ "$(type autoreconf 2> /dev/null)" ]
176 then
177         autoconf_maj_min() {
178                 local maj min IFS=.-
179
180                 maj=$1
181                 min=$2
182
183                 set -- $(autoreconf -V | sed -ne '1s/.* \([^ ]*\)$/\1/p')
184                 eval $maj=\$1 $min=\$2
185         }
186         autoconf_maj_min AMAJ AMIN
187
188         if [ "$AMAJ" -gt 2 ]
189         then
190                 have_autotools=Y
191         elif [ "$AMAJ" -eq 2 -a "$AMIN" -ge 60 ]
192         then
193                 have_autotools=Y
194         else
195                 echo "Found autotools $AMAJ.$AMIN"
196         fi
197 else
198         echo "No autotools found"
199 fi
200
201 if [ ! "$have_autotools" ]
202 then
203         if [ -f configure ]
204         then
205                 echo "Will skip autoreconf step"
206         else
207                 cat <<-"EOF"
208
209         -------------------------------------------------------------------------------
210         autotools 2.60 or later is required
211
212         Sorry, you do not seem to have autotools 2.60 or later, which is
213         required to build from the git sources of netdata.
214
215         You can either install a suitable version of autotools and automake
216         or download a netdata package which does not have these dependencies.
217
218         Source packages where autotools have already been run are available
219         here:
220                https://firehol.org/download/netdata/
221
222         The unsigned/master folder tracks the head of the git tree and released
223         packages are also available.
224         EOF
225                 exit 1
226         fi
227 fi
228
229 if [ ${DONOTWAIT} -eq 0 ]
230         then
231         if [ ! -z "${NETDATA_PREFIX}" ]
232                 then
233                 read -p "Press ENTER to build and install netdata to '${NETDATA_PREFIX}' > "
234         else
235                 read -p "Press ENTER to build and install netdata to your system > "
236         fi
237 fi
238
239 build_error() {
240         cat <<EOF
241
242 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243
244 Sorry! NetData failed to build...
245
246 You many need to check these:
247
248 1. The package zlib1g-dev has to be installed.
249
250 2. You need basic build tools installed, like:
251
252    gcc make autoconf automake pkg-config
253
254    Autoconf version 2.60 or higher is required
255
256 3. If your system cannot find ZLIB, although it is installed
257    run me with the option:  --zlib-is-really-here
258
259
260 If you still cannot get it to build, ask for help at github:
261
262    https://github.com/firehol/netdata/issues
263
264
265 EOF
266         trap - EXIT
267         exit 1
268 }
269
270 run() {
271         printf >&2 "\n"
272         printf >&2 ":-----------------------------------------------------------------------------\n"
273         printf >&2 "Running command:\n"
274         printf >&2 "\n"
275         printf >&2 "%q " "${@}"
276         printf >&2 "\n"
277         printf >&2 "\n"
278
279         "${@}"
280 }
281
282 if [ ${ZLIB_IS_HERE} -eq 1 ]
283         then
284         shift
285         echo >&2 "ok, assuming zlib is really installed."
286         export ZLIB_CFLAGS=" "
287         export ZLIB_LIBS="-lz"
288 fi
289
290 trap build_error EXIT
291
292 if [ "$have_autotools" ]
293 then
294         run ./autogen.sh || exit 1
295 fi
296
297 run ./configure \
298         --prefix="${NETDATA_PREFIX}/usr" \
299         --sysconfdir="${NETDATA_PREFIX}/etc" \
300         --localstatedir="${NETDATA_PREFIX}/var" \
301         --with-zlib --with-math --with-user=netdata \
302         CFLAGS="${CFLAGS}" || exit 1
303
304 # remove the build_error hook
305 trap - EXIT
306
307 if [ -f src/netdata ]
308         then
309         echo >&2 "Cleaning a possibly old compilation ..."
310         run make clean
311 fi
312
313 echo >&2 "Compiling netdata ..."
314 run make || exit 1
315
316 # backup user configurations
317 for x in apps_groups.conf charts.d.conf
318 do
319         if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}" ]
320                 then
321                 cp -p "${NETDATA_PREFIX}/etc/netdata/${x}" "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup"
322         fi
323 done
324
325 echo >&2 "Installing netdata ..."
326 run make install || exit 1
327
328 # restore user configurations
329 for x in apps_groups.conf charts.d.conf
330 do
331         if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup" ]
332                 then
333                 cp -p "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup" "${NETDATA_PREFIX}/etc/netdata/${x}"
334         fi
335 done
336
337 NETDATA_ADDED_TO_DOCKER=0
338 if [ ${UID} -eq 0 ]
339         then
340         getent group netdata > /dev/null
341         if [ $? -ne 0 ]
342                 then
343                 echo >&2 "Adding netdata user group ..."
344                 run groupadd -r netdata
345         fi
346
347         getent passwd netdata > /dev/null
348         if [ $? -ne 0 ]
349                 then
350                 echo >&2 "Adding netdata user account ..."
351                 run useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata
352         fi
353
354         getent group docker > /dev/null
355         if [ $? -eq 0 ]
356                 then
357                 # find the users in the docker group
358                 docker=$(getent group docker | cut -d ':' -f 4)
359                 if [[ ",${docker}," =~ ,netdata, ]]
360                         then
361                         # netdata is already there
362                         :
363                 else
364                         # netdata is not in docker group
365                         echo >&2 "Adding netdata user to the docker group (needed to get container names) ..."
366                         run usermod -a -G docker netdata
367                 fi
368                 # let the uninstall script know
369                 NETDATA_ADDED_TO_DOCKER=1
370         fi
371 fi
372
373
374 # -----------------------------------------------------------------------------
375 # load options from the configuration file
376
377 # create an empty config if it does not exist
378 [ ! -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ] && touch "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
379
380 # function to extract values from the config file
381 config_option() {
382         local key="${1}" value="${2}" line=
383
384         if [ -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
385                 then
386                 line="$( grep "^[[:space:]]*${key}[[:space:]]*=[[:space:]]*" "${NETDATA_PREFIX}/etc/netdata/netdata.conf" | head -n 1 )"
387                 [ ! -z "${line}" ] && value="$( echo "${line}" | cut -d '=' -f 2 | sed -e "s/^[[:space:]]\+//g" -e "s/[[:space:]]\+$//g" )"
388         fi
389
390         echo "${value}"
391 }
392
393 # user
394 defuser="netdata"
395 [ ! "${UID}" = "0" ] && defuser="${USER}"
396 NETDATA_USER="$( config_option "run as user" "${defuser}" )"
397
398 NETDATA_WEB_USER="$( config_option "web files owner" "${defuser}" )"
399 NETDATA_WEB_GROUP="$( config_option "web files group" "${NETDATA_WEB_USER}" )"
400
401 # debug flags
402 defdebug=0
403 NETDATA_DEBUG="$( config_option "debug flags" ${defdebug} )"
404
405 # port
406 defport=19999
407 NETDATA_PORT="$( config_option "port" ${defport} )"
408
409 # directories
410 NETDATA_CACHE_DIR="$( config_option "cache directory" "${NETDATA_PREFIX}/var/cache/netdata" )"
411 NETDATA_WEB_DIR="$( config_option "web files directory" "${NETDATA_PREFIX}/usr/share/netdata/web" )"
412 NETDATA_LOG_DIR="$( config_option "log directory" "${NETDATA_PREFIX}/var/log/netdata" )"
413 NETDATA_CONF_DIR="$( config_option "config directory" "${NETDATA_PREFIX}/etc/netdata" )"
414 NETDATA_BIND="$( config_option "bind socket to IP" "*" )"
415 NETDATA_RUN_DIR="${NETDATA_PREFIX}/var/run"
416
417
418 # -----------------------------------------------------------------------------
419 # prepare the directories
420
421 # this is needed if NETDATA_PREFIX is not empty
422 if [ ! -d "${NETDATA_RUN_DIR}" ]
423         then
424         mkdir -p "${NETDATA_RUN_DIR}" || exit 1
425 fi
426
427 echo >&2 "Fixing directories (user: ${NETDATA_USER})..."
428 for x in "${NETDATA_WEB_DIR}" "${NETDATA_CONF_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}"
429 do
430         if [ ! -d "${x}" ]
431                 then
432                 echo >&2 "Creating directory '${x}'"
433                 run mkdir -p "${x}" || exit 1
434         fi
435
436         if [ ${UID} -eq 0 ]
437                 then
438                 if [ "${x}" = "${NETDATA_WEB_DIR}" ]
439                         then
440                         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}..."
441                 else
442                         run chown -R "${NETDATA_USER}:${NETDATA_USER}" "${x}" || echo >&2 "WARNING: Cannot change the ownership of the files in directory ${x} to ${NETDATA_USER}..."
443                 fi
444         fi
445
446         run chmod 0755 "${x}" || echo >&2 "WARNING: Cannot change the permissions of the directory ${x} to 0755..."
447 done
448
449 if [ ${UID} -eq 0 ]
450         then
451         # fix apps.plugin to be setuid to root
452         run chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
453         run chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
454 fi
455
456 # -----------------------------------------------------------------------------
457 # check if we can re-start netdata
458
459 if [ ${DONOTSTART} -eq 1 ]
460         then
461         if [ ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
462                 then
463                 echo >&2 "Generating empty config file in: ${NETDATA_PREFIX}/etc/netdata/netdata.conf"
464                 echo "# Get config from http://127.0.0.1:${NETDATA_PORT}/netdata.conf" >"${NETDATA_PREFIX}/etc/netdata/netdata.conf"
465
466                 if [ "${UID}" -eq 0 ]
467                         then
468                         chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
469                 fi
470                 chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
471         fi
472         echo >&2 "OK. It is now installed and ready."
473         exit 0
474 fi
475
476 # -----------------------------------------------------------------------------
477 # stop a running netdata
478
479 isnetdata() {
480         [ -z "$1" -o ! -f "/proc/$1/stat" ] && return 1
481         [ "$(cat "/proc/$1/stat" | cut -d '(' -f 2 | cut -d ')' -f 1)" = "netdata" ] && return 0
482         return 1
483 }
484
485
486 printf >&2 "Stopping a (possibly) running netdata..."
487 ret=0
488 count=0
489 while [ $ret -eq 0 ]
490 do
491         if [ $count -gt 30 ]
492                 then
493                 echo >&2 "Cannot stop the running netdata."
494                 exit 1
495         fi
496
497         count=$((count + 1))
498
499         pid=$(cat "${NETDATA_RUN_DIR}/netdata.pid" 2>/dev/null)
500         # backwards compatibility
501         [ -z "${pid}" ] && pid=$(cat /var/run/netdata.pid 2>/dev/null)
502         [ -z "${pid}" ] && pid=$(cat /var/run/netdata/netdata.pid 2>/dev/null)
503         
504         isnetdata $pid || pid=
505         if [ ! -z "${pid}" ]
506                 then
507                 run kill $pid 2>/dev/null
508                 ret=$?
509         else
510                 run killall netdata 2>/dev/null
511                 ret=$?
512         fi
513
514         test $ret -eq 0 && printf >&2 "." && sleep 2
515 done
516 echo >&2
517 echo >&2
518
519
520 # -----------------------------------------------------------------------------
521 # run netdata
522
523 echo >&2 "Starting netdata..."
524 run ${NETDATA_PREFIX}/usr/sbin/netdata -pidfile ${NETDATA_RUN_DIR}/netdata.pid "${@}"
525
526 if [ $? -ne 0 ]
527         then
528         echo >&2
529         echo >&2 "SORRY! FAILED TO START NETDATA!"
530         exit 1
531 else
532         echo >&2 "OK. NetData Started!"
533 fi
534
535
536 # -----------------------------------------------------------------------------
537 # save a config file, if it is not already there
538
539 if [ ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
540         then
541         echo >&2 "Downloading default configuration from netdata..."
542         sleep 5
543
544         # remove a possibly obsolete download
545         [ -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ] && rm "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new"
546
547         # disable a proxy to get data from the local netdata
548         export http_proxy=
549         export https_proxy=
550
551         # try wget
552         wget 2>/dev/null -O "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "http://localhost:${NETDATA_PORT}/netdata.conf"
553         ret=$?
554
555         # try curl
556         if [ $ret -ne 0 -o ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ]
557                 then
558                 curl -s -o "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "http://localhost:${NETDATA_PORT}/netdata.conf"
559                 ret=$?
560         fi
561
562         if [ $ret -eq 0 -a -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ]
563                 then
564                 mv "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
565                 echo >&2 "New configuration saved for you to edit at ${NETDATA_PREFIX}/etc/netdata/netdata.conf"
566
567                 if [ "${UID}" -eq 0 ]
568                         then
569                         chown "${NETDATA_USER}" "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
570                 fi
571                 chmod 0664 "${NETDATA_PREFIX}/etc/netdata/netdata.conf"
572         else
573                 echo >&2 "Cannnot download configuration from netdata daemon using url 'http://localhost:${NETDATA_PORT}/netdata.conf'"
574                 [ -f "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new" ] && rm "${NETDATA_PREFIX}/etc/netdata/netdata.conf.new"
575         fi
576 fi
577
578 # -----------------------------------------------------------------------------
579 # Check for KSM
580
581 ksm_is_available_but_disabled() {
582         cat <<KSM1
583
584 -------------------------------------------------------------------------------
585 Memory de-duplication instructions
586
587 I see you have kernel memory de-duper (called Kernel Same-page Merging,
588 or KSM) available, but it is not currently enabled.
589
590 To enable it run:
591
592 echo 1 >/sys/kernel/mm/ksm/run
593 echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs
594
595 If you enable it, you will save 40-60% of netdata memory.
596
597 KSM1
598 }
599
600 ksm_is_not_available() {
601         cat <<KSM2
602
603 -------------------------------------------------------------------------------
604 Memory de-duplication not present in your kernel
605
606 It seems you do not have kernel memory de-duper (called Kernel Same-page
607 Merging, or KSM) available.
608
609 To enable it, you need a kernel built with CONFIG_KSM=y
610
611 If you can have it, you will save 40-60% of netdata memory.
612
613 KSM2
614 }
615
616 if [ -f "/sys/kernel/mm/ksm/run" ]
617         then
618         if [ $(cat "/sys/kernel/mm/ksm/run") != "1" ]
619                 then
620                 ksm_is_available_but_disabled
621         fi
622 else
623         ksm_is_not_available
624 fi
625
626 # -----------------------------------------------------------------------------
627 # Check for version.txt
628
629 if [ ! -s web/version.txt ]
630         then
631 cat <<VERMSG
632
633 -------------------------------------------------------------------------------
634 Version update check warning
635
636 The way you downloaded netdata, we cannot find its version. This means the
637 Update check on the dashboard, will not work.
638
639 If you want to have version update check, please re-install it
640 following the procedure in:
641
642 https://github.com/firehol/netdata/wiki/Installation
643
644 VERMSG
645 fi
646
647 # -----------------------------------------------------------------------------
648 # apps.plugin warning
649
650 if [ "${UID}" -ne 0 ]
651         then
652 cat <<SETUID_WARNING
653
654 -------------------------------------------------------------------------------
655 apps.plugin needs privileges
656
657 Since you have installed netdata as a normal user, to have apps.plugin collect
658 all the needed data, you have to give it the access rights it needs, by running
659 these commands:
660
661         sudo chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
662         sudo chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
663
664 The commands allow apps.plugin to run as root.
665
666 apps.plugin is performing a hard-coded function of data collection for all
667 running processes. It cannot be instructed from the netdata daemon to perform
668 any task, so it is pretty safe to do this.
669
670 SETUID_WARNING
671 fi
672
673 # -----------------------------------------------------------------------------
674 # Keep un-install info
675
676 cat >netdata-uninstaller.sh <<UNINSTALL
677 #!/bin/bash
678
679 # this script will uninstall netdata
680
681 if [ "\$1" != "--force" ]
682         then
683         echo >&2 "This script will REMOVE netdata from your system."
684         echo >&2 "Run it again with --force to do it."
685         exit 1
686 fi
687
688 echo >&2 "Stopping a possibly running netdata..."
689 killall netdata
690 sleep 2
691
692 deletedir() {
693         if [ ! -z "\$1" -a -d "\$1" ]
694                 then
695                 echo
696                 echo "Deleting directory '\$1' ..."
697                 rm -I -R "\$1"
698         fi
699 }
700
701 if [ ! -z "${NETDATA_PREFIX}" -a -d "${NETDATA_PREFIX}" ]
702         then
703         # installation prefix was given
704
705         deletedir "${NETDATA_PREFIX}"
706
707 else
708         # installation prefix was NOT given
709
710         if [ -f "${NETDATA_PREFIX}/usr/sbin/netdata" ]
711                 then
712                 echo "Deleting ${NETDATA_PREFIX}/usr/sbin/netdata ..."
713                 rm -i "${NETDATA_PREFIX}/usr/sbin/netdata"
714         fi
715
716         deletedir "${NETDATA_PREFIX}/etc/netdata"
717         deletedir "${NETDATA_PREFIX}/usr/share/netdata"
718         deletedir "${NETDATA_PREFIX}/usr/libexec/netdata"
719         deletedir "${NETDATA_PREFIX}/var/cache/netdata"
720         deletedir "${NETDATA_PREFIX}/var/log/netdata"
721 fi
722
723 getent passwd netdata > /dev/null
724 if [ $? -eq 0 ]
725         then
726         echo
727         echo "You may also want to remove the user netdata"
728         echo "by running:"
729         echo "   userdel netdata"
730 fi
731
732 getent group netdata > /dev/null
733 if [ $? -eq 0 ]
734         then
735         echo
736         echo "You may also want to remove the group netdata"
737         echo "by running:"
738         echo "   groupdel netdata"
739 fi
740
741 getent group docker > /dev/null
742 if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ]
743         then
744         echo
745         echo "You may also want to remove the netdata user from the docker group"
746         echo "by running:"
747         echo "   gpasswd -d netdata docker"
748 fi
749
750 UNINSTALL
751 chmod 750 netdata-uninstaller.sh
752
753 # -----------------------------------------------------------------------------
754
755 if [ "${NETDATA_BIND}" = "*" ]
756         then
757         access="localhost"
758 else
759         access="${NETDATA_BIND}"
760 fi
761
762 cat <<END
763
764
765 -------------------------------------------------------------------------------
766
767 OK. NetData is installed and it is running (listening to ${NETDATA_BIND}:${NETDATA_PORT}).
768
769 -------------------------------------------------------------------------------
770
771
772 Hit http://${access}:${NETDATA_PORT}/ from your browser.
773
774 To stop netdata, just kill it, with:
775
776   killall netdata
777
778 To start it, just run it:
779
780   ${NETDATA_PREFIX}/usr/sbin/netdata
781
782
783 Enjoy!
784
785                  Give netdata a Github Star, at:
786
787              https://github.com/firehol/netdata/wiki
788
789
790 END
791 echo >&2 "Uninstall script generated: ./netdata-uninstaller.sh"