Rob_L
Rob_L

Reputation: 1

Monit host identify

Is there a way to have monit identify a host inside the mail-format other than hostname? Having hostname only seems very limiting. In the environment I am working it, it is an education and training environment so VMs will be deployed for a week and then deleted, so most end up using the same hostname. I was hoping for more identifiers, at bare minimum at least getting one of the IPs to show-up in the email alert. There doesn't seem to be a way to add more variables or change the current ones, nor does there seem to be a way to get send the results of a script other than one being used to check program and if that one has an error. Any thoughts or ideas how to go about this?

Adding an exec command to run a script if a check fails but the results of the exec don't show up in the email. Adding a global environment variable. Adding a path to the script in the mail-format. None of these work. Within the mail-format seems to send exactly what is there unless it's one of 6 $name variables, and this doesn't seem to be edited anywhere easily. The only work around I have come up with is to add something in a script and use a check program, but this forces me to use a script on every check or else I can't identify the host.

Upvotes: 0

Views: 77

Answers (1)

lutzmad
lutzmad

Reputation: 389

There are only some "variables" available in the "set mail-format" statement, see https://mmonit.com/monit/documentation/monit.html#Message-format

I use templates (based on M4) to create my Monit configurations and add a "hint" based on the system to the subject. This is a static value from the Monit point of view, but in the used templates the value is a variable.

A suggestion only.

Upvotes: 0

Related Questions