Where to find file edit-config script

Hello! I excidently deleted the script edit-config from netdata. Can you please send me where, i can download it? Waiting for your reply!

1 Like

Hey, @_Gamer, no worries!

  • cd to the netdata etc dir
  • execute the following script as root, just copy/paste it in the terminal (assuming Netdata is running)
curl -sSfLJ -o "edit-config" "https://raw.githubusercontent.com/netdata/netdata/master/system/edit-config.in"

read -r NETDATA_USER_CONFIG_DIR NETDATA_STOCK_CONFIG_DIR \
    <<<"$(curl -sS --max-time 5 "http://127.0.0.1:19999/netdata.conf" | grep "config directory" | awk '{print $NF}' ORS=' ')"

if [ -n "$NETDATA_USER_CONFIG_DIR" ] && [ -n "$NETDATA_USER_CONFIG_DIR" ]; then
  sed -i "s|@configdir_POST@|"$NETDATA_USER_CONFIG_DIR"|;s|@libconfigdir_POST@|"$NETDATA_STOCK_CONFIG_DIR"|" edit-config
  chmod +x edit-config
else
  echo "Failed to gather configuration directories from Netdata"
fi

Let me do it myself

root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata# rm edit-config

root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata# curl -sSfLJ -o "edit-config" "https://raw.githubusercontent.com/netdata/netdata/master/system/edit-config.in"
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata#
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata# read -r NETDATA_USER_CONFIG_DIR NETDATA_STOCK_CONFIG_DIR \
>     <<<"$(curl -sS --max-time 5 "http://127.0.0.1:19999/netdata.conf" | grep "config directory" | awk '{print $NF}' ORS=' ')"
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata#
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata# if [ -n "$NETDATA_USER_CONFIG_DIR" ] && [ -n "$NETDATA_USER_CONFIG_DIR" ]; then
>   sed -i "s|@configdir_POST@|"$NETDATA_USER_CONFIG_DIR"|;s|@libconfigdir_POST@|"$NETDATA_STOCK_CONFIG_DIR"|" edit-config
>   chmod +x edit-config
> else
>   echo "Failed to gather configuration directories from Netdata"
> fi
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata#

root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata# ls -l edit-config
-rwxr-xr-x 1 root root 2069 May 12 22:18 edit-config
root@debian-s-1vcpu-1gb-fra1-01:/opt/netdata/etc/netdata#
2 Likes