Wrong "Host Previously DOWN for"

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
fmoreira86
Posts: 6
Joined: Mon Jul 28, 2014 10:20 am

Wrong "Host Previously DOWN for"

Post by fmoreira86 »

Hi good people!

Don't know if this is the best place to ask this.

I'm monitoring some hosts and when some of them goes down I receive a message with the info and in the field "Host Previously DOWN for" I get a completly wrong value like 7234234234234234234 days.

Does anyone know how to fix this?

Thanks and merry xmas!
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Wrong "Host Previously DOWN for"

Post by BSOD2600 »

Cacti and MySQL version?
aerialistic
Posts: 2
Joined: Thu Feb 05, 2015 6:39 am

Re: Wrong "Host Previously DOWN for"

Post by aerialistic »

Hello.

Excuse me for bringing up this old topic again, but in my search for a solution I've found this unresolved question. Now I'm having the exact same problem, I've installed Cacti 0.8.8b with MySQL 14.14 and thold 0.5 plugin and while everything is working fine, I'm receiving host notification with incorrect last dates:

Last Date Checked UP: 0000-00-00 00:00:00 Host Previously DOWN for: 736031d 12h 59m 51s
or
Last Date Checked DOWN : 0000-00-00 00:00:00 Host Previously UP for: 736031d 12h 44m 52s

I've spent some time trying to figure out where the problem is, but now it seems I'm stuck and I'll appreciate any help.

Thanks!
aerialistic
Posts: 2
Joined: Thu Feb 05, 2015 6:39 am

Re: Wrong "Host Previously DOWN for"

Post by aerialistic »

Nevermind, I've found a fix:

http://bugs.cacti.net/view.php?id=2257

Cheers! :D
dimancs
Posts: 2
Joined: Sat Jul 23, 2016 6:26 am

Re: Wrong "Host Previously DOWN for"

Post by dimancs »

Hello all,

Exactly in which place it's necessary to add a:

Code: Select all

if ($hosts[$host_id]["status_fail_date"] == ""){
$hosts[$host_id]["status_fail_date"] = '0000-00-00 00:00:00';}
if ($hosts[$host_id]["status_rec_date"] == ""){
$hosts[$host_id]["status_rec_date"] = '0000-00-00 00:00:00';}
I try to put this under:

Code: Select all

$hosts[$host_id]["status_fail_date"] = '0000-00-00 00:00:00';
$hosts[$host_id]["status_rec_date"] = '0000-00-00 00:00:00';
However it doesn't work for me at all, i show monitor message with strange values:
Last Date Checked UP: 0000-00-00 00:00:00
Host Previously DOWN for: 736565d 11h 12m 28s
dimancs
Posts: 2
Joined: Sat Jul 23, 2016 6:26 am

Re: Wrong "Host Previously DOWN for"

Post by dimancs »

Hello all,

Finally to solve this problem i let a code in state below in file /usr/share/cacti/lib/functions.php. I use "$: locate functions.php" to lacte this files, because a location can be different.
function update_host_status($status, $host_id, &$hosts, &$ping, $ping_availability, $print_data_to_stdout) {
$issue_log_message = false;
$ping_failure_count = read_config_option("ping_failure_count");
$ping_recovery_count = read_config_option("ping_recovery_count");
/*$hosts[$host_id]["status_fail_date"] = '0000-00-00 00:00:00';*/
/*$hosts[$host_id]["status_rec_date"] = '0000-00-00 00:00:00';*/
if ($hosts[$host_id]["status_fail_date"] == ""){
$hosts[$host_id]["status_fail_date"] = '0000-00-00 00:00:00';}
if ($hosts[$host_id]["status_rec_date"] == ""){
$hosts[$host_id]["status_rec_date"] = '0000-00-00 00:00:00';}
......
.....
...
Now a last fail seems good from a monitor cacti web page and also when i receive a notification by email is also seems good.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests