#!/bin/bash
# Go to https://repo.netdata.cloud/repos/repoconfig/
# Choose the distribution

source /opt/scripts_local/shared_functions.sh


echo "Installing Netdata"

#wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry

# _get_distribution

# if [ "$DISTRIBUTION_NAME" == "bullseye" ]; then
#   echo "$DISTRIBUTION_NAME"
#   wget https://repo.netdata.cloud/repos/repoconfig/debian/bullseye/netdata-repo-edge_2-1%2Bdebian11_all.deb
#   dpkg -i netdata-repo-edge_2-1+debian11_all.deb
# elif [ "$DISTRIBUTION_NAME" == "bookworm" ]; then
#   echo "$DISTRIBUTION_NAME"
#   wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry
#   wget https://repo.netdata.cloud/repos/repoconfig/debian/bookworm/netdata-repo-edge_2-1%2Bdebian_all.deb
#   dpkg -i netdata-repo-edge_2-1+debian_all.deb
# else
#   echo "$DISTRIBUTION_NAME"
#   exit 1
# fi

sudo apt update
# sudo apt install netdata -y

#echo "Registering Netdata"
# Register server to the cloud account
#wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry --dont-wait --non-interactive --claim-token Oc1q36reCJ3pensturSFF2o_wukd2qkVQhoJ5PoL3B_mxxAaL8PWawqvd4hgiRxjAuS7LravDMHdyeoFWLORJZv9gNLvZ6iLHF--WHnuNjsWt7UTjwq8BEQES2d6QjfJ1u5RnTk --claim-rooms a1864264-8e20-4f4f-8c5c-c9fbeac81ced --claim-url https://app.netdata.cloud

wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry --claim-token Oc1q36reCJ3pensturSFF2o_wukd2qkVQhoJ5PoL3B_mxxAaL8PWawqvd4hgiRxjAuS7LravDMHdyeoFWLORJZv9gNLvZ6iLHF--WHnuNjsWt7UTjwq8BEQES2d6QjfJ1u5RnTk --claim-rooms a1864264-8e20-4f4f-8c5c-c9fbeac81ced --dont-wait


# install_package install_netdata_pushover.sh


echo "Finished Installing Netdata"