AlertHole - a Mojolicious Webapp to Log Alerts from External Vendors
I needed a simple web application which could handle alerts over HTTP. I wanted it to be as simple as possible, while still having the possibility to add as many different external vendors that I wanted, hence I choose to use the Mojolicious framework to acheive this.
The following illustrates how it works:
The idea is that you generate a sufficiently complex UserAgent string with your preferred tool:
pwgen -c 64
Share the "key" (UserAgent string) with the vendor/remote monitoring company and ask them to incorporate it into their alert routine.
Here is a simple curl example:
export msg=$(echo -n "Achtung Critical Alarm" | perl -MURI::Escape -ne 'print uri_escape($_)')
curl --user-agent "TheeTah8quezie0dielieyeSai6zoot9ainootheicahyeuj1iesahdohyoo2Eib" -v --get -f https://alert_hole_url/alert/${msg}
Basically the msg can be of any length containing any chars as long as it is URI escaped.
The above command will write the following entry in /opt/alerthole/alert_hole/logs/alert_hole-megamamma.log:
[Fri Nov 11 10:35:21 2016] [warn] Alert received: Achtung Critical Alarm
I recommend running the application with HTTPS using nginx as reverse proxy.
The code and configuration examples can be found in the GitHub AlertHole repository: