Skip to content

Commit

Permalink
#71 ignore non-existent device mappings and adapt ASE defs, update to…
Browse files Browse the repository at this point in the history
… SE Stetl 1.0.9
  • Loading branch information
justb4 committed Jun 26, 2018
1 parent 6949e1c commit aea5724
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion etl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ then
exit -1
fi

IMAGE=smartemission/se-stetl:1.0.8
IMAGE=smartemission/se-stetl:1.0.9
NAME="stetl_${ETL_PROCESS}"
NETWORK="--network=se_back"
ETL_DEFAULT_ARGS="/work/options/default.args"
Expand Down
21 changes: 5 additions & 16 deletions services/influxdb-dc1/query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Fire query on influxdb local instance.
# usage: ./query.sh host db 'my query'
# examples:
# ./query.sh test.smartemission.nl airsenseur "SELECT sampleRawVal FROM JustObjects1"
# ./query.sh test.smartemission.nl airsenseur "SELECT sampleRawVal FROM JustObjects1 WHERE \"name\" = 'NO2-B43F'"
# ./query.sh test.smartemission.nl airsenseur "SHOW SERIES FROM Geonovum1"
# ./query.sh test.smartemission.nl airsenseur 'DROP MEASUREMENT JustObjects1'
# ./query.sh dc1.smartemission.nl airsenseur "SELECT sampleRawVal FROM ASE_NL_01"
# ./query.sh dc1.smartemission.nl airsenseur "SELECT sampleRawVal FROM ASE_NL_01 WHERE \"name\" = 'NO2B43F'"
# ./query.sh dc1.smartemission.nl airsenseur "SHOW SERIES FROM ASE_NL_02"
# ./query.sh dc1.smartemission.nl airsenseur 'DROP MEASUREMENT ASE_NL_01'

source influxdb.env

Expand All @@ -18,21 +18,10 @@ function query() {
QUERY="${1}"
echo "host: ${INFLUX_HOST} db=${INFLUX_DB} query: ${QUERY}"

# replace all blanks http://stackoverflow.com/questions/5928156/replace-a-space-with-a-period-in-bash
# Basically urlencoding.
# QUERY=${QUERY// /%20}

# Invoke curl to local InfluxDB instance to execute the query/command OLD
# curl \
# -u ${influx_admin_user}:${influx_admin_password} \
# -H "Content-Type:text/plain" \
# -XPOST http://${INFLUX_HOST}:8086/query?q=${QUERY}


# example curl
# curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SELECT value FROM cpu_load_short WHERE region='us-west';SELECT count(value) FROM cpu_load_short WHERE region='us-west'"

curl -u ${influx_admin_user}:${influx_admin_password} \
curl -u ${INFLUXDB_ADMIN_USER}:${INFLUXDB_ADMIN_PASSWORD} \
-GET "http://${INFLUX_HOST}:8086/query?pretty=true" \
--data-urlencode "db=${INFLUX_DB}" \
--data-urlencode "q=${QUERY}"
Expand Down
20 changes: 12 additions & 8 deletions services/influxdb-dc1/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ function query() {
QUERY="$2"
echo "db=$DB - query: ${QUERY}"
# See https://docs.influxdata.com/influxdb/v1.4/guides/querying_data/
curl -G 'http://137.117.141.243:8086/query?pretty=true' \
-u ${INFLUXDB_ADMIN_USER}:${INFLUXDB_ADMIN_PASSWORD} \
curl -G 'http://dc1.smartemission.nl:8086/query?pretty=true' \
-u ${INFLUXDB_READ_USER}:${INFLUXDB_READ_USER_PASSWORD} \
--data-urlencode "db=${DB}" --data-urlencode \
"q=${QUERY}"
}

query _internal "SHOW GRANTS FOR ${INFLUXDB_READ_USER}"
query _internal "SHOW GRANTS FOR ${INFLUXDB_WRITE_USER}"

query _internal "SHOW DATABASES"
query _internal "SHOW USERS"
#query _internal "SHOW GRANTS FOR ${influx_as_database}"
#query _internal "SHOW GRANTS FOR ${INFLUXDB_WRITE_USER}"
#
#query _internal "SHOW DATABASES"
#query _internal "SHOW USERS"

query ${INFLUXDB_DB} "SELECT * from Geonovum1 limit 2"
query ${INFLUXDB_DB} "SELECT * from ASE_NL_01 limit 2"
query ${INFLUXDB_DB} "SELECT * from ASE_NL_02 limit 2"
query ${INFLUXDB_DB} "SELECT * from ASE_NL_03 limit 2"
query ${INFLUXDB_DB} "SELECT * from ASE_NL_04 limit 2"
query ${INFLUXDB_DB} "SELECT * from ASE_NL_05 limit 20"

# examples
# http://test.smartemission.nl:8086/query?db=smartemission&q=SELECT%20*%20from%20rivm%20limit%202
Expand Down

0 comments on commit aea5724

Please sign in to comment.