From 3ef6b6ba8aaa826d9baa5e6d4fcbbe41bd5c4652 Mon Sep 17 00:00:00 2001 From: Paul Caskey Date: Fri, 24 Feb 2017 17:56:06 -0600 Subject: [PATCH] change TIER beacon to JSON/REST --- files/bin/sendtierbeacon.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/files/bin/sendtierbeacon.sh b/files/bin/sendtierbeacon.sh index 8cfca09..f00684e 100644 --- a/files/bin/sendtierbeacon.sh +++ b/files/bin/sendtierbeacon.sh @@ -1,11 +1,25 @@ #!/bin/bash LOGHOST="collector.testbed.tier.internet2.edu" -LOGPORT="5000" +LOGPORT="5001" if [ -s /opt/tier/env.bash ]; then . /opt/tier/env.bash fi -LOGTEXT="TIERBEACON/TIER/1.0#IM=$IMAGENAME#PV=$VERSION#TR=$TIERVERSION#MT=$MAINTAINER#" + +#below for syslog, F-TICKS style +#LOGTEXT="TIERBEACON/TIER/1.0#IM=$IMAGENAME#PV=$VERSION#TR=$TIERVERSION#MT=$MAINTAINER#" + +#below for JSON/REST style +LOGTEXT="{ \"msgType\" : \"TIERBEACON\", \"msgName\" : \"TIER\", \"msgVersion\" : \"1.0\", \"tbProduct\" : \"$IMAGENAME\", \"tbProductVersion\" : \"$VERSION\", \"tbTIERRelease\" : \"$TIERVERSION\", \"tbMaintainer\" : \"$MAINTAINER\" }" + + if [ -z "$TIER_BEACON_OPT_OUT" ]; then - `logger -n $LOGHOST -P $LOGPORT -t TIERBEACON $LOGTEXT` + #send JSON + echo $LOGTEXT > msgjson.txt + curl -s -XPOST "${LOGHOST}:${LOGPORT}/" -H 'Content-Type: application/json' -T msgjson.txt 1>/dev/null + rm -f msgjson.txt + + #below is for syslog, F-TICKS style + #`logger -n $LOGHOST -P $LOGPORT -t TIERBEACON $LOGTEXT` + echo `date`"; TIER beacon sent." fi \ No newline at end of file