Skip to content

Commit

Permalink
NOD-777: [Dismissione WISP] ELK Monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fparisitas committed Apr 3, 2024
1 parent 1da3028 commit 51d2b87
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 deletions.
6 changes: 6 additions & 0 deletions src/domains/nodo-app/env/weu-prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ pod_disruption_budgets = {
"app.kubernetes.io/instance" = "pagopawfespwfesp"
}
},
"wispsoapconverter" = {
minAvailable = 1
matchLabels = {
"app.kubernetes.io/instance" = "wispsoapconverter"
}
}
}

app_gateway_allowed_paths_pagopa_onprem_only = {
Expand Down
2 changes: 1 addition & 1 deletion src/elk-monitoring/05_elastic_stack.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module "elastic_stack" {
nodeset_config = var.nodeset_config

dedicated_log_instance_name = [
/* nodo */ "nodo", "nodoreplica", "nodocron", "nodocronreplica", "pagopawebbo", "pagopawfespwfesp", "pagopafdr", "pagopafdrnodo, wispsoapconverter",
/* nodo */ "nodo", "nodoreplica", "nodocron", "nodocronreplica", "pagopawebbo", "pagopawfespwfesp", "pagopafdr", "pagopafdrnodo", "wispsoapconverter",
/* afm */ "pagopaafmcalculator-microservice-chart", "pagopaafmmarketplacebe-microservice-chart", "pagopaafmutils-microservice-chart",
/* bizevents */ "pagopabizeventsdatastore-microservice-chart", "pagopabizeventsservice-microservice-chart", "pagopanegativebizeventsdatastore-microservice-chart",
/* apiconfig */ "pagopaapiconfig-postgresql", "pagopaapiconfig-oracle", "apiconfig-selfcare-integration-microservice-chart", "cache-oracle", "cache-postgresql", "cache-replica-oracle", "cache-replica-postgresql",
Expand Down
19 changes: 19 additions & 0 deletions src/elk-monitoring/05_kibana_dashboard_ndp.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#################################### [NDP] ####################################
locals {
dashboard_path = "${path.module}/ndp/${local.ndp_nodo_key}/dashboard/*.ndjson"
wsc_dashboard_path = "${path.module}/ndp/${local.ndp_wispsoapconverter_key}/dashboard/*.ndjson"
replica_dashboard_path = var.env_short != "p" ? "${path.module}/ndp/${local.ndp_nodoreplica_key}/dashboard/*.ndjson" : "/FAKE-NO-REPLICA"
# replica_query_path = var.env_short != "p" ? "${path.module}/ndp/${local.ndp_nodoreplica_key}/query/*.ndjson" : "/FAKE-NO-REPLICA"
}
Expand Down Expand Up @@ -42,3 +43,21 @@ resource "null_resource" "ndp_nodoreplica_upload_dashboard" {
interpreter = ["/bin/bash", "-c"]
}
}

resource "null_resource" "ndp_wispsoapconverter_upload_dashboard" {

triggers = {
always_run = "${timestamp()}"
}

for_each = fileset(path.module, local.wsc_dashboard_path)

provisioner "local-exec" {
command = <<EOT
curl -k -X POST "${local.kibana_url}/s/${local.ndp_space_name}/api/saved_objects/_import?overwrite=true" \
-H 'kbn-xsrf: true' \
--form "file=@./${each.value}"
EOT
interpreter = ["/bin/bash", "-c"]
}
}
32 changes: 16 additions & 16 deletions src/elk-monitoring/05_kibana_log_ndp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_ingest_pipeline" {
curl -k -X PUT "${local.elastic_url}/_ingest/pipeline/${local.ndp_pagopawfespwfesp_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_ingest_pipeline}'> ndp_pagopawfespwfesp_ingest_pipeline.txt
-d '${local.ndp_pagopawfespwfesp_ingest_pipeline}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -892,7 +892,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_ilm_policy" {
curl -k -X PUT "${local.elastic_url}/_ilm/policy/${local.ndp_pagopawfespwfesp_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_ilm_policy}'> ndp_pagopawfespwfesp_ilm_policy.txt
-d '${local.ndp_pagopawfespwfesp_ilm_policy}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -910,7 +910,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_component_template_package" {
curl -k -X PUT "${local.elastic_url}/_component_template/${local.ndp_pagopawfespwfesp_key}@package" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_component_template_package}'> ndp_pagopawfespwfesp_component_template_package.txt
-d '${local.ndp_pagopawfespwfesp_component_template_package}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -928,7 +928,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_component_template_custom" {
curl -k -X PUT "${local.elastic_url}/_component_template/${local.ndp_pagopawfespwfesp_key}@custom" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_component_template_custom}'> ndp_pagopawfespwfesp_component_template_custom.txt
-d '${local.ndp_pagopawfespwfesp_component_template_custom}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -947,7 +947,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_index_template" {
curl -k -X PUT "${local.elastic_url}/_index_template/${local.ndp_pagopawfespwfesp_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_index_template}'> ndp_pagopawfespwfesp_index_template.txt
-d '${local.ndp_pagopawfespwfesp_index_template}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -964,7 +964,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_data_stream_rollover" {
command = <<EOT
curl -k -X POST "${local.elastic_url}/logs-${local.ndp_pagopawfespwfesp_key}-default/_rollover/" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' > ndp_pagopawfespwfesp_data_stream_rollover.txt
-H 'Content-Type: application/json'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -982,7 +982,7 @@ resource "null_resource" "ndp_pagopawfespwfesp_kibana_data_view" {
curl -k -X POST "${local.kibana_url}/s/${local.ndp_space_name}/api/data_views/data_view" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_pagopawfespwfesp_data_view}' > ndp_pagopawfespwfesp_kibana_data_view.txt
-d '${local.ndp_pagopawfespwfesp_data_view}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -1002,7 +1002,7 @@ resource "null_resource" "ndp_wispsoapconverter_ingest_pipeline" {
curl -k -X PUT "${local.elastic_url}/_ingest/pipeline/${local.ndp_wispsoapconverter_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_ingest_pipeline}' > ndp_wispsoapconverter_ingest_pipeline.txt
-d '${local.ndp_wispsoapconverter_ingest_pipeline}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -1020,7 +1020,7 @@ resource "null_resource" "ndp_wispsoapconverter_ilm_policy" {
curl -k -X PUT "${local.elastic_url}/_ilm/policy/${local.ndp_wispsoapconverter_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_ilm_policy}' > ndp_wispsoapconverter_ilm_policy.txt
-d '${local.ndp_wispsoapconverter_ilm_policy}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -1038,7 +1038,7 @@ resource "null_resource" "ndp_wispsoapconverter_component_template_package" {
curl -k -X PUT "${local.elastic_url}/_component_template/${local.ndp_wispsoapconverter_key}@package" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_component_template_package}' > ndp_wispsoapconverter_component_template_package.txt
-d '${local.ndp_wispsoapconverter_component_template_package}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -1056,7 +1056,7 @@ resource "null_resource" "ndp_wispsoapconverter_component_template_custom" {
curl -k -X PUT "${local.elastic_url}/_component_template/${local.ndp_wispsoapconverter_key}@custom" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_component_template_custom}' > ndp_wispsoapconverter_component_template_custom.txt
-d '${local.ndp_wispsoapconverter_component_template_custom}'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand All @@ -1074,14 +1074,14 @@ resource "null_resource" "ndp_wispsoapconverter_index_template" {
curl -k -X PUT "${local.elastic_url}/_index_template/${local.ndp_wispsoapconverter_key}" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_index_template}' > ndp_wispsoapconverter_index_template.txt
-d '${local.ndp_wispsoapconverter_index_template}'
EOT
interpreter = ["/bin/bash", "-c"]
}
}

resource "null_resource" "ndp_wispsoapconverter_kibana_data_view" {
depends_on = [null_resource.ndp_kibana_space]
depends_on = [null_resource.ndp_wispsoapconverter_index_template]

triggers = {
always_run = "${timestamp()}"
Expand All @@ -1092,14 +1092,14 @@ resource "null_resource" "ndp_wispsoapconverter_kibana_data_view" {
curl -k -X POST "${local.kibana_url}/s/${local.ndp_space_name}/api/data_views/data_view" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '${local.ndp_wispsoapconverter_data_view}' > ndp_wispsoapconverter_kibana_data_view.txt
-d '${local.ndp_wispsoapconverter_data_view}'
EOT
interpreter = ["/bin/bash", "-c"]
}
}

resource "null_resource" "ndp_wispsoapconverter_data_stream_rollover" {
depends_on = [null_resource.ndp_wispsoapconverter_index_template]
depends_on = [null_resource.ndp_wispsoapconverter_kibana_data_view]

triggers = {
always_run = "${timestamp()}"
Expand All @@ -1109,7 +1109,7 @@ resource "null_resource" "ndp_wispsoapconverter_data_stream_rollover" {
command = <<EOT
curl -k -X POST "${local.elastic_url}/logs-${local.ndp_wispsoapconverter_key}-default/_rollover/" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' > ndp_wispsoapconverter_data_stream_rollover.txt
-H 'Content-Type: application/json'
EOT
interpreter = ["/bin/bash", "-c"]
}
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 51d2b87

Please sign in to comment.