Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu May 25, 2017 1:44 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with monitor's downtime
PostPosted: Thu May 22, 2014 5:49 am 
Offline

Joined: Thu May 22, 2014 4:36 am
Posts: 3
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:
File comment: wrong downtime problem at monitor plugin
pic.png
pic.png [ 185.96 KiB | Viewed 3200 times ]
Top
 Profile  
 
 Post subject: Re: Problem with monitor's downtime
PostPosted: Sun Jun 15, 2014 7:09 am 
Offline

Joined: Thu Feb 14, 2013 10:46 am
Posts: 4
I have the exact same problem, Did you fix it?


Top
 Profile  
 
 Post subject: Re: Problem with monitor's downtime
PostPosted: Fri Jun 20, 2014 4:52 am 
Offline

Joined: Thu Feb 14, 2013 10:46 am
Posts: 4
Please someone help me tp solve this issue!


Top
 Profile  
 
 Post subject: Re: Problem with monitor's downtime
PostPosted: Wed Aug 27, 2014 2:05 am 
Offline

Joined: Thu May 22, 2014 4:36 am
Posts: 3
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:)


Top
 Profile  
 
 Post subject: Re: Problem with monitor's downtime
PostPosted: Wed Aug 27, 2014 5:56 am 
Offline

Joined: Thu Feb 14, 2013 10:46 am
Posts: 4
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group