test status hanged on failed

The forum for help and support with FreeNATS as well as any useful hints and tips
Post Reply
philten
Posts: 9
Joined: Sat Apr 16, 2011 7:18 pm

test status hanged on failed

Post by philten » Thu Apr 21, 2011 3:12 pm

I would like to report what I think is an issue.

I tried a few "Custom Test Evaluators" settings. At one point I had two "Failure" rules.
The failed status started as expected in regards to my rules.

But, when I changed the rules, and even removed all rules, the "failed" status remain
active. As you can see there is a last value, so (if my understanding is
correct) the test should succeed ?

I tried to enable "Simple Evaluation", but I got this error msg:

Notice: Undefined index: nstestid in /var/www/nodeside.edit.php on line 72 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/freenats-1.12.2b/server/base/nats.db.inc.php on line 89 ULE{no.test}

This error cleared when I returned to the page.

Switching "Simple Evlvaluation" fixed the test status, and I could re-apply a custom Test evaluators,
after that.

update: it didn't work, the status switched back to Failed, as if my old rule was still there in the back.

If you have any suggestion to solve this, I would greatly appreciate. Thanks in advance.

Also, I have "Errors detected on page: Reported Ok" at the bottom of the page


I run version 1.12.2/b


Text copy of the Nodeside page:
----------------------------------------------------------------
Nodeside Test disk.used.perc.R on o3.seeclic.com
Test Type / UID : disk.used.perc.R
Description : Percent Disk Usage On R: (%)
Custom Name :
Test Alerts :
Recorded :
Simple Evaluation :
Last Checked : 13:54:56 21/04/2011 - 00:02:32 ago
Last Result : Failed
Last Value : 0,16
Abandon Changes

Custom Test Evaluators

Add New : =>

Phil Ten

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: test status hanged on failed

Post by dave » Thu Apr 21, 2011 8:22 pm

Hi Phil,

Ok I've traced the problem and it's the comma in the value. The PHP code fails when trying to deal with that value.

I'll have a look through and see if I can get PHP to parse , decimals (or failing that will just put a replace in the processing code).

The ULE bit means "Unknown Language Element" and is something that isn't in the language dictionary. You have setup to automatically report errors (thanks!) so it gets fed back. That is all the Errors Reported Ok at the bottom of the screen is.

I'll be putting a fix in place also to allow people with that on to see the content of the errors as well.

Will let you know how I get on.

Regards,

Dave.

philten
Posts: 9
Joined: Sat Apr 16, 2011 7:18 pm

Re: test status hanged on failed

Post by philten » Fri Apr 22, 2011 2:13 pm

Thank you for your very quick reply. I am glad you could understand the problem :)

I will make sure not to use commas for decimal values. Actually, I used a comma
because the "last value" reported above in the same page was displayed with a comma.

For now, would you have a suggestion for me to "unhang" this test ?
I guess a SQL query should do it, but since I am not familiar with
the db structures, I have no idea.

Again, thanks a lot for your help.

Phil

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: test status hanged on failed

Post by dave » Fri Apr 22, 2011 2:46 pm

Hi,

Yes the last value is coming in with a comma - I'm guessing the Windows machine the node script runs on is set to use commas as a decimal seperator.

I'll be having a look through the code to fix the evalulation and also the graphs which will break with comma-decimals.

I'm not sure what's causing the error for simple evaluation not being turned on; if that is on then it should fix it.

Otherwise I can give you the SQL if you can just tell me the nstestid (it's in the URL at the end when you select the test to edit the settings for the first time).

Or (and this will actually fix your problem for the moment until I sort it out properly):

Edit the file server/base/eval.inc.php
Insert a newline after line 25 (the first global $NATS) as follows:

Code: Select all

$value=str_replace(",",".",$value);
So the file from line 23 will now read:

Code: Select all

function nats_eval($testid,$value)
{
global $NATS;
$value=str_replace(",",".",$value);
if (!is_numeric($value)) return 2; // fails if not numeric!
..... and so on ....
This should change your commas to full-stops and thus allow eval to work.

Graphs will still not and that will take some time to consider the best place to provide a global fix to the issue.

HTH,

Dave.

philten
Posts: 9
Joined: Sat Apr 16, 2011 7:18 pm

Re: test status hanged on failed

Post by philten » Fri Apr 22, 2011 3:25 pm

Thanks again for your reply and help.

Thanks to your suggestion, I think I could solve the problem for now.
I just added in the windows node script (in function addtest() ) the code
to replace "," by ".", this way the server script doesn't receive commas
and everything seem to work fine, including the graph.

I am a happy FreeNATS user :)

Phil

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: test status hanged on failed

Post by dave » Fri Apr 22, 2011 3:36 pm

Hi Phil,

Sure that would work as well of course.

I think I'll put something in to sanitise all input as a proper fix rather than relying on the node script to send decimal-pointed numbers.

Cheers,

Dave.

Post Reply