Thold precentage limits patch

Support questions about the Threshold plugin

Moderators: Developers, Moderators

User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Thold precentage limits patch

Post by johnrembo »

hello verybody,

thold_prec_eval.diff allows to set precentage tresholds
(for example instead of digit value in upper limit field in thold template you can now enter 90%). Percent values are counted considering graph scale.
patch must be applied to check-thold.php.

thold_autocreate.diff must be applied to host.php - it allows to create tresholds for all currently listed devices. In device section below "Add" new operation will apear - "Treshold listed devices".

both patches tested and working
Attachments
thold_prec_eval.diff.txt
(1.73 KiB) Downloaded 471 times
thold_autocreate.diff.txt
(1.55 KiB) Downloaded 535 times
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Let Cigamit know about this.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Only issue I have is that it has to modify /host.php parmamently for the thold plugin. The best way of doing this, is to instead modify host.php via the "Plugin Architecture" to add a hook to add columns to the table. This way it is seperate from Thold, and any plugin could do the same thing.
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

ok, i'll try to avoid this in future...
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

I will let you know when I get the time to add the new hook the plugin architecture. At that time, I will also add this to the thold plugin.

I've been fairly busy lately, so don't expect it very quickly. I need to finish up the Event Manager code I have been workin on first.
wd
Posts: 9
Joined: Fri May 12, 2006 8:35 pm

Post by wd »

Didn't work...
Cacti treated 90% as 90....
darkstar
Posts: 1
Joined: Tue Mar 07, 2006 3:28 am

Post by darkstar »

Hi,

which version of cacti/thold is the patch created against?

I've tried the patches, but it seems the percentage hi/low thold values "rounded" and stored without the '%' char before inserted in DB (thold-functions.php) during the threshold creation.

I am testing using cacti 0.8.6h and thold 0.2.9

Regards.
User avatar
benzopila
Posts: 14
Joined: Thu Aug 03, 2006 6:51 am
Location: Ukraine, Kiev
Contact:

Post by benzopila »

cigamit wrote:I will let you know when I get the time to add the new hook the plugin architecture. At that time, I will also add this to the thold plugin.

I've been fairly busy lately, so don't expect it very quickly. I need to finish up the Event Manager code I have been workin on first.
Have you working whith this?
Is this feature in 0.3 THold plugin?

Thanks
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

I also tried this patch and it didn't work for me. :(

My config :
Cacti on FreeBSD
Poller : cactid
Thold 3.0
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

excuse

Post by johnrembo »

I'm sorry i have left this patch unsupported for half a year (had been working on master's diploma).
I'll try to debug the problems you've reported and will let you know immediately...
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

Ok johnrembo, thanks.
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

Ok, here's the problem:
from thold 0.2.8 release input values are rounded up to four decimal places:

Code: Select all

$sql .= ", " . (trim($_POST["thold_hi"]) == "" ? "NULL" : ("'" . round($_POST["thold_hi"],4) . "'"));
$sql .= ", " . (trim($_POST["thold_low"]) == "" ? "NULL" : ("'" . round($_POST["thold_low"],4) . "'"));
this operation removes % sign which you do enter. in order precentage evaluation to work properly, this restriction has to be removed in all instances of thold-functions.php:

Code: Select all

$sql .= ", " . (trim($_POST["thold_hi"]) == "" ? "NULL" : ("'" . $_POST["thold_hi"] . "'"));
$sql .= ", " . (trim($_POST["thold_low"]) == "" ? "NULL" : ("'" . $_POST["thold_low"] . "'"));
similar problem exists in thold_templates.php where input values are checked against their numeric values.

download an attached patch and follow instructions.txt

if you fail to use precentage evaluation anyway - try to run check-thold.php manualy
# php check-thold.php
and post output here.

ps: thold_autocreate.diff.txt is not included in this patch
ps2: i'm encountering a notice in devices section "undefined index: hosts_status", but this doesn't seems to prevent Treshold listed devices Create function
Attachments
thold_prec_eval.tar.gz
updated version. tested on cacti 0.8.6h + thold 0.3.0
updated verbose output
(14.05 KiB) Downloaded 401 times
Last edited by johnrembo on Thu Aug 31, 2006 2:43 am, edited 1 time in total.
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

Hi johnrembo,

I cannot apply percentages to threshold templates but only when editing thresholds which are in the management category... Is it normal ?
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

no it isn't...
i've updated my previous post (in order not to confuse people). download the patch once again and try. In your case apply only thold_templates.diff.

I'm doing four programming tasks parallely :o , so sorry for mistakes - I totally have no time for detailed debugging and appreciate your help.
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

Yeah good work, I really appreciate johnrembo. Thanks you very much ! :D
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests