add comments
This commit is contained in:
parent
3fc017f1b5
commit
ad34bf7f1d
|
|
@ -5,15 +5,21 @@
|
||||||
# It converts the go struct to an influx thing, like you see in uap_influx.go.
|
# It converts the go struct to an influx thing, like you see in uap_influx.go.
|
||||||
# [prefix] is optional. I used it to do all the stat_ uap metrics.
|
# [prefix] is optional. I used it to do all the stat_ uap metrics.
|
||||||
# Very crude, just helps skip a lot of copy/paste.
|
# Very crude, just helps skip a lot of copy/paste.
|
||||||
|
#
|
||||||
path=$1
|
path=$1
|
||||||
pre=$2
|
pre=$2
|
||||||
|
|
||||||
|
# Reads in the file one line at a time.
|
||||||
while IFS='' read -r line; do
|
while IFS='' read -r line; do
|
||||||
|
# Split each piece of the file out.
|
||||||
name=$(echo "${line}" | awk '{print $1}')
|
name=$(echo "${line}" | awk '{print $1}')
|
||||||
type=$(echo "${line}" | awk '{print $2}')
|
type=$(echo "${line}" | awk '{print $2}')
|
||||||
json=$(echo "${line}" | awk '{print $3}')
|
json=$(echo "${line}" | awk '{print $3}')
|
||||||
json=$(echo "${json}" | cut -d\" -f2)
|
json=$(echo "${json}" | cut -d\" -f2)
|
||||||
|
|
||||||
if [ "$json" != "" ] && [ "$name" != "" ]; then
|
# Don't print junk lines. (it still prints some junk lines)
|
||||||
|
if [ "$json" != "" ]; then
|
||||||
|
# Add a .Val suffix if this is a FlexInt or FlexBool.
|
||||||
[[ "$type" = Flex* ]] && suf=.Val
|
[[ "$type" = Flex* ]] && suf=.Val
|
||||||
echo "\"${pre}${json}\": u.Stat.${name}${suf},"
|
echo "\"${pre}${json}\": u.Stat.${name}${suf},"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue