Skip to content

Commit 62653fe

Browse files
committed
patched for pcluster 2.11.1 and external fsx
1 parent e92abfc commit 62653fe

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

custom-metrics/1h-cost-metrics.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
export AWS_DEFAULT_REGION=$cfn_region
1313
aws_region_long_name=$(python /usr/local/bin/aws-region.py $cfn_region)
14+
aws_region_long_name=${aws_region_long_name/Europe/EU}
1415

1516
masterInstanceType=$(ec2-metadata -t | awk '{print $2}')
1617
masterInstanceId=$(ec2-metadata -i | awk '{print $2}')
@@ -58,18 +59,26 @@ echo "master_node_cost $master_node_h_price" | curl --data-binary @- http://127.
5859

5960

6061
####################### FSX #########################
61-
fsx_size_gb=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
62+
#fsx_size_gb=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
63+
# | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
64+
# | awk -F "," '{print $3}')
65+
#
66+
#fsx_type=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
67+
# | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
68+
# | awk -F "," '{print $9}')
69+
#
70+
#fsx_throughput=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
71+
# | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
72+
# | awk -F "," '{print $10}')
73+
74+
fsx_id=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
6275
| jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
63-
| awk -F "," '{print $3}')
76+
| awk -F "," '{print $2}')
77+
fsx_summary=$(aws fsx describe-file-systems --region $cfn_region --file-system-ids $fsx_id)
78+
fsx_size_gb=$(echo $fsx_summary | jq -r '.FileSystems[0].StorageCapacity')
79+
fsx_type=$(echo $fsx_summary | jq -r '.FileSystems[0].LustreConfiguration.DeploymentType')
80+
fsx_throughput=$(echo $fsx_summary | jq -r '.FileSystems[0].LustreConfiguration.PerUnitStorageThroughput')
6481

65-
fsx_type=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
66-
| jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
67-
| awk -F "," '{print $9}')
68-
69-
fsx_throughput=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
70-
| jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
71-
| awk -F "," '{print $10}')
72-
7382
if [[ $fsx_type = "SCRATCH_2" ]] || [[ $fsx_type = "SCRATCH_1" ]]; then
7483
fsx_cost_gb_month=$(aws pricing get-products \
7584
--region us-east-1 \
@@ -124,4 +133,4 @@ do
124133
ebs_volume_total_cost=$(echo "scale=2; $ebs_volume_total_cost + $ebs_volume_cost" | bc)
125134
done
126135

127-
echo "ebs_master_cost $ebs_volume_total_cost" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost
136+
echo "ebs_master_cost $ebs_volume_total_cost" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost

custom-metrics/1m-cost-metrics.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
export AWS_DEFAULT_REGION=$cfn_region
1313
aws_region_long_name=$(python /usr/local/bin/aws-region.py $cfn_region)
14+
aws_region_long_name=${aws_region_long_name/Europe/EU}
1415

1516
monitoring_dir_name=$(echo ${cfn_postinstall_args}| cut -d ',' -f 2 )
1617
monitoring_home="/home/${cfn_cluster_user}/${monitoring_dir_name}"
@@ -57,4 +58,4 @@ for queue in $queues; do
5758
done
5859

5960
echo "ebs_compute_cost $compute_ebs_volume_cost" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost
60-
echo "compute_nodes_cost $compute_nodes_total_cost" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost
61+
echo "compute_nodes_cost $compute_nodes_total_cost" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost

0 commit comments

Comments
 (0)