Skip to content

Commit

Permalink
Upgrade Netdata script
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch85 authored Oct 3, 2024
1 parent bd26d5d commit 396f005
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions apps/netdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
SCRIPT_NAME="Netdata"
SCRIPT_EXPLAINER="Netdata is an open source tool designed to collect real-time metrics, \
Expand All @@ -20,19 +19,9 @@ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercont
DEBUG=0
debug_mode

# Must be root
# Must be sudo
root_check

# Can't be run as pure root user
if [ -z "$UNIXUSER" ]
then
msg_box "You can't run this script as a pure root user. You need to issue the following command:
sudo -u regular_user sudo bash $SCRIPTS/menu.sh
Then choose Additional Apps --> Netdata"
exit 1
fi

# Check if netdata is already installed
if ! [ -d /etc/netdata ]
then
Expand All @@ -42,35 +31,40 @@ else
# Ask for removal or reinstallation
reinstall_remove_menu "$SCRIPT_NAME"
# Removal
touch /etc/netdata/.environment
if [ -f /usr/src/netdata.git/netdata-uninstaller.sh ]
then
if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh --force
if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh -y -f
then
rm -Rf /usr/src/netdata.git
fi
elif [ -f /usr/libexec/netdata-uninstaller.sh ]
then
yes no | bash /usr/libexec/netdata-uninstaller.sh --yes
yes no | bash /usr/libexec/netdata-uninstaller.sh -y -f
elif [ -f /usr/libexec/netdata/netdata-uninstaller.sh ]
then
bash /usr/libexec/netdata/netdata-uninstaller.sh --force --yes
bash /usr/libexec/netdata/netdata-uninstaller.sh -y -f
else
check_command curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
check_command bash $SCRIPTS/netdata-uninstaller.sh --force --yes
curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
check_command bash $SCRIPTS/netdata-uninstaller.sh -y -f
rm $SCRIPTS/netdata-uninstaller.sh
rm -rf /var/lib/netdata
fi
rm -rf /etc/netdata
apt-get purge netdata -y
apt-get autoremove -y
rm -rf /var/cache/netdata
rm -rf /var/log/netdata
# Show successful uninstall if applicable
removal_popup "$SCRIPT_NAME"
fi

# Install
is_process_running dpkg
is_process_running apt
apt update -q4 & spinner_loading
curl_to_dir https://my-netdata.io kickstart.sh $SCRIPTS
sudo -u "$UNIXUSER" bash $SCRIPTS/kickstart.sh all --dont-wait --no-updates --stable-channel
apt-get update -q4 & spinner_loading
curl_to_dir https://get.netdata.cloud kickstart.sh $SCRIPTS
bash $SCRIPTS/kickstart.sh --reinstall-even-if-unsafe --non-interactive --no-updates --stable-channel --disable-cloud
rm -f $SCRIPTS/kickstart.sh

# Check Netdata instructions after script is done
Expand Down

0 comments on commit 396f005

Please sign in to comment.