夜莺 上传 数据
curl --location --request POST 'http://192.168.10.121:82/api/transfer/data' --header 'Content-Type: application/json' --data '[ { "end": 1610692200, "endpoints": ["192.168.10.121"], "counters": ["proc.agent.alive","mem.bytes.total"], "start": 1610690400 } ]'
服务自愈
回调job 192.168.200.44:8004/api/job-ce/callback?tplid=2
通过url 判断服务是否可用
[root@jiaozhou agent]# cat /tmp/curl_jiaozhougateway.sh #!/bin/bash timestamp=$(date +%s) localip=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1) urlstatus=$(curl -s -m 5 -IL --connect-timeout 10 http://192.168.20.157:18081| grep -E 'HTTP/1.1 [2-3][0-9][0-3]' | awk '{print $2}') if [ ! -n "$urlstatus" ]; then urlstatus=0 fi if [ "$urlstatus" -ge 200 -a "$urlstatus" -le 400 ]; then num=1 else num=0 fi echo '[ { "endpoint": "'${localip}'", "tags": "", "timestamp": '${timestamp}', "metric": "net.jiaozhougateway.conn", "value": '${num}' } ]'