#!/bin/bash while test $# -gt 0; do case "$1" in -h|--help) echo "sendMetric.sh - send a single metric to Wavefront proxy" echo " " echo "sendMetric.sh [arguments]" echo " " echo "arguments:" echo "-n specify the hostname/ip of the Wavefront proxy" echo "-p specify the port of the Wavefront proxy" echo "-m specify the metric to send e.g. system.cpu.loadavg.1m 0.03 1382754475 source=test1.wavefront.com" exit 0 ;; -p) shift if test $# -gt 0; then PORT=$1 else echo "no port specified" exit 1 fi shift ;; -n) shift if test $# -gt 0; then HOSTNAME=$1 else echo "no output dir specified" exit 1 fi shift ;; -m*) export METRIC=`echo $1 | sed -e 's/^[^=]*=//g'` shift ;; *) break ;; esac done echo -e "$METRIC\n" | nc $HOSTNAME $PORT -q 2