Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
6674230f
Commit
6674230f
authored
2 years ago
by
Carlos Natalino Da Silva
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix/ofc22-tests' into feat/optical-cybersecurity
parents
acdeafea
44f9b762
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
deploy.sh
+21
-10
21 additions, 10 deletions
deploy.sh
scripts/show_logs_monitoring.sh
+1
-1
1 addition, 1 deletion
scripts/show_logs_monitoring.sh
src/webui/grafana_dashboard.json
+9
-9
9 additions, 9 deletions
src/webui/grafana_dashboard.json
with
31 additions
and
20 deletions
deploy.sh
+
21
−
10
View file @
6674230f
...
...
@@ -191,6 +191,8 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring"
# Updated Grafana API URL
GRAFANA_URL_UPDATED
=
"http://
${
GRAFANA_USERNAME
}
:
${
TFS_GRAFANA_PASSWORD
}
@
${
GRAFANA_HOSTNAME
}
:
${
GRAFANA_PORT
}${
GRAFANA_BASEURL
}
"
echo
"export GRAFANA_URL_UPDATED=
${
GRAFANA_URL_UPDATED
}
"
>>
$ENV_VARS_SCRIPT
echo
"Connecting to grafana at URL:
${
GRAFANA_URL_DEFAULT
}
..."
# Configure Grafana Admin Password
...
...
@@ -204,24 +206,33 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring"
# Create InfluxDB DataSource
# Ref: https://grafana.com/docs/grafana/latest/http_api/data_source/
curl
-X
POST
-H
"Content-Type: application/json"
-d
'{
"type" : "influxdb",
"name" : "InfluxDB",
"url" : "'
"
$INFLUXDB_URL
"
'",
# TODO: replace user, password and database by variables to be saved
echo
"Creating a datasource..."
curl
-X
POST
-H
"Content-Type: application/json"
-H
"Accept: application/json"
-d
'{
"access" : "proxy",
"basicAuth": false,
"user" : "'
"
$INFLUXDB_USER
"
'",
"password" : "'
"
$INFLUXDB_PASSWORD
"
'",
"type" : "postgres",
"name" : "monitoringdb",
"url" : "monitoringservice:8812",
"database" : "monitoring",
"user" : "admin",
"password" : "quest",
"basicAuth" : false,
"isDefault": true,
"database" : "'
"
$INFLUXDB_DATABASE
"
'"
"jsonData" : {
"sslmode" : "disable",
"postgresVersion" : 1100
},
"secureJsonFields" : {
"password" : true
}
}'
${
GRAFANA_URL_UPDATED
}
/api/datasources
echo
# Create Monitoring Dashboard
# Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/
curl
-X
POST
-H
"Content-Type: application/json"
\
-d
'@src/webui/grafana_dashboard.json'
\
${
GRAFANA_URL_UPDATED
}
/api/dashboards/db
-d
'@src/webui/grafana_dashboard.json'
\
${
GRAFANA_URL_UPDATED
}
/api/dashboards/db
echo
DASHBOARD_URL
=
"
${
GRAFANA_URL_UPDATED
}
/api/dashboards/uid/tf-l3-monit"
...
...
This diff is collapsed.
Click to expand it.
scripts/show_logs_monitoring.sh
+
1
−
1
View file @
6674230f
...
...
@@ -24,4 +24,4 @@ export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
# Automated steps start here
########################################################################################################################
kubectl
--namespace
$TFS_K8S_NAMESPACE
logs deployment/monitoring
service
-c
server
kubectl
--namespace
$TFS_K8S_NAMESPACE
logs deployment/monitoringserver
This diff is collapsed.
Click to expand it.
src/webui/grafana_dashboard.json
+
9
−
9
View file @
6674230f
...
...
@@ -193,19 +193,19 @@
"tags"
:
[
{
"key"
:
"device_id"
,
"operator"
:
"=
~
"
,
"operator"
:
"="
,
"value"
:
"/^$device_id$/"
},
{
"condition"
:
"AND"
,
"key"
:
"endpoint_id"
,
"operator"
:
"=
~
"
,
"operator"
:
"="
,
"value"
:
"/^$endpoint_id$/"
},
{
"condition"
:
"AND"
,
"key"
:
"kpi_sample_type"
,
"operator"
:
"=
~
"
,
"operator"
:
"="
,
"value"
:
"/^$kpi_sample_type$/"
}
]
...
...
@@ -236,7 +236,7 @@
]
},
"datasource"
:
null
,
"definition"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
device_id
\"
"
,
"definition"
:
"S
ELECT DISTINCT device_id FROM monitoring;
"
,
"description"
:
null
,
"error"
:
null
,
"hide"
:
0
,
...
...
@@ -245,7 +245,7 @@
"multi"
:
true
,
"name"
:
"device_id"
,
"options"
:
[],
"query"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
device_id
\"
"
,
"query"
:
"S
ELECT DISTINCT device_id FROM monitoring;
"
,
"refresh"
:
2
,
"regex"
:
""
,
"skipUrlSync"
:
false
,
...
...
@@ -264,7 +264,7 @@
]
},
"datasource"
:
null
,
"definition"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
endpoint_id
\"
WHERE
\"
device_id
\"
=~/^$
device_id
$/
"
,
"definition"
:
"S
ELECT DISTINCT endpoint_id FROM monitoring
WHERE device_id
IN (${
device_id
})
"
,
"description"
:
null
,
"error"
:
null
,
"hide"
:
0
,
...
...
@@ -273,7 +273,7 @@
"multi"
:
true
,
"name"
:
"endpoint_id"
,
"options"
:
[],
"query"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
endpoint_id
\"
WHERE
\"
device_id
\"
=~/^$
device_id
$/
"
,
"query"
:
"S
ELECT DISTINCT endpoint_id FROM monitoring
WHERE device_id
IN (${
device_id
})
"
,
"refresh"
:
2
,
"regex"
:
""
,
"skipUrlSync"
:
false
,
...
...
@@ -292,7 +292,7 @@
]
},
"datasource"
:
null
,
"definition"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
kpi_sample_type
\"
"
,
"definition"
:
"S
ELECT DISTINCT kpi_sample_type FROM monitoring;
"
,
"description"
:
null
,
"error"
:
null
,
"hide"
:
0
,
...
...
@@ -301,7 +301,7 @@
"multi"
:
true
,
"name"
:
"kpi_sample_type"
,
"options"
:
[],
"query"
:
"S
HOW TAG VALUES FROM samples WITH KEY=
\"
kpi_sample_type
\"
"
,
"query"
:
"S
ELECT DISTINCT kpi_sample_type FROM monitoring;
"
,
"refresh"
:
2
,
"regex"
:
""
,
"skipUrlSync"
:
false
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment