Skip to content

Commit

Permalink
add missing metrics script (#884)
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Oberlechner <[email protected]>
  • Loading branch information
geoberle authored Nov 22, 2024
1 parent 6273bb8 commit 9232253
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dev-infrastructure/scripts/enable-aks-metrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

MONITORING_WORSPACE_ID=$(az monitor account list -g ${GRAFANA_RESOURCEGROUP} --query "[?name=='${MONITORING_WORKSPACE_NAME}'].id" -o tsv)
GRAFANA_ID=$(az grafana list -g ${GRAFANA_RESOURCEGROUP} --query "[?name=='${GRAFANA_NAME}'].id" -o tsv)
ALREADY_ENABLED=$(az aks show --resource-group ${RESOURCEGROUP} --name ${AKS_NAME} --query 'azureMonitorProfile.metrics.enabled' -o tsv)

if [ "$ALREADY_ENABLED" == "true" ]; then
echo "monitoring already enabled"
else
az aks update --enable-azure-monitor-metrics \
--resource-group ${RESOURCEGROUP} \
--name ${AKS_NAME} \
--azure-monitor-workspace-resource-id ${MONITORING_WORSPACE_ID} \
--grafana-resource-id ${GRAFANA_ID}
fi

0 comments on commit 9232253

Please sign in to comment.