A complete solution for sending Prometheus alerts to Microsoft Teams via Power Automate webhooks.
This solution bridges the gap between Prometheus alerts and Microsoft Teams by:
- Converting Prometheus alerts to MS Teams MessageCard format
- Transforming MessageCards to Adaptive Cards for Power Automate compatibility
- Delivering formatted alerts to your Teams chat via Power Automate webhooks
Prometheus → Alertmanager → prometheus-msteams → teams-webhook-proxy → Power Automate → MS Teams
- Prometheus monitors your infrastructure and fires alerts
- Alertmanager receives alerts and routes them to configured receivers
- prometheus-msteams converts alerts to MS Teams MessageCard format
- teams-webhook-proxy (our custom component) converts MessageCards to Adaptive Cards
- Power Automate receives webhooks and posts to Teams chat
✅ Adaptive Card Support - Properly formatted cards for modern Teams
✅ Power Automate Compatible - Works with Power Automate webhook triggers
✅ Systemd Integration - Production-ready service management
✅ Easy Installation - Automated setup script included
✅ Comprehensive Testing - Multiple test scenarios provided
✅ Full Documentation - Complete troubleshooting guide
- Ubuntu/Debian system with Prometheus and Alertmanager installed
- Node.js (installed automatically by the setup script)
- MS Teams with Power Automate webhook configured
- Clone this repository:
git clone <your-repo-url>
cd prometheus-msteams
- Configure your webhook URL:
# Edit the webhook URL in the proxy script
nano scripts/teams-webhook-proxy.js
# Replace 'YOUR_POWER_AUTOMATE_WEBHOOK_URL_HERE' with your actual webhook URL
- Run the installation script:
sudo bash scripts/install-teams-alerting.sh
- Test the setup:
bash examples/test-alert.sh
- Create a new Power Automate flow
- Use "When a HTTP request is received" trigger
- Configure to accept JSON with this schema:
{
"type": "object",
"properties": {
"type": {"type": "string"},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"contentType": {"type": "string"},
"content": {"type": "object"}
}
}
}
}
}
- Add "Post adaptive card in a chat or channel" action
- Use the webhook URL from step 2 in
teams-webhook-proxy.js
Update your /etc/prometheus/alertmanager.yml
:
global:
resolve_timeout: 5m
route:
receiver: 'teams-notifier'
receivers:
- name: 'teams-notifier'
webhook_configs:
- url: 'http://localhost:2000/alertmanager'
send_resolved: true
Ensure your /etc/prometheus/prometheus.yml
includes:
alerting:
alertmanagers:
- static_configs:
- targets:
- 'localhost:9093'
rule_files:
- '/etc/prometheus/alerts/*.yml'
sudo systemctl start teams-webhook-proxy.service
sudo systemctl start prometheus-msteams.service
sudo systemctl status teams-webhook-proxy.service
sudo systemctl status prometheus-msteams.service
sudo journalctl -u teams-webhook-proxy.service -f
sudo journalctl -u prometheus-msteams.service -f
bash examples/test-alert.sh
bash examples/test-proxy.sh
curl -X POST http://localhost:2000/alertmanager -H "Content-Type: application/json" -d @examples/test-payload.json
Services not starting:
- Check if ports 2000 and 3001 are available:
ss -tulpn | grep -E ':(2000|3001)'
- Verify Node.js is installed:
node --version
- Check service logs:
sudo journalctl -u teams-webhook-proxy.service
Alerts not reaching Teams:
- Test each component in the chain individually
- Verify webhook URL is correct and accessible
- Check Power Automate flow configuration
Power Automate errors:
- Ensure the HTTP trigger schema matches the expected format
- Verify the adaptive card action is properly configured
- Check that the webhook URL has proper permissions
- 2000: prometheus-msteams bridge
- 3001: teams-webhook-proxy
- 9090: Prometheus web interface
- 9093: Alertmanager web interface
├── scripts/
│ ├── teams-webhook-proxy.js # Main proxy script
│ ├── teams-webhook-proxy.service # Systemd service file
│ ├── prometheus-msteams.service # Systemd service file
│ └── install-teams-alerting.sh # Installation script
├── configs/
│ ├── alertmanager.yml # Example Alertmanager config
│ ├── prometheus.yml # Example Prometheus config
│ └── disk_alerts.yml # Example alert rules
├── examples/
│ ├── test-alert.sh # Test complete chain
│ └── test-proxy.sh # Test proxy only
└── README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Keep your webhook URLs secure and never commit them to public repositories
- Consider running services with dedicated non-root users in production
- Use HTTPS for all external communications
- Regularly update dependencies and review configurations
This project is open source. Feel free to use, modify, and distribute as needed.
For issues and questions:
- Check the troubleshooting section above
- Review service logs
- Test individual components
- Open an issue with detailed information
Made with ❤️ for the monitoring community
Solution developed with assistance from Claude (Anthropic AI)