diff --git a/packages/ns-phonehome/files/send-phonehome b/packages/ns-phonehome/files/send-phonehome index 24d3c1b98..998361b67 100755 --- a/packages/ns-phonehome/files/send-phonehome +++ b/packages/ns-phonehome/files/send-phonehome @@ -16,4 +16,4 @@ fi /usr/sbin/phonehome | curl -m 180 --retry 3 -L -s \ -H "Content-type: application/json" -H "Accept: application/json" \ - --data-binary @- "$URL" > /dev/null + --data-binary @- "$URL" > /dev/null \ No newline at end of file diff --git a/packages/ns-plug/files/send-heartbeat b/packages/ns-plug/files/send-heartbeat index abacb027a..36b328349 100755 --- a/packages/ns-plug/files/send-heartbeat +++ b/packages/ns-plug/files/send-heartbeat @@ -10,6 +10,7 @@ SYSTEM_ID=$(uci -q get ns-plug.config.system_id) SYSTEM_SECRET=$(uci -q get ns-plug.config.secret) URL=$(uci -q get ns-plug.config.alerts_url)"heartbeats/store" +TYPE=$(uci -q get ns-plug.config.type) if [ -z "$SYSTEM_ID" ] || [ -z "$SYSTEM_SECRET" ]; then # System ID or system secret not found, configure ns-plug @@ -19,3 +20,11 @@ fi /usr/bin/curl -m 180 --retry 3 -L -s \ --header "Authorization: token $SYSTEM_SECRET" --header "Content-Type: application/json" --header "Accept: application/json" \ --data-raw '{"lk": "'$SYSTEM_ID'"}' "$URL" >/dev/null + +# Temporary send data to new endpoint +# To be removed when the migration to new my.nethesis.it will be completed +if [ "$TYPE" = "enterprise" ]; then + /usr/bin/curl -m 180 --retry 3 -L -s -X POST \ + --user "$SYSTEM_ID:$SYSTEM_SECRET" https://my.nethesis.it/proxy/heartbeat >/dev/null + exit 0 +fi diff --git a/packages/ns-plug/files/send-inventory b/packages/ns-plug/files/send-inventory index 1e2dcc153..a670e9925 100755 --- a/packages/ns-plug/files/send-inventory +++ b/packages/ns-plug/files/send-inventory @@ -35,4 +35,10 @@ if [ "$TYPE" = "enterprise" ]; then /usr/bin/curl -m 180 --retry 5 -L -s \ --header "Content-Type: application/json" --header "Accept: application/json" \ -d '{"secret":"'$SYSTEM_SECRET'"}' https://my.nethesis.it/api/systems/info >/dev/null + + # Temporary send data to new endpoint + # To be removed when the migration to new my.nethesis.it will be completed + /usr/sbin/phonehome | /usr/bin/curl -m 180 --retry 3 -L -s --user "$SYSTEM_ID:$SYSTEM_SECRET" \ + -H "Content-Type: application/json" \ + --data-binary @- https://my.nethesis.it/proxy/inventory >/dev/null || : fi