summaryrefslogtreecommitdiffstats
path: root/claim/netdata-claim.sh.in
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2022-01-14 10:36:09 -0500
committerGitHub <noreply@github.com>2022-01-14 10:36:09 -0500
commit3f06aa65ae56a78ba810d1b10d064be5c5100ed5 (patch)
tree20f729ebf8a797513352df01c328593066fd5241 /claim/netdata-claim.sh.in
parent96376fc8b5e871f36b5c5c7d63c311de6df1f1ef (diff)
Better handle creation of UUID for claiming. (#11974)
* Properly check for the availability of `uuidgen` before blindly using it. * Fall back on Linux to the kernel-provided interface for generating UUIDs if `uuidgen` is not present. * Provide a more useful error message if we can’t use either option.
Diffstat (limited to 'claim/netdata-claim.sh.in')
-rwxr-xr-xclaim/netdata-claim.sh.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/claim/netdata-claim.sh.in b/claim/netdata-claim.sh.in
index 8f58cfe3b2..f2120ae9cd 100755
--- a/claim/netdata-claim.sh.in
+++ b/claim/netdata-claim.sh.in
@@ -151,7 +151,14 @@ NETDATA_USER=$(get_config_value netdata global "run as user")
gen_id() {
local id
- id="$(uuidgen)"
+ if command -v uuidgen > /dev/null 2>&1; then
+ id="$(uuidgen)"
+ elif [ -r /proc/sys/kernel/random/uuid ]; then
+ id="$(cat /proc/sys/kernel/random/uuid)"
+ else
+ echo >&2 "Unable to generate machine ID."
+ exit 18
+ fi
if [ "${id}" = "8a795b0c-2311-11e6-8563-000c295076a6" ] || [ "${id}" = "4aed1458-1c3e-11e6-a53f-000c290fc8f5" ]; then
gen_id