Hello all,
My Cacti has wrong downtime problem about Monitor Plugin, please see the attachment.
After tracing plugins/monitor/monitor.php, i found the downtime is calculated by monitor_print_host_downtime function with $row['status_fail_date'] arguments.
$row['status_fail_date'] is captured from host table in database,the default value is "0000-00-00 00:00:00". Then, i check the lib/functions.php, $row['status_fail_date'] is updated by update_host_status function.
this is code snippet of update_host_status function.
if ($status == HOST_DOWN) {
.....skip....
if ($hosts[$host_id]["status"] == HOST_UP) {
/* increment the event failure count */
$hosts[$host_id]["status_event_count"]++;
/* if it's time to issue an error message, indicate so */
if ($hosts[$host_id]["status_event_count"] >= $ping_failure_count) {
/* host is now down, flag it that way */
$hosts[$host_id]["status"] = HOST_DOWN;
$issue_log_message = true;
/* update the failure date only if the failure count is 1 */
if ($ping_failure_count == 1) {
$hosts[$host_id]["status_fail_date"] = date("Y-m-d H:i:s");
}
/* host is down, but not ready to issue log message */
} else {
/* host down for the first time, set event date */
if ($hosts[$host_id]["status_event_count"] == 1) {
$hosts[$host_id]["status_fail_date"] = date("Y-m-d H:i:s");
}
}
}
My problem is why $hosts[$host_id]["status_fail_date"] is only updated when $ping_failure_count equals to 1. Can i remove the if-else statement?
Sorry for my bad english
Thanks for any help!!!
Problem with monitor's downtime
Moderators: Developers, Moderators
Problem with monitor's downtime
- Attachments
-
- wrong downtime problem at monitor plugin
- pic.png (185.96 KiB) Viewed 16072 times
Re: Problem with monitor's downtime
I have the exact same problem, Did you fix it?
Re: Problem with monitor's downtime
Please someone help me tp solve this issue!
Re: Problem with monitor's downtime
Hi ajamali,
Following the bug issue(http://bugs.cacti.net/view.php?id=2257),
i add the two if statements by myself.
It's work on me for new alarm host:)
Following the bug issue(http://bugs.cacti.net/view.php?id=2257),
i add the two if statements by myself.
It's work on me for new alarm host:)
Re: Problem with monitor's downtime
Thank you very much it is working nowhisarack wrote:Hi ajamali,
Following the bug issue(http://bugs.cacti.net/view.php?id=2257),
i add the two if statements by myself.
It's work on me for new alarm host:)
Re: Problem with monitor's downtime
Hey, hisarack and ajamali...
The link of the bug issue is not available anymore. Someone can share this again. I'm with the same problem.
The link of the bug issue is not available anymore. Someone can share this again. I'm with the same problem.
Who is online
Users browsing this forum: No registered users and 4 guests