Aller au contenu

Troubleshooting Promitor#

Azure-CLI#

The Azure CLI (Command-Line Interface) is a powerful tool provided by Microsoft for managing Azure resources from the command line. It allows users to perform a wide range of tasks, from creating and managing virtual machines to configuring networking and storage, deploying applications, and much more.

Install :

toolbox install azure-cli

Tips

Use Grafana or Karma to get variable values.

Login#

CLIENT="" #ons, uvt...
TENANT_ID="" #tenant_id from the firing alert 
SUBSCRIPTION_ID="" #subscription_id from the firing alert
INSTANCE_NAME=$(sd get zones | jq --arg t "$TENANT_ID" --arg c "$CLIENT" -r '."svc-monitoring-stack-client-\($c)".parameters."monitoring-stack".prometheus.exporters.promitor[] | select(.tenant_id == $t) | .name')

CLIENT_ID=$(vault read secret/zones/fe/svc-monitoring-stack-client-${CLIENT}/promitor-client/${INSTANCE_NAME} -format=json | jq -r .data.application_id)
CLIENT_SECRET=$(vault read secret/zones/fe/svc-monitoring-stack-client-${CLIENT}/promitor-client/${INSTANCE_NAME} -format=json | jq -r .data.application_key)

az login --service-principal -u ${CLIENT_ID} -p ${CLIENT_SECRET} --tenant ${TENANT_ID}
az account set --subscription ${SUBSCRIPTION_ID}

Activity-log#

The Azure Activity Log is a platform log in Azure that provides insight into subscription-level events. It records various operations that have been performed on resources within an Azure subscription. The Azure CLI allows you to query and analyze this log to monitor the environment and troubleshoot issues.

Check creating requests#

az monitor activity-log list --start-time YYYY-MM-DD --end-time YYYY-MM-DD | jq '[.[] | select((.operationName.value | contains("write")) and (.id | test("<RESOURCE_NAME>"; "i")))]'

Check deleting requests#

az monitor activity-log list --start-time YYYY-MM-DD --end-time YYYY-MM-DD | jq '[.[] | select((.operationName.value | contains("delete")) and (.id | test("<RESOURCE_NAME>"; "i")))]'

Monitor metrics#

Azure Monitor Metrics is a feature of Azure Monitor that enables you to collect, analyze, and act on metrics.

Check metrics#

az monitor metrics list  --metric "<METRIC_NAME>" --resource "<RESOURCE_URI>" --start-time <YYYY-MM-DDTHH:MM:SSZ> --end-time <YYYY-MM-DDTHH:MM:SSZ>