@@ -152,9 +152,11 @@ main() {
152152 if [[ ${VERSION_CHECK} == 1 ]]; then
153153 # This api endpoint is found in 6.x and above
154154 API_URL=$( kubectl ${KUBE_OPTS} get cm sysdigcloud-collector-config -ojsonpath=' {.data.collector-config\.conf}' | awk ' p&&$0~/"/{gsub("\"","");print} /{/{p=0} /sso/{p=1}' | grep serverName | awk ' {print $3}' )
155+ BACKEND_VERSION=6
155156 else
156157 # This api endpoint is found in 5.x and below
157158 API_URL=$( kubectl ${KUBE_OPTS} get cm sysdigcloud-config -o yaml | grep -i api.url: | head -1 | awk ' {print $2}' )
159+ BACKEND_VERSION=5
158160 fi
159161
160162 # Check that the API_KEY for the Super User is valid and exit
@@ -164,19 +166,28 @@ main() {
164166 exit 1
165167 fi
166168
167- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/license" >> ${LOG_DIR} /license.json
168- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/agents/connected?checkStatus=true" >> ${LOG_DIR} /agents_connected.json
169- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/storageSettings" >> ${LOG_DIR} /storage_settings.json
170- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/streamsnapSettings" >> ${LOG_DIR} /streamSnap_settings.json
171- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customers/1/snapshotSettings" >> ${LOG_DIR} /snapshot_settings.json
172- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/fastPathSettings" >> ${LOG_DIR} /fastPath_settings.json
173- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/indexSettings" >> ${LOG_DIR} /index_settings.json
174- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/planSettings" >> ${LOG_DIR} /plan_settings.json
175- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/dataRetentionSettings" >> ${LOG_DIR} /dataRetention_settings.json
176- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/v2/users/light" >> ${LOG_DIR} /users.json
177- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/v2/teams/light" >> ${LOG_DIR} /teams.json
178- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/auth/settings" >> ${LOG_DIR} /sso_settings.json
179- curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/alerts" >> ${LOG_DIR} /alerts.json
169+ if [[ ${BACKEND_VERSION} == 5 ]]; then
170+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/fastPathSettings" >> ${LOG_DIR} /fastPath_settings.json
171+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/indexSettings" >> ${LOG_DIR} /index_settings.json
172+ fi
173+
174+ if [[ ${BACKEND_VERSION} == 5 ]] || [[ ${BACKEND_VERSION} == 6 ]]; then
175+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/license" >> ${LOG_DIR} /license.json
176+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/agents/connected?checkStatus=true" >> ${LOG_DIR} /agents_connected.json
177+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/storageSettings" >> ${LOG_DIR} /storage_settings.json
178+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/streamsnapSettings" >> ${LOG_DIR} /streamSnap_settings.json
179+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customers/1/snapshotSettings" >> ${LOG_DIR} /snapshot_settings.json
180+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/planSettings" >> ${LOG_DIR} /plan_settings.json
181+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/dataRetentionSettings" >> ${LOG_DIR} /dataRetention_settings.json
182+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/v2/users/light" >> ${LOG_DIR} /users.json
183+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/v2/teams/light" >> ${LOG_DIR} /teams.json
184+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/auth/settings" >> ${LOG_DIR} /sso_settings.json
185+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/alerts" >> ${LOG_DIR} /alerts.json
186+ fi
187+
188+ if [[ ${BACKEND_VERSION} == 6 ]]; then
189+ curl -ks -H " Authorization: Bearer ${API_KEY} " -H " Content-Type: application/json" " ${API_URL} /api/admin/customer/1/meerkatSettings" >> ${LOG_DIR} /meerkat_settings.json
190+ fi
180191
181192 if [[ $OSTYPE == ' darwin' * ]]; then
182193 TO_EPOCH_TIME=$( date -jf " %H:%M:%S" $( date +%H) :00:00 +%s)
0 commit comments