yats.git

ref: 92e4d568d93c07f514445faecc883cd7cc717f70

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