pushgateway shell脚本

vim push_memory.sh

#!/bin/bash 
# desc push memory info 

total_memory=$(free  |awk '/Mem/{print $2}')
used_memory=$(free  |awk '/Mem/{print $3}')

job_name="pushgateway"
instance_name="192.168.6.128"

cat <<EOF | curl --data-binary @- http://192.168.6.130:9091/metrics/job/$job_name/instance/$instance_name
#TYPE custom_memory_total  gauge
custom_memory_total $total_memory
#TYPE custom_memory_used  gauge
custom_memory_used $used_memory
EOF
posted @ 2022-10-03 00:26  tengfei520  阅读(254)  评论(0编辑  收藏  举报