Update node_exporter_install_v2
This commit is contained in:
parent
01cc1d6855
commit
c2ae09ed07
@ -123,4 +123,62 @@ curl -LO ${DOWNLOAD_URL}
|
||||
|
||||
# Check if the download was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "
|
||||
echo "Error downloading Node Exporter. Please check the URL."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the downloaded file exists
|
||||
if [ ! -f "node_exporter-${LATEST_VERSION#v}.linux-amd64.tar.gz" ]; then
|
||||
echo "Downloaded file does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract node_exporter
|
||||
tar -xzf node_exporter-${LATEST_VERSION#v}.linux-amd64.tar.gz
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Node Exporter extracted successfully."
|
||||
else
|
||||
echo "Error extracting Node Exporter. Please check the downloaded file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Main menu loop
|
||||
while true; do
|
||||
display_menu
|
||||
read -p "Select an option [1-6]: " option
|
||||
|
||||
case $option in
|
||||
1)
|
||||
install_node_exporter
|
||||
;;
|
||||
2)
|
||||
create_service
|
||||
;;
|
||||
3)
|
||||
check_service_status
|
||||
;;
|
||||
4)
|
||||
cleanup_files
|
||||
;;
|
||||
5)
|
||||
install_node_exporter
|
||||
create_service
|
||||
check_service_status
|
||||
read -p "Do you want to clean up the downloaded files? (y/n): " cleanup_choice
|
||||
if [[ "$cleanup_choice" == "y" || "$cleanup_choice" == "Y" ]]; then
|
||||
cleanup_files
|
||||
else
|
||||
echo "Downloaded files retained."
|
||||
fi
|
||||
;;
|
||||
6)
|
||||
echo "Exiting."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option. Please select a valid option."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Script execution completed."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user