File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,10 @@ function collect_pv_capacity_metrics(){
3737
3838 for i in ${pv_list[@]}
3939 do
40+ pvc_name=$( kubectl get pv ${i} -o custom-columns=:spec.claimRef.name --no-headers | tr ' [:upper:]' ' [:lower:]' )
4041 size_in_spec=$( kubectl get pv ${i} -o custom-columns=:spec.capacity.storage --no-headers | tr ' [:upper:]' ' [:lower:]' )
4142 size_in_bytes=$( calculate_pv_capacity ${size_in_spec} ; )
42- echo " pv_capacity_bytes{persistentvolume=\" ${i} \" } ${size_in_bytes} " >> ${FILEPATH} /pv_size.prom
43+ echo " pv_capacity_bytes{persistentvolume=\" ${i} \" ,persistentvolumeclaim= \" ${pvc_name} \" } ${size_in_bytes} " >> ${FILEPATH} /pv_size.prom
4344 done
4445}
4546
@@ -65,7 +66,8 @@ function collect_pv_utilization_metrics(){
6566 mount_data=$( du -sb ${i} )
6667 utilization=$( echo ${mount_data} | cut -d " " -f 1)
6768 pv_name=$( basename $( echo ${mount_data} | cut -d " " -f 2) )
68- echo " pv_utilization_bytes{persistentvolume=\" ${pv_name} \" } ${utilization} " >> ${FILEPATH} /pv_used.prom
69+ pvc_name=$( kubectl get pv ${pv_name} -o custom-columns=:spec.claimRef.name --no-headers | tr ' [:upper:]' ' [:lower:]' )
70+ echo " pv_utilization_bytes{persistentvolume=\" ${pv_name} \" ,persistentvolumeclaim=\" ${pvc_name} \" } ${utilization} " >> ${FILEPATH} /pv_used.prom
6971 done
7072}
7173
You can’t perform that action at this time.
0 commit comments