-
Notifications
You must be signed in to change notification settings - Fork 0
/
adm_influxdb_show_all_db.sh
executable file
·57 lines (46 loc) · 1.66 KB
/
adm_influxdb_show_all_db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# Testing Influxdb - container must be in running state
#
echo "=> Testing Influxdb - container must be in running state"
if [ ! -e .env ]
then
echo "<!> Please create proper .env file! Exiting."
exit 1
fi
if [ ! -e influxdb.env ]
then
echo "<!> Please create proper influxdb.env file! Exiting."
exit 1
fi
set -o allexport
source .env
source influxdb.env
set +o allexport
cd ${STACKDIR}
echo `pwd`
echo "Compose up influxdb"
${COMPOSECOMMAND} -f docker-compose.yml up -d influxdb
echo "Waiting for 2 sec"
sleep 2
curl -G http://localhost:8086/query --data-urlencode "u=${INFLUXDB_ADMIN_USER}" --data-urlencode "p=${INFLUXDB_ADMIN_PASSWORD}" --data-urlencode "q=SHOW DATABASES"
echo "SHOW USERS"
echo "--------------"
${COMPOSECOMMAND} exec -it influxdb influx -username ${INFLUXDB_ADMIN_USER} -password "${INFLUXDB_ADMIN_PASSWORD}" -execute "SHOW USERS"
read -p "=> Press any key to continue"
echo "SHOW DATABASES"
echo "--------------"
${COMPOSECOMMAND} exec -it influxdb influx -username ${INFLUXDB_ADMIN_USER} -password "${INFLUXDB_ADMIN_PASSWORD}" -execute "USE sensors
SHOW DATABASES"
read -p "=> Press any key to continue"
echo "SHOW SERIES"
echo "-----------"
${COMPOSECOMMAND} exec -it influxdb influx -username ${INFLUXDB_ADMIN_USER} -password "${INFLUXDB_ADMIN_PASSWORD}" -execute "USE sensors
SHOW SERIES"
read -p "=> Press any key to continue"
echo "Show last 20 values"
echo "-------------------"
${COMPOSECOMMAND} exec -it influxdb influx -username ${INFLUXDB_ADMIN_USER} -password "${INFLUXDB_ADMIN_PASSWORD}" -execute "USE sensors
precision rfc3339
SELECT * FROM mqtt_consumer ORDER BY time DESC LIMIT 20"
echo "-------------------"