[FIX] Monitor plugin 12 hours off

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

[FIX] Monitor plugin 12 hours off

Post by warnesj »

Hi all, I have a potential fix for anyone experiencing the Monitor page showing the downtime of their hosts out by 12 hours.

SYMPTOM
When a host is down the Monitor page reported the wrong duration of the downtime of the host. The reported time was out by 12 hours if the host had gone down in the afternoon.

PROBLEM
The problem has to do with the ./lib/functions.php script. When a host goes down the status_fail_date value in the host table of the database is set to the current date and time, but for some reason the time that is stored is in 12 hour format instead of 24 hour format. This causes a calculation problem with monitor.php script.

FIX
Modify your ./lib/functions.php script and change all occurrences of $hosts[$host_id]["status_fail_date"] = date("Y-m-d h:i:s"); to $hosts[$host_id]["status_fail_date"] = date("Y-m-d H:i:s");.

I hope this helps. I've also added my functions.php file that has the above mentioned fix.
Attachments
functions_24hour_0.8.7.zip
functions.php file with status_fail_date modified to be stored in 24 hour format. >>>For Cacti 0.8.7<<<
(15.46 KiB) Downloaded 217 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest