Skip to content

Commit

Permalink
GDB-286 initial commit with tf new module
Browse files Browse the repository at this point in the history
  • Loading branch information
ivorusev committed Oct 12, 2023
1 parent ed4548e commit 1e0b374
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/monitoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GraphDB AWS Configuration Module

TBD
25 changes: 25 additions & 0 deletions modules/monitoring/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "aws_cloudwatch_dashboard" "main" {
dashboard_name = "${var.resource_name_prefix}-dashboard"

dashboard_body = jsonencode({
widgets = [
{
"height": 6,
"width": 6,
"y": 0,
"x": 0,
"type": "metric",
"properties": {
"metrics": [
[ { "expression": "SELECT AVG(graphdb_cpu_load) FROM \"GraphDB-Metrics\" GROUP BY host", "id": "q1", "label": "CPU", "${var.aws_region}": "eu-central-1", "stat": "Average" } ]
],
"region": var.aws_region,
"stacked": false,
"view": "timeSeries",
"period": 300,
"stat": "Average"
}
}
]
})
}
Empty file added modules/monitoring/outputs.tf
Empty file.
9 changes: 9 additions & 0 deletions modules/monitoring/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "resource_name_prefix" {
description = "Resource name prefix used for tagging and naming AWS resources"
type = string
}

variable "aws_region" {
description = "AWS region where GraphDB is being deployed"
type = string
}
3 changes: 3 additions & 0 deletions modules/user_data/templates/start_graphdb.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ echo 'fs.file-max = 262144' | tee -a /etc/sysctl.conf

sysctl -p

chown -R graphdb:graphdb /etc/graphdb/ /etc/prometheus/
amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/etc/graphdb/cloudwatch-agent-config.json

# the proxy service is set up in the AMI but not enabled there, so we enable and start it
systemctl daemon-reload
systemctl start graphdb
Expand Down

0 comments on commit 1e0b374

Please sign in to comment.