Skip to content

auto-calling/gateway

Repository files navigation

Atuo-calling-gateway

Feature overview

Gateway receive API request from Nagios, Alert-manager, send message to kafka and insert data to MongoDB

image

Building

Building the Docker image

docker build .

Running

Update ENV docker-compose.yml

docker-compose up -d

How to work

  • set testing env
export GIN_MODE="debug"
export TOKEN="Bearer change_me"
export MONGO_URI="mongodb://root:example@mongo:27017/?authMechanism=SCRAM-SHA-1"
export AUTO_CALLING_COLLECTION="logging"
export TIME_OUT="5s"
export MONGODB_MAX_POOL_SIZE=128
export MONGODB_MIN_POOL_SIZE=5
export KAFKA_BROKER_LIST="127.0.0.1:9092"
export KAFKA_TOPIC="auto-calling"
export KAFKA_GROUP_CONSUMER="auto-calling"
export MONGO_DBNAME="auto-calling"

API structure

  • API receive request https://{DOMAIN}/api/v1/make/event
curl --location --request POST 'https://{DOMAIN}/api/v1/make/event' \
--header 'Authorization: Bearer change_me' \
--header 'Content-Type: application/json' \
--data-raw '{
"host": "192.168.199.199",
"owner": "Admin",
"state":"CRITICAL",
"msg":"Port 8080 down",
"created":"2021-12-12 12:12:12",
"makecall":"true"
}'

Response success and any things else are failed

{
    "data": "60adb0c82ee6f722479890e4",
    "success": true
}

Message send to queue kafka

{
"host":"192.168.199.199",
"owner":"Admin",
"state":"CRITICAL",
"msg":"Port 8080 down",
"created":"2021-12-12 12:12:12",
"status": "Firing",
"makecall":"true"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published