From 297b717965ede69eb7e1f418b28187e175120fa2 Mon Sep 17 00:00:00 2001 From: Soubhik Kumar Gon Date: Wed, 17 Jul 2024 02:47:11 +0530 Subject: [PATCH] feat: mail RFT success --- alert.json | 2 +- Dockerfile => docker/Dockerfile | 0 docker/docker-compose.dev.yml | 35 +++++ .../docker-compose.yml | 12 ++ documents/alert.json | 1 + documents/deleteme.json | 1 + documents/met.json | 1 + met.json | 2 +- src/templ-generator/alerts/index.ts | 135 +++++++++--------- 9 files changed, 120 insertions(+), 69 deletions(-) rename Dockerfile => docker/Dockerfile (100%) create mode 100644 docker/docker-compose.dev.yml rename docker-compose.yml => docker/docker-compose.yml (82%) create mode 100644 documents/alert.json create mode 100644 documents/deleteme.json create mode 100644 documents/met.json diff --git a/alert.json b/alert.json index d69cb7e..7aec385 100644 --- a/alert.json +++ b/alert.json @@ -1 +1 @@ -{"cpu":{"spiked":true,"averagingAt":93.30524570755037,"thresholdSet":70,"time":"2024-07-16T16:52:44.083Z"},"mem":{"spiked":false,"averagingAt":58.24963651548677,"thresholdSet":80,"time":"2024-07-16T16:52:44.083Z"},"disk":{"spiked":false,"averagingAt":46.47777947406973,"thresholdSet":90,"time":"2024-07-16T16:52:44.083Z"}} \ No newline at end of file +{"cpu":{"spiked":true,"averagingAt":93.30524570755037,"thresholdSet":70,"time":"2024-07-16T21:16:19.060Z"},"mem":{"spiked":false,"averagingAt":58.24963651548677,"thresholdSet":80,"time":"2024-07-16T21:16:19.060Z"},"disk":{"spiked":false,"averagingAt":46.47777947406973,"thresholdSet":90,"time":"2024-07-16T21:16:19.060Z"}} \ No newline at end of file diff --git a/Dockerfile b/docker/Dockerfile similarity index 100% rename from Dockerfile rename to docker/Dockerfile diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 0000000..18f038c --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,35 @@ +version: '3.8' + +services: + zookeeper: + image: zookeeper:latest + ports: + - "2181:2181" + + kafka: + image: confluentinc/cp-kafka:latest + ports: + - "9092:9092" + environment: + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://172.30.144.1:9092 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + depends_on: + - zookeeper + + kafka-ui: + container_name: kafka-ui + image: provectuslabs/kafka-ui:latest + ports: + - 8080:8080 + depends_on: + - kafka + environment: + DYNAMIC_CONFIG_ENABLED: 'true' + KAFKA_CLUSTERS_0_NAME: wizard_test + KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092 + + redis: + image: redis/redis-stack-server:latest + ports: + - "6379:6379" \ No newline at end of file diff --git a/docker-compose.yml b/docker/docker-compose.yml similarity index 82% rename from docker-compose.yml rename to docker/docker-compose.yml index 3b32c25..b86ac09 100644 --- a/docker-compose.yml +++ b/docker/docker-compose.yml @@ -33,3 +33,15 @@ services: image: redis/redis-stack-server:latest ports: - "6379:6379" + + terrier: + build: + context: . + dockerfile: Dockerfile + + ports: + - 3030:3030 + depends_on: + - zookeeper + - kafka + - redis \ No newline at end of file diff --git a/documents/alert.json b/documents/alert.json new file mode 100644 index 0000000..d69cb7e --- /dev/null +++ b/documents/alert.json @@ -0,0 +1 @@ +{"cpu":{"spiked":true,"averagingAt":93.30524570755037,"thresholdSet":70,"time":"2024-07-16T16:52:44.083Z"},"mem":{"spiked":false,"averagingAt":58.24963651548677,"thresholdSet":80,"time":"2024-07-16T16:52:44.083Z"},"disk":{"spiked":false,"averagingAt":46.47777947406973,"thresholdSet":90,"time":"2024-07-16T16:52:44.083Z"}} \ No newline at end of file diff --git a/documents/deleteme.json b/documents/deleteme.json new file mode 100644 index 0000000..26c3143 --- /dev/null +++ b/documents/deleteme.json @@ -0,0 +1 @@ +[[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"system.metrics.processor"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"system.metrics.processor"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"system.metrics.processor"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"critical.alerts.handler"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"critical.alerts.handler"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"critical.alerts.handler"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"database.inserter"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"database.inserter"}],[{"consumer":{"events":{"HEARTBEAT":"consumer.heartbeat","COMMIT_OFFSETS":"consumer.commit_offsets","GROUP_JOIN":"consumer.group_join","FETCH":"consumer.fetch","FETCH_START":"consumer.fetch_start","START_BATCH_PROCESS":"consumer.start_batch_process","END_BATCH_PROCESS":"consumer.end_batch_process","CONNECT":"consumer.connect","DISCONNECT":"consumer.disconnect","STOP":"consumer.stop","CRASH":"consumer.crash","REBALANCING":"consumer.rebalancing","RECEIVED_UNSUBSCRIBED_TOPICS":"consumer.received_unsubscribed_topics","REQUEST":"consumer.network.request","REQUEST_TIMEOUT":"consumer.network.request_timeout","REQUEST_QUEUE_SIZE":"consumer.network.request_queue_size"}},"groupId":"database.inserter"}]] \ No newline at end of file diff --git a/documents/met.json b/documents/met.json new file mode 100644 index 0000000..2360f78 --- /dev/null +++ b/documents/met.json @@ -0,0 +1 @@ +{"cpu":"6696a55ceee2824c1a4eb621","disk":"6696a55ceee2824c1a4eb622","mem":"6696a55ceee2824c1a4eb623","network":["6696a55ceee2824c1a4eb624","6696a55ceee2824c1a4eb625","6696a55ceee2824c1a4eb626","6696a55ceee2824c1a4eb627","6696a55ceee2824c1a4eb628","6696a55ceee2824c1a4eb629","6696a55ceee2824c1a4eb62a","6696a55ceee2824c1a4eb62b","6696a55ceee2824c1a4eb62c","6696a55ceee2824c1a4eb62d","6696a55ceee2824c1a4eb62e","6696a55ceee2824c1a4eb62f","6696a55ceee2824c1a4eb630","6696a55ceee2824c1a4eb631"],"user":"66943b0ea2f63e2dd189f8fd","project":"6694c578785da7f95346d185","callNumber":117} \ No newline at end of file diff --git a/met.json b/met.json index 2360f78..5ba8fe5 100644 --- a/met.json +++ b/met.json @@ -1 +1 @@ -{"cpu":"6696a55ceee2824c1a4eb621","disk":"6696a55ceee2824c1a4eb622","mem":"6696a55ceee2824c1a4eb623","network":["6696a55ceee2824c1a4eb624","6696a55ceee2824c1a4eb625","6696a55ceee2824c1a4eb626","6696a55ceee2824c1a4eb627","6696a55ceee2824c1a4eb628","6696a55ceee2824c1a4eb629","6696a55ceee2824c1a4eb62a","6696a55ceee2824c1a4eb62b","6696a55ceee2824c1a4eb62c","6696a55ceee2824c1a4eb62d","6696a55ceee2824c1a4eb62e","6696a55ceee2824c1a4eb62f","6696a55ceee2824c1a4eb630","6696a55ceee2824c1a4eb631"],"user":"66943b0ea2f63e2dd189f8fd","project":"6694c578785da7f95346d185","callNumber":117} \ No newline at end of file +{"cpu":"6696e323d509637b002dec76","disk":"6696e323d509637b002dec77","mem":"6696e323d509637b002dec78","network":["6696e323d509637b002dec79","6696e323d509637b002dec7a","6696e323d509637b002dec7b","6696e323d509637b002dec7c","6696e323d509637b002dec7d","6696e323d509637b002dec7e","6696e323d509637b002dec7f","6696e323d509637b002dec80","6696e323d509637b002dec81","6696e323d509637b002dec82","6696e323d509637b002dec83","6696e323d509637b002dec84","6696e323d509637b002dec85","6696e323d509637b002dec86"],"user":"66943b0ea2f63e2dd189f8fd","project":"6694c578785da7f95346d185","callNumber":122} \ No newline at end of file diff --git a/src/templ-generator/alerts/index.ts b/src/templ-generator/alerts/index.ts index be74f79..f7d2918 100644 --- a/src/templ-generator/alerts/index.ts +++ b/src/templ-generator/alerts/index.ts @@ -15,78 +15,79 @@ import LocaleEnum from '../../constants/locales-support'; */ const en = ` - - + - - Reset Your Password on Fiole - + + Alert Notification + - -
-
-

Reset Your Password

-
-
-

Hi {{username }},

-

We received a request to reset your password for your Fiole account. Please use the following OTP to reset your - password:

-
{{otp}}
-

This OTP is valid for the next {{ expiration }} minutes. Please do not share this OTP with anyone.

-

If you did not request a password reset, please ignore this email or contact our support team for assistance. -

+
+
+

WatchdogCloud Alert

+
+
+

Dear recipient,

+

This is to notify you that the {{ component }} has exceeded the defined threshold.

+

Alert Type: {{ alertType }}

+

Component: {{ component }}

+

Value: {{ cumulativeOrSpikeVal }}

+

Threshold: {{ threshold }}

+

Incident Time: {{ incidentTime }}

+

Please take the necessary actions to resolve this issue.

+

Sent from WatchdogCloud.

+ Take Action +
+
- -
- `;