Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute shell script through prometheus alert manger

Please let me know if I can execute a shell script on the same server as Prometheus/alertmanager on an alert trigger? If so, help me with the configurations.

like image 382
PKS Avatar asked Dec 29 '25 06:12

PKS


1 Answers

A maintained alternative is https://github.com/adnanh/webhook which allows you to install local webhooks with scripts attached.

Example config:

- id: redeploy-webhook
  execute-command: "/var/scripts/redeploy.sh"
  command-working-directory: "/var/webhook"

Default port of the webhook process is 9000, so the following URL would execute the redeploy.sh script from above config example.

http://yourserver:9000/hooks/redeploy-webhook

Which can be then used in your alertmanager config:

receivers:
- name: 'general'
  webhook_config:
  - url: http://yourserver:9000/hooks/redeploy-webhook
like image 118
Markus Avatar answered Jan 01 '26 02:01

Markus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!