install.fairie/home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl
Brian Zalewski ec4f5b8059 Update 55 files
- /home/dot_config/rclone/system/s3-docker.service.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_13-post-install-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_27-tor.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_26-vscode-extensions.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_05-log-config.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_04-environment-profile.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-warp.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_20-font.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.sh.tmpl
2023-04-12 03:26:25 +00:00

40 lines
2.4 KiB
Cheetah

{{- if and (ne .host.distro.family "windows") (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (or (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) (env "NETDATA_TOKEN")) (or (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) (env "NETDATA_ROOM")) -}}
#!/usr/bin/env bash
# @file Netdata
# @brief Connects Netdata with Netdata's free cloud dashboard and applies some system optimizations, if necessary
# @description
# This script connects Netdata with Netdata Cloud if Netdata is installed, the `NETDATA_TOKEN` is provided, and the
# `NETDATA_ROOM` is defined. This allows you to graphically browse through system metrics on all your connected devices
# from a single free web application.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Claim the instance with Netdata Cloud
if command -v netdata-claim.sh > /dev/null; then
NETDATA_TOKEN="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) }}{{ includeTemplate "secrets/NETDATA_TOKEN" | decrypt }}{{ else }}{{ env "NETDATA_TOKEN" }}{{ end }}"
NETDATA_ROOM="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) }}{{ includeTemplate "secrets/NETDATA_ROOM" | decrypt }}{{ else }}{{ env "NETDATA_ROOM" }}{{ end }}"
netdata-claim.sh -token="$NETDATA_TOKEN" -rooms="$NETDATA_ROOM" -url="{{ .netdataClaimURL }}"
# Kernel optimizations
# These are mentioned while installing via the kickstart.sh script method. We are using Homebrew for the installation though.
# Assuming these optimizations do not cause any harm.
if [ -d /Applications ] && [ -d /System ]; then
# macOS
logg info 'System is macOS so Netdata kernel optimizations are not required'
else
# Linux
if [ -d /sys/kernel/mm/ksm ]; then
logg info 'Adding Netdata kernel optimization for `/sys/kernel/mm/ksm/run`'
echo 1 | sudo tee /sys/kernel/mm/ksm/run
logg info 'Adding Netdata kernel optimization for `/sys/kernel/mm/ksm/sleep_millisecs`'
echo 1000 | sudo tee /sys/kernel/mm/ksm/sleep_millisecs
else
logg info 'The `/sys/kernel/mm/ksm` directory does not exist so Netdata kernel optimizations are not being applied'
fi
fi
else
logg warn '`netdata-claim.sh` is not available in the PATH'
fi
{{ end -}}