Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ns-phonehome/files/send-phonehome
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions packages/ns-plug/files/send-heartbeat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 6 additions & 0 deletions packages/ns-plug/files/send-inventory
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading