Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
flowengine-docker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template
flowengine-docker
Commits
a204788d
Commit
a204788d
authored
Nov 01, 2023
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bash script of influxdb
parent
ebea94ec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
bash-influx/init.bash
+15
-2
No files found.
bash-influx/init.bash
View file @
a204788d
...
...
@@ -28,7 +28,20 @@ do
done
<<<
"
$(
echo
"
$orgInfo
"
| awk
'NR > 1'
)
"
LengthOrgID
=
${#
OrgID
}
done
echo
"OrgID:
${
OrgID
[@]
}
"
bucketInfo
=
$(
influx bucket list
--token
$INFLUX_TOKEN
--org
$ORG_NAME
--host
$URI
)
bucketInfo
=
$(
echo
"
$bucketInfo
"
| sed
-e
's/^[ \t]*//'
)
while
read
-r
line
;
do
echo
$line
name
=
$(
echo
"
$line
"
| awk
'{print $2}'
)
echo
$name
if
[
"
$BUCKET_NAME
"
==
"
$name
"
]
;
then
echo
this scripte is used.
exit
0
fi
done
<<<
"
$(
echo
"
$bucketInfo
"
| awk
'NR > 1'
)
"
curl
--request
POST
${
URI
}
/api/v2/buckets
-H
"Authorization: Token
${
INFLUX_TOKEN
}
"
-H
"Accept: application/json"
-H
"Content-Type: application/json"
-d
"{
\"
name
\"
:
\"
${
BUCKET_NAME
}
\"
,
\"
description
\"
:
\"
A bucket holding air sensor data
\"
,
\"
orgID
\"
:
\"
${
OrgID
[@]
}
\"
,
\"
retentionRules
\"
: [ {
\"
type
\"
:
\"
expire
\"
,
\"
everySeconds
\"
: 15552000 } ] }"
#2592000
output
=
$(
influx bucket list
--token
$INFLUX_TOKEN
--org
$ORG_NAME
--host
$URI
)
...
...
@@ -75,8 +88,8 @@ echo "Shard Duration: ${ShardDuration[@]}"
echo
"Organization ID:
${
OrgID
[@]
}
"
echo
"Schema Type:
${
SchemaType
[@]
}
"
#echo curl -X POST http://localhost:8086/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"s
tring
\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }"
curl
-X
POST
${
URI
}
/api/v2/scrapers
-H
"Authorization: Token
${
INFLUX_TOKEN
}
"
-H
"Content-Type: application/json"
-d
"{
\"
allowInsecure
\"
: false,
\"
orgID
\"
:
\"
${
OrgID
[@]
}
\"
,
\"
bucketID
\"
:
\"
${
ID
[@]
}
\"
,
\"
name
\"
:
\"
s
t
ring
\"
,
\"
type
\"
:
\"
prometheus
\"
,
\"
url
\"
:
\"
http://localhost:8086/metrics
\"
}"
-i
#echo curl -X POST http://localhost:8086/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"s
craper_metrics
\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }"
curl
-X
POST
${
URI
}
/api/v2/scrapers
-H
"Authorization: Token
${
INFLUX_TOKEN
}
"
-H
"Content-Type: application/json"
-d
"{
\"
allowInsecure
\"
: false,
\"
orgID
\"
:
\"
${
OrgID
[@]
}
\"
,
\"
bucketID
\"
:
\"
${
ID
[@]
}
\"
,
\"
name
\"
:
\"
s
craper_monito
ring
\"
,
\"
type
\"
:
\"
prometheus
\"
,
\"
url
\"
:
\"
http://localhost:8086/metrics
\"
}"
-i
echo
----success----
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment