Speedtest netdata plugin (#71)

This commit is contained in:
enggnr 2023-08-01 12:24:04 +05:30 committed by GitHub
parent b9fe28a9b7
commit b2311d02de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 4 deletions

View file

@ -166,6 +166,16 @@
pull.args = ["--ff-only"]
{{- end }}
{{- if (lookPath "pipx") }}
### Netdata Speedtest
[".local/share/netdata-speedtest"]
type = "git-repo"
url = "https://github.com/ohthehugemanatee/netdata-speedtest.git"
refreshPeriod = "{{ $refreshPeriod }}"
clone.args = ["--depth", "1"]
pull.args = ["--ff-only"]
{{- end }}
### Git Template
# [".config/git/template/_/husky.sh"]
# type = "file"

View file

@ -32,7 +32,7 @@ if command -v netdata-claim.sh > /dev/null; then
fi
ensureNetdataOwnership
# netdata-claim.sh must be run as netdata user
logg info "Netdata room: $NETDATA_ROOM"
sudo -H -u netdata bash -c 'export NETDATA_ROOM="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) -}}{{- includeTemplate "secrets/NETDATA_ROOM" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_ROOM" -}}{{- end -}}" && export NETDATA_TOKEN="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) -}}{{- includeTemplate "secrets/NETDATA_TOKEN" | decrypt | trim -}}{{- else -}}{{- env "NETDATA_TOKEN" -}}{{- end -}}" && netdata-claim.sh -token="$NETDATA_TOKEN" -rooms="$NETDATA_ROOM" -url="{{ .netdataClaimURL }}"'
@ -61,7 +61,7 @@ if command -v netdata-claim.sh > /dev/null; then
if [ -d /usr/local/etc/netdata ]; then
NETDATA_ETC='/usr/local/etc/netdata/'
elif [ -d /etc/netdata ]; then
NETDATA_EDC='/etc/netdata'
NETDATA_ETC='/etc/netdata'
else
logg error 'No etc location found for netdata' && exit 1
fi
@ -89,7 +89,7 @@ if command -v netdata-claim.sh > /dev/null; then
DEBSECAN_GIT="${XDG_DATA_HOME:-$HOME/.local/share}/netdata-debsecan"
# Installing the script to generate report on CVEs in installed packages
logg info 'Installing script to generate on CVEs in installed packages'
logg info 'Installing script to generate report on CVEs in installed packages'
sudo cp -f "$DEBSECAN_GIT/usr_local_bin_debsecan-by-type" "/usr/local/bin/debsecan-by-type"
# Generate initial debsecan reports in /var/log/debsecan/
@ -113,6 +113,17 @@ if command -v netdata-claim.sh > /dev/null; then
fi
fi
### Configure Netdata to gather information about Internet connection speed
if command -v speedtest-cli > /dev/null; then
SPEEDTEST_GIT="${XDG_DATA_HOME:-$HOME/.local/share}/netdata-speedtest"
# Installing the script to generate report on Internet connection speed
logg info 'Installing script to generate report on Internet connection speed'
sudo cp -f "$SPEEDTEST_GIT/speedtest.chart.sh" "/usr/libexec/netdata/charts.d/speedtest.chart.sh"
else
logg warn '`speedtest-cli` is not available in the PATH or is not installed'
fi
ensureNetdataOwnership
### Restart Netdata service
@ -127,7 +138,7 @@ if command -v netdata-claim.sh > /dev/null; then
else
logg warn '`systemctl` is not available'
fi
else
logg info '`netdata-claim.sh` is not available in the PATH'
fi

View file

@ -6012,6 +6012,9 @@ softwarePackages:
_home: https://www.netdata.cloud/
_name: Netdata
_service: netdata
_deps:
- debsecan
- speedtest-cli
ansible: professormanhattan.netdata
brew: netdata
pacman: netdata
@ -8277,6 +8280,14 @@ softwarePackages:
_home: null
_name: speed-test
npm: speed-test
speedtest-cli:
_bin: speedtest-cli
_desc: Command line interface for testing internet bandwidth using speedtest.net
_docs: null
_github: https://github.com/sivel/speedtest-cli
_home: null
_name: speedtest-cli
pipx: speedtest-cli
spotdl:
_bin: spotdl
_deps: