user1495746
user1495746

Reputation: 21

munin alert through external scripts fails

I am stuck with munin alerts through external scripts. I followed the guide here(http://guide.munin-monitoring.org/en/latest/tutorial/alert.html#alerts-to-or-through-external-scripts), but it turned out wrong.

contact.test.command >/etc/munin/scripts/sendsms.py /etc/munin/scripts/sendsms.py

munin-limits log shows:

[WARNING] Found ">" at beginning of command. This should no longer be necessary and will be removed from the command before execution.

[WARNING] Failed to close pipe for contact test: Broken pipe

And sendsms.py receives nothing from stdin, which is weird.

Where is the alert info? What's the correct way to write the command?

Upvotes: 2

Views: 1034

Answers (3)

aver
aver

Reputation: 129

best is to debug it this way:

su - munin --shell=/bin/bash
/usr/share/munin/munin-limits

Upvotes: 0

Zahar
Zahar

Reputation: 1

You forgot to add [pipe] for your script.

Can use static message like this:

contact.test.command | /path/to/my_python_script.py "something gone wrong!!!"

Or use [vars] supplied by munin:

contact.test.command | /path/to/my_python_script.py "${var:group} ${var:host} ${var:graph_category} '${var:graph_title}'"

Upvotes: 0

Christian Stade-Schuldt
Christian Stade-Schuldt

Reputation: 4861

I am running alerts based on a python script on my server. To set this up put it into your /etc/munin/munin.conf In my case that would look like:

contact.test.command | /path/to/my_python_script.py

The python script itself is executable by munin. Inside the script I read from Stdin the text that is specified at

contact.test.text some text and ${var:label} 

using some of the Munin variables specified at http://munin-monitoring.org/wiki/MuninAlertVariables

Upvotes: 1

Related Questions