yats.git

ref: 52368506e6152253b608f553efaa4d1acf55bec6

clients/shell/listLogs


#! /bin/bash
#
CFG_FILE=$HOME/.draft.cfg
test -f $CFG_FILE && source $CFG_FILE
SECURE_CA_HOME=${SECURE_HOME}/CA
CA_CERTIFICATE=${SECURE_CA_HOME}/ca.crt
CERTIFICATE=${SECURE_HOME}/${SECURE_SERVICE}/certs/${SECURE_CLIENT}/${SECURE_CLIENT}.crt
PRIVATE_KEY=${SECURE_HOME}/${SECURE_SERVICE}/certs/${SECURE_CLIENT}/${SECURE_CLIENT}.key

test -f ${CA_CERTIFICATE} || echo "Missing CA file: ${CA_CERTIFICATE}"
test -f ${CERTIFICATE} || echo "Missing Certificate file: ${CERTIFICATE}"
test -f ${PRIVATE_KEY} || echo "Missing Private KEY file: ${PRIVATE_KEY}"

CURL_COMMAND="curl -s --cacert ${CA_CERTIFICATE} --cert ${CERTIFICATE} --key ${PRIVATE_KEY}  --cert-type PEM "

METRIC_NAME="phoenix-log"

TSTAMP=$(date '+%s')
value=$1
${CURL_COMMAND} \
	-X POST\
	--header "Content-Type: application/json"\
	-d "{\"mtime\":1718000,\"name\":\"${METRIC_NAME}\",\"value\":\"${value}\"}"\
	https://kevwe.com:10003/metric/get