Added -N flag to nc invocation

This commit is contained in:
Siarhei Hreben 2018-02-14 14:29:49 +03:00 committed by GitHub
parent be4039d647
commit 66d27887f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ prometheus_httpd () {
echo "Serving prometheus HTTP endpoint at http://localhost:$PROMETHEUS_PORT/metrics"
while true; do
local REQUEST RESPONSE
cat $prometheus_httpd_fifo | nc -l $PROMETHEUS_PORT | while read line; do
cat $prometheus_httpd_fifo | nc -N -l $PROMETHEUS_PORT | while read line; do
line=$(echo "$line" | tr -d '[\r\n]')
# extract the request
if echo "$line" | grep -qE '^GET /'; then
@ -80,4 +80,4 @@ docs () {
echo "$PROMETHEUS_METRIC_NAME{metric=\"<metric>\"} <value> <timestamp>"
echo "PROMETHEUS_PORT=$PROMETHEUS_PORT"
echo "PROMETHEUS_METRIC_NAME=$PROMETHEUS_METRIC_NAME"
}
}