Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Loading status checks…
Merge pull request #15 from docker/instrumentation-p1
initial add for instrumentation
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
LOGHOST="collector.testbed.tier.internet2.edu" | ||
LOGPORT="5001" | ||
if [ -s /opt/tier/env.bash ]; then | ||
. /opt/tier/env.bash | ||
fi | ||
|
||
#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 | ||
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^VERSION" > /opt/tier/env.bash | ||
printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^TIERVERSION" >> /opt/tier/env.bash | ||
printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^IMAGE" >> /opt/tier/env.bash | ||
printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^MAINTAINER" >> /opt/tier/env.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
CRONFILE=/opt/tier/tier-cron | ||
|
||
#set env vars for cron job | ||
/opt/tier/setenv.sh | ||
|
||
#build crontab file with random start time between midnight and 3:59am | ||
echo "#send daily beacon to TIER Central" > ${CRONFILE} | ||
echo "#* * * * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1" >> ${CRONFILE} | ||
echo $(expr $RANDOM % 59) $(expr $RANDOM % 3) "* * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1" >> ${CRONFILE} | ||
chmod 644 ${CRONFILE} | ||
|
||
#install crontab | ||
crontab ${CRONFILE} | ||
|
||
#create cron logfile | ||
touch /var/log/cron.log | ||
|
||
#start crond | ||
/usr/sbin/crond | ||
|
||
#from intermediate container's CMD directive | ||
CMD ["/opt/bin/start.sh"] |