This application gives you a nifty icon in the Mac Taskbar "" which indicates the status of your Kubernetes cluster by examining the Prometheus status.
When clicking on the icon, you get a dropdown list which allows you to identify the cluster which reports a problem:
If you click on one of the configurations in the dropdown, you toggle whether it gets checked or not. In the example images "local-prometheus" is deactivated. You decide your own names in the configuration.
You need jdk-21 with jpackage. The rest of the dependencies should get pulled in.
If running on Gnome, you need the Tray Icons: Reloaded extension.
./mvnw -B clean package
cd target
jpackage --verbose --name mcalert --input quarkus-app \
--description "Read Prometheus endpoint and show status as toolbar icon" \
--icon ../mcalert.icns \
--main-jar quarkus-run.jar
Create a file in your home directory named $HOME/.mcalert.properties
and
configure endpoints. You can have as many endpoints as you like:
mcalert.prometheus.endpoints.<NAME>.uri=http://prometheus.somewhere.local.gd:9090/api/v1/alerts
mcalert.prometheus.endpoints.<NAME>.ignore-alerts=CPUThrottlingHigh,KubeControllerManagerDown
mcalert.prometheus.endpoints.<NAME>.watchdog-alerts=disabled
You can have different endpoints with different NAME
. Fill in the relevant alerts for each environment.
You can supply headers. The example illustrates what to do when you want an Authorization
header.
By increasing the index, you can add more headers.
mcalert.prometheus.endpoints<NAME>.header[0].name=Authorization
mcalert.prometheus.endpoints<NAME>.header[0].content=Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Dev mode configuration in application.properties, expects a port-forward proxy to Prometheus similar to:
kubectl port-forward -n monitoring svc/prometheus-k8s 9090
This is a Quarkus based application created with:
quarkus create app io.github.nostra:mcalert --java=21 --no-code
quarkus extension add picocli
quarkus extension add resteasy-reactive-jackson
quarkus extension add rest-client-reactive-jackson
quarkus extension add quarkus-scheduler
./mvnw -B package
java -jar target/quarkus-app/quarkus-run.jar
Icons downloaded from