-
Using IDE:
Right-click on your main application class and choose "Run" or "Debug."
-
Using Command Line:
Open a terminal in your project directory. Run
./mvnw spring-boot:run
Navigate to the directory 'docker' containing Docker Compose configuration files and start the services:
cd docker
docker-compose up
This will download the necessary images and start the Prometheus, Grafana, and Alertmanager containers. Once the containers are up and running, you can access the services using the following URLs:
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000
- Alertmanager: http://localhost:9093
- Open a web browser and navigate to the Grafana URL http://localhost:3000.
- Log in using the default credentials: Username:
admin
Password:admin
- Inside Grafana, you can create data sources, import dashboards, and customize your monitoring setup.
- Open Telegram and search for the "BotFather" bot or check How Do I Create a Bot? section https://core.telegram.org/bots#6-botfather
- Start a chat with BotFather and use the /newbot command to create a new bot
- Follow the prompts to choose a name and username for your bot
- BotFather will provide you with a unique bot token. Keep this token safe as it will be needed later
- Create a Telegram channel (if you don't have one) and add your bot as an administrator
- Send a message to your channel using your bot
- Open a web browser and go to https://api.telegram.org/bot<your_bot_token>/getUpdates, replacing <your_bot_token> with your actual bot token
- Look for the "chat" section in the JSON response. The "id" value in this section is your chat ID
Open the alertmanager.yml configuration file (/docker/alert-manager/config/alertmanager.yml).
Replace YOUR_BOT_TOKEN and YOUR_CHAT_ID with the actual values.
telegram_configs:
- bot_token: YOUR_BOT_TOKEN
chat_id: YOUR_CHAT_ID
api_url: https://api.telegram.org
parse_mode: ''
- Start or restart the Prometheus Alertmanager.
- Open the Alertmanager web interface (usually at http://localhost:9093).
- Click the "Status" tab and find the "Telegram" section.
- Click the "Test" button next to your Telegram receiver. If everything is set up correctly, you should receive a test message in your Telegram channel.
Check the official documentation for up-to-date information: https://prometheus.io/docs/alerting/latest/configuration/