Description to eventlog thold (SOLVED)

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
Tomic
Posts: 4
Joined: Wed Feb 12, 2014 10:28 am

Description to eventlog thold (SOLVED)

Post by Tomic »

hi all my event log is saying "Cacti[4120]CMDPHP: Host[25] ERROR: HOST EVENT: Host is DOWN Message: Host did not respond to SNMP" when a host goes Down is there any way to make it log the Description of the devices, im sadly not the biggest PHP.
Last edited by Tomic on Thu Feb 27, 2014 5:47 am, edited 1 time in total.
Tomic
Posts: 4
Joined: Wed Feb 12, 2014 10:28 am

Re: Description to eventlog thold

Post by Tomic »

I found a solution on the forum:
anuraganuj wrote:modify following ini functions.php
if ($issue_log_message) {
if ($hosts[$host_id]["status"] == HOST_DOWN) {
cacti_log("Host[$host_id :: $ip] ERROR: HOST EVENT: Host is DOWN Message: " . $hosts[$host_id]["status_last_error"], $print_data_to_stdout);
} else {
cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
}
}


to




$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'];

/* if there is supposed to be an event generated, do it */
if ($issue_log_message) {
if ($hosts[$host_id]["status"] == HOST_DOWN) {
cacti_log("Host[$name :: $ip] ERROR: HOST EVENT: Host is DOWN Message: " . $hosts[$host_id]["status_last_error"], $print_data_to_stdout);
} else {
cacti_log("Host[$host_id] NOTICE: HOST EVENT: Host Returned from DOWN State: ", $print_data_to_stdout);
}
}
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests