THold 2.1a: email subject?
Moderators: Developers, Moderators
THold 2.1a: email subject?
Hello,
I would like to change the subject of the email alerts. I modified check-thold.php, but it seems that that subject is not the one being used. I want subject to reflect the "description" column in "host" table instead of the hostname/IP.
Can someone give me some pointers?
Thanks.
I would like to change the subject of the email alerts. I modified check-thold.php, but it seems that that subject is not the one being used. I want subject to reflect the "description" column in "host" table instead of the hostname/IP.
Can someone give me some pointers?
Thanks.
Quick hack?
Above the:
line in functions.php add:
and below it, instead of:
write something like:
Above the:
Code: Select all
/* if there is supposed to be an event generated, do it */
Code: Select all
$sql = "SELECT hostname,description from host where id=$host_id";
$result = mysql_query($sql);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$name = $row['description'];
$ip = $row['hostname'];
Code: Select all
$msg = "Host[$host_id]: "
Code: Select all
$msg = "ALERT $name: "
If you're refering to the alerts you get when a host is down I had to modify the plugins/thold/setup.php file,
Find,And change it to,
This will change the subject of your alerts messages from "Host Error: [host ip address] is DOWN" to "Host Error: [host description] ([host ip address]) is DOWN". It will also change "Host Notice: [host ip address] returned from DOWN state" to "Host Notice: [host description] ([host ip address]) returned from DOWN state".
I hope this helps.
Find,
Code: Select all
if ($status != HOST_DOWN) {
$subject = "Host Notice : " . $hosts[$host_id]["hostname"] . " returned from DOWN state";
$msg= $subject;
thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
} else {
$subject = "Host Error : " . $hosts[$host_id]["hostname"] . " is DOWN";
$msg ="Host Error : " . $hosts[$host_id]["hostname"] . " is DOWN<br>Message : " . $hosts[$host_id]["status_last_error"];
thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
}
Code: Select all
if ($status != HOST_DOWN) {
$subject = "Host Notice : " . $hosts[$host_id]["description"] . "(" . $hosts[$host_id]["hostname"] . ") returned from DOWN state";
$msg= $subject;
thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
} else {
$subject = "Host Error : " . $hosts[$host_id]["description"] . "(" . $hosts[$host_id]["hostname"] . ") is DOWN";
$msg ="Host Error : " . $hosts[$host_id]["hostname"] . " is DOWN<br>Message : " . $hosts[$host_id]["status_last_error"];
thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
}
I hope this helps.
Who is online
Users browsing this forum: No registered users and 0 guests