Page 1 of 1

Issues with Grap Explorer since R2.0

Posted: Wed Nov 12, 2014 8:07 am
by WillemDH
Hello,

First of all, thank you for the patch. nice work, again! :D I installed R2.0 on my Nagios XI QA server. Tested some functionalities and it seems there is something wrong with the 'last 4 hours' timeperiod option in the Graph Explorer.
1) It is not displaying the last 4 hours
2) The time in the graph is all around 1 january..

Last 24 hours etc still seem correct.

Check screenshot.

Grtz

Willem

Re: Issues with Grap Explorer since R2.0

Posted: Wed Nov 12, 2014 12:22 pm
by slansing
Just confirmed this, as did a few others in-house, reporting it right internally right now, thanks!

For the time being, you could pop the graphs out to 24 hours to get the correct, current time. This is only affecting the last 4 hours period.

Internal task_id=4435

Re: Issues with Grap Explorer since R2.0

Posted: Wed Nov 12, 2014 12:46 pm
by jomann
We've fixed this for the next release. It looks like all timeframes work except the 4 hour timeframe. To fix this now, you can make an edit to a file.

The file to edit is: /usr/local/nagiosxi/html/includes/components/graphexplorer/visFunctions.php

Line 106 (ish) should look like:

Code: Select all

if ($start == '-24h') {
Replace it with:

Code: Select all

if ($start == '-4h') {
        return (time() - 4*60*60);
    } else if ($start == '-24h') {

Re: Issues with Grap Explorer since R2.0

Posted: Wed Nov 12, 2014 5:42 pm
by jwelch
Shouldn't the following line also be changed from 2*24*60*60 to 24*60*60?

FROM:
// Then check for start time...
if ($start == '-24h') {
return (time() - 24*60*60);
} else if ($start == '-48h') {
return (time() - 2*24*60*60);


TO:
// Then check for start time...
if ($start == '-4h') {
return (time() - 4*60*60);
} else if ($start == '-24h') {
return (time() - 24*60*60);

Re: Issues with Grap Explorer since R2.0

Posted: Thu Nov 13, 2014 12:30 pm
by cmerchant
The code should look like this after the patch: (with numbers on), the -48h indicates last two days.

Code: Select all

    105     // Then check for start time...
    106     if ($start == '-4h') {
    107         return (time() - 4*60*60);
    108     } else if ($start == '-24h') {
    109         return (time() - 24*60*60);
    110     } else if ($start == '-48h') {
    111         return (time() - 2*24*60*60);

Re: Issues with Grap Explorer since R2.0

Posted: Fri Nov 14, 2014 3:49 pm
by WillemDH
Guessing we are talking about visFunctions.inc.php not visFunctions.php?

Code: Select all

drwxr-x---   7 nagios nagios  4096 Jan 29  2014 .
drwxr-x---. 62 nagios nagios  4096 Sep 10 11:35 ..
drwxr-x---   2 nagios nagios  4096 Jan 27  2014 ajax
-rw-r-----   1 nagios nagios  2994 Oct  9 11:50 CHANGELOG.txt
-rw-r-----   1 nagios nagios  1345 Oct  9 11:50 dashifygraph.php
-rw-r-----   1 nagios nagios  2303 Oct  9 11:50 dashlet.inc.php
-rw-r-----   1 nagios nagios  2054 Jan 27  2014 dashlet.inc.php.backup
-rw-r-----   1 nagios nagios  3155 Oct  9 11:50 fetch_rrd.php
-rwxr-x---   1 nagios nagios  1219 Jun 18  2013 graphexplorerinclude.js
-rw-r-----   1 nagios nagios  6158 Oct  9 11:50 graphexplorer.inc.php
-rw-r-----   1 nagios nagios 14127 Oct  9 11:50 graphexplorer.js
drwxr-x---   3 nagios nagios  4096 Jan 27  2014 images
drwxr-x---   2 nagios nagios  4096 Jan 27  2014 includes
-rw-r-----   1 nagios nagios 15528 Oct  9 11:50 index.php
-rw-r-----   1 nagios nagios   474 Jun 18  2013 lists.php
-rw-r-----   1 nagios nagios  1875 Oct  9 11:50 sanity.sh
drwxr-x---   6 nagios nagios  4096 Aug 22  2012 .svn
drwxr-x---   3 nagios nagios  4096 Jul 30 14:13 templates
-rw-r-----   1 nagios nagios   947 Oct  9 11:50 visApi.php
-rw-r-----   1 nagios nagios 25554 Oct  9 11:50 visFunctions.inc.php
So I changed it to

Code: Select all

    // Then check for start time...
    if ($start == '-4h') {
        return (time() - 4*60*60);
    } else if ($start == '-24h') {
        return (time() - 24*60*60);
    } else if ($start == '-48h') {
        return (time() - 2*24*60*60);
    } else if ($start == '-1w') {
        return strtotime("-7 days");
    } else if ($start == '-1m') {
        return strtotime("-1 month");
    } else if ($start == '-1y') {
        return strtotime("-1 year");
    }
And it seems my performance grapher stopped working.

So I tried to start it, but couldn't do it with the gui, so I did service npcd start and was able to start it..

The last 4 hour option in the graph explorer does seem to work now.

Thanks and grtz

Willem

Re: Issues with Grap Explorer since R2.0

Posted: Mon Nov 17, 2014 10:22 am
by slansing
Excellent, thank you for providing us with an update!