DONOTSTART=0
DONOTWAIT=0
NETDATA_PREFIX=
-ZLIB_IS_HERE=0
+LIBS_ARE_HERE=0
usage() {
cat <<-USAGE
Start immediately building it.
--zlib-is-really-here
+ --libs-are-really-here
If you get errors about missing zlib,
- but you know it is available,
+ or libuuid but you know it is available,
you have a broken pkg-config.
Use this option to allow it continue
without checking pkg-config.
For the installer to complete successfully, you will need
these packages installed:
- gcc make autoconf automake pkg-config zlib1g-dev uuid-dev
+ gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel)
+ uuid-dev (or libuuid-devel)
For the plugins, you will at least need:
then
NETDATA_PREFIX="${2}/netdata"
shift 2
- elif [ "$1" = "--zlib-is-really-here" ]
+ elif [ "$1" = "--zlib-is-really-here" -o "$1" = "--libs-are-really-here" ]
then
- ZLIB_IS_HERE=1
+ LIBS_ARE_HERE=1
shift 1
elif [ "$1" = "--dont-start-it" ]
then
You many need to check these:
- 1. The package uuid-dev has to be installed.
+ 1. The package uuid-dev (or libuuid-devel) has to be installed.
- 2. The package zlib1g-dev has to be installed.
+ If your system cannot find libuuid, although it is installed
+ run me with the option: --libs-are-really-here
- If your system cannot find ZLIB, although it is installed
- run me with the option: --zlib-is-really-here
+ 2. The package zlib1g-dev (or zlib-devel) has to be installed.
+
+ If your system cannot find zlib, although it is installed
+ run me with the option: --libs-are-really-here
3. You need basic build tools installed, like:
return ${ret}
}
-if [ ${ZLIB_IS_HERE} -eq 1 ]
+if [ ${LIBS_ARE_HERE} -eq 1 ]
then
shift
- echo >&2 "ok, assuming zlib is really installed."
+ echo >&2 "ok, assuming libs are really installed."
export ZLIB_CFLAGS=" "
export ZLIB_LIBS="-lz"
+ export UUID_CFLAGS=" "
+ export UUID_LIBS="-luuid"
fi
trap build_error EXIT
run make || exit 1
# backup user configurations
+installer_backup_suffix="${PID}.${RANDOM}"
for x in apps_groups.conf charts.d.conf
do
if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}" ]
then
- cp -p "${NETDATA_PREFIX}/etc/netdata/${x}" "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup"
+ cp -p "${NETDATA_PREFIX}/etc/netdata/${x}" "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup.${installer_backup_suffix}"
+
+ elif [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup.${installer_backup_suffix}" ]
+ then
+ rm -f "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup.${installer_backup_suffix}"
fi
done
# restore user configurations
for x in apps_groups.conf charts.d.conf
do
- if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup" ]
+ if [ -f "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup.${installer_backup_suffix}" ]
then
- cp -p "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup" "${NETDATA_PREFIX}/etc/netdata/${x}"
+ cp -p "${NETDATA_PREFIX}/etc/netdata/${x}.installer_backup.${installer_backup_suffix}" "${NETDATA_PREFIX}/etc/netdata/${x}"
fi
done
# let the uninstall script know
NETDATA_ADDED_TO_DOCKER=1
fi
+
+ if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ]
+ then
+ echo >&2 "Adding netdata logrotate configuration ..."
+ run cp system/netdata.logrotate /etc/logrotate.d/netdata
+ fi
fi
mkdir -p "${NETDATA_RUN_DIR}" || exit 1
fi
+echo >&2
echo >&2 "Fixing directories (user: ${NETDATA_USER})..."
for x in "${NETDATA_WEB_DIR}" "${NETDATA_CONF_DIR}" "${NETDATA_CACHE_DIR}" "${NETDATA_LOG_DIR}" "${NETDATA_LIB_DIR}"
do
else
echo >&2 "OK. NetData Started!"
fi
+echo >&2
# -----------------------------------------------------------------------------
if [ ! -s "${NETDATA_PREFIX}/etc/netdata/netdata.conf" ]
then
+ echo >&2
+ echo >&2 "-------------------------------------------------------------------------------"
+ echo >&2
echo >&2 "Downloading default configuration from netdata..."
sleep 5
sudo chown root "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
sudo chmod 4755 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
- These commands allow apps.plugin to run as root.
-
apps.plugin is performing a hard-coded function of data collection for all
running processes. It cannot be instructed from the netdata daemon to perform
any task, so it is pretty safe to do this.
deletedir "${NETDATA_PREFIX}/var/log/netdata"
fi
+ if [ -f /etc/logrotate.d/netdata ]
+ then
+ echo "Deleting /etc/logrotate.d/netdata ..."
+ rm -i /etc/logrotate.d/netdata
+ fi
+
getent passwd netdata > /dev/null
if [ $? -eq 0 ]
then
Enjoy!
- Give netdata a Github Star, at:
-
- https://github.com/firehol/netdata/wiki
-
-
END
echo >&2 "Uninstall script generated: ./netdata-uninstaller.sh"