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
标签:脚本,shell,Mem,free,pushgateway,memory,print
From: https://www.cnblogs.com/tengfei520/p/16749840.html