forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add prometheus as datasource Signed-off-by: YANGDB <yang.db.dev@gmail.com> --------- Signed-off-by: YANGDB <yang.db.dev@gmail.com>
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Environment variables for authentication | ||
OPENSEARCH_USERNAME="your_username" | ||
OPENSEARCH_PASSWORD="your_password" | ||
|
||
# The endpoint URL for creating the datasource | ||
ENDPOINT="https://localhost:9200/_plugins/_query/_datasources" | ||
|
||
# The JSON payload | ||
PAYLOAD='{ | ||
"name": "my_prometheus", | ||
"connector": "prometheus", | ||
"properties": { | ||
"prometheus.uri": "http://prometheus:9090" | ||
} | ||
}' | ||
|
||
# Execute the curl command | ||
curl -k -X POST "$ENDPOINT" \ | ||
-u "$OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD" \ | ||
-H "Content-Type: application/json" \ | ||
-d "$PAYLOAD" | ||
|
||
# Check if the curl command was successful | ||
if [ $? -eq 0 ]; then | ||
echo "Datasource created successfully." | ||
else | ||
echo "Failed to create datasource." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters