Skip to content

Commit

Permalink
adding physical host name to labels (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <azureuser@ndv5000003.afzljtl0jb5u3fsl3pytzob5tf.jx.internal.cloudapp.net>
  • Loading branch information
rafsalas19 and Ubuntu authored Jun 14, 2023
1 parent 26f88e2 commit d8e82df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ dmypy.json

#config files
*.ini
*prom_sidecar_config.json
*publisher_config.json
*geneva_config.json

# IDE
.vs/
1 change: 1 addition & 0 deletions src/worker/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ global:
subscription: subscription_id
cluster: cluster_name
instance: instance_name
physical_host: physical_host_name
remote_write:
- url: "http://localhost:8081/api/v1/write"
scrape_configs:
Expand Down
12 changes: 12 additions & 0 deletions src/worker/start_managed_prometheus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ get_cluster_name(){
echo $cluster_name
}

get_physical_host_name(){
KVP_PATH='/opt/azurehpc/tools/kvp_client'
if [ -f "$KVP_PATH" ]; then
HOST_NAME=$("$KVP_PATH" 3 | grep -i 'PhysicalHostName;' | awk -F 'Value:' '{print $2}');
echo $HOST_NAME
else
echo "physical_host_name"
fi
}

SUBSCRIPTION_NAME=$(get_subscription)
CLUSTER_NAME=$(get_cluster_name)
PHYS_HOST_NAME=$(get_physical_host_name)

generate_prom(){
DCMG_TARGET=" - $INSTANCE_NAME:8000\n"
Expand All @@ -32,6 +43,7 @@ generate_prom(){
sed -i -r "s/subscription_id/$SUBSCRIPTION_NAME/" $PROM_CONFIG
sed -i -r "s/cluster_name/$CLUSTER_NAME/" $PROM_CONFIG
sed -i -r "s/instance_name/$INSTANCE_NAME/" $PROM_CONFIG
sed -i -r "s/physical_host_name/$PHYS_HOST_NAME/" $PROM_CONFIG

sed -i -r "s/\s+- moneo-worker-0:8000/$DCMG_TARGET/" $PROM_CONFIG
sed -i -r "s/\s+- moneo-worker-0:8001/$NET_TARRGET/" $PROM_CONFIG
Expand Down

0 comments on commit d8e82df

Please sign in to comment.