Skip to content

Commit

Permalink
Use printf and quoting to preserve params
Browse files Browse the repository at this point in the history
  • Loading branch information
hexmode committed Nov 19, 2018
1 parent 2028087 commit 368fd1b
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/roles/meza-log/templates/server-performance.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ parsoidtotalmem=$(echo "$topdata" | grep "parsoid" | awk 'BEGIN { sum = 0 } { su
apachetotalmem=$(echo "$topdata" | grep "apache" | awk 'BEGIN { sum = 0 } { sum += $10 } END { print sum }')


insert_sql=`cat <<EOF
insert_sql=`printf "
INSERT INTO meza_server_log.performance
(
datetime,
Expand All @@ -133,21 +133,19 @@ insert_sql=`cat <<EOF
apache,
jobs
)
VALUES
(
'$datetime',
$loadavg1,
$loadavg5,
$loadavg15,
$memorypercentused,
$mysqltotalmem,
$elastictotalmem,
$memcachedtotalmem,
$parsoidtotalmem,
$apachetotalmem,
$jobs
);
EOF`
VALUES ( '%s', %f, %f, %f, %f, %f, %f, %f, %f, %f, %f );" \
"$datetime" \
"$loadavg1" \
"$loadavg5" \
"$loadavg15" \
"$memorypercentused" \
"$mysqltotalmem" \
"$elastictotalmem" \
"$memcachedtotalmem" \
"$parsoidtotalmem" \
"$apachetotalmem" \
"$jobs"`



# add data point to database
Expand Down

0 comments on commit 368fd1b

Please sign in to comment.