yats.git

ref: 0a1177e5eb4a1e591d25e348527cd876b96896af

clients/shell/tlsLog


#! /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\":${TSTAMP},\"name\":\"${METRIC_NAME}\",\"value\":\"${value}\"}"\
	https://kevwe.com:10003/metric