Problem with monitor's downtime

Support for the Plugin Architecture

Moderators: Moderators, Developers

Post Reply
Author
Message
hisarack
Posts: 3
Joined: Thu May 22, 2014 4:36 am

Problem with monitor's downtime

#1 Post by hisarack » Thu May 22, 2014 5:49 am

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!!! :D
Attachments
pic.png
wrong downtime problem at monitor plugin
pic.png (185.96 KiB) Viewed 4945 times

ajamali
Posts: 4
Joined: Thu Feb 14, 2013 10:46 am

Re: Problem with monitor's downtime

#2 Post by ajamali » Sun Jun 15, 2014 7:09 am

I have the exact same problem, Did you fix it?

ajamali
Posts: 4
Joined: Thu Feb 14, 2013 10:46 am

Re: Problem with monitor's downtime

#3 Post by ajamali » Fri Jun 20, 2014 4:52 am

Please someone help me tp solve this issue!

hisarack
Posts: 3
Joined: Thu May 22, 2014 4:36 am

Re: Problem with monitor's downtime

#4 Post by hisarack » Wed Aug 27, 2014 2:05 am

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:)

ajamali
Posts: 4
Joined: Thu Feb 14, 2013 10:46 am

Re: Problem with monitor's downtime

#5 Post by ajamali » Wed Aug 27, 2014 5:56 am

hisarack 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:)
Thank you very much it is working now

raubach
Posts: 1
Joined: Thu Jun 29, 2017 12:12 pm

Re: Problem with monitor's downtime

#6 Post by raubach » Thu Jun 29, 2017 12:16 pm

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. :(

Post Reply