Thold precentage limits patch

Support questions about the Threshold plugin

Moderators: Developers, Moderators

wwolkers
Posts: 24
Joined: Thu Sep 14, 2006 6:44 am

Post by wwolkers »

Isn't it much easier to just create a CDEF for this?

put the max to 90 if you want 90%, and create a CDEF that calculated the percentage, no patching needed.
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

Hi wwolkers,

So can you explain me step by step how to make it work please ?

Thanks
wwolkers
Posts: 24
Joined: Thu Sep 14, 2006 6:44 am

Post by wwolkers »

apply my patch from http://forums.cacti.net/viewtopic.php?t=16054


then in the cacti interface click on graph management, then CDEFs

create a new CDEF, I called mine 'Diskspace percentrage'

add 5 items to this CDEF:

Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Special Data Source: CURRENT_GRAPH_MAXIMUM_VALUE
Item #3 Operator: /
Item #4 Custom String: 100
Item #5 Operator: *

Save it! (how many times I haven't forgotten this after editing a CDEF :( )

then apply this CDEF to a threshold to test, and if it works apply it to all that you want a percentage monitored from, and apply it to your threshold template.

Good luck.
Tekk
Posts: 34
Joined: Wed Aug 16, 2006 11:01 am
Location: France

Post by Tekk »

Thank you very much wwolkers ! It works fine for me ! :D
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

note to "thold precentage limit pach" users - with the release of cacti-0.8.6i you should change factor parameter in check-thold.php to 8 on line 126:

126: $factor=8
idle
Cacti User
Posts: 77
Joined: Wed May 26, 2004 10:49 am
Location: Barcelona
Contact:

Post by idle »

Hi, johnrembo.
That looks good, but after I applied all patches, thold continue calculate values as a numbers, not percentages.
So I get picture like in attachment.
What is the problem?
I use cacti 0.8.6h with thold 0.3.0.
Attachments
Untitled-1.png
Untitled-1.png (5.76 KiB) Viewed 4766 times
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

it is as it should be. precentage values are converted to digits only during pooling proccess(set $verbose=true in plugins/thold/check-thold.php and manualy run that file from command line - you will see how it works). i've not implemented those conversion functions anywhere else, because no-one requested for it ;]
idle
Cacti User
Posts: 77
Joined: Wed May 26, 2004 10:49 am
Location: Barcelona
Contact:

Post by idle »

johnrembo wrote:it is as it should be. precentage values are converted to digits only during pooling proccess(set $verbose=true in plugins/thold/check-thold.php and manualy run that file from command line - you will see how it works). i've not implemented those conversion functions anywhere else, because no-one requested for it ;]
I did manually run from command line(btw. there isn't variable $verbose, only $debug and $show), that what I'v seen:

Code: Select all

Checking Threshold : "host - Used Space - /var"
     Data Source : hdd_used went above threshold of 100% with 482560000
I don't see from this how comparison occur...
And those values are far from 100%.
Any ideas why is it being triggered?
tpang13
Posts: 12
Joined: Sun Feb 11, 2007 9:04 pm

Post by tpang13 »

hi wwolkers

i had try your method it successfully converted the data size into percentage, but the percentage always 100%, which means the

CURRENT_DATA_SOURCE = CURRENT_GRAPH_MAXIMUM_VALUE

so i remove the CDEF setting, then the thold data became data size again, it shows the used_size

is that mean, the CURRENT_GRAPH_MAXIMUM_VALUE cannot grap the graph value ?

please kindly advise

wwolkers wrote:apply my patch from http://forums.cacti.net/viewtopic.php?t=16054


then in the cacti interface click on graph management, then CDEFs

create a new CDEF, I called mine 'Diskspace percentrage'

add 5 items to this CDEF:

Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Special Data Source: CURRENT_GRAPH_MAXIMUM_VALUE
Item #3 Operator: /
Item #4 Custom String: 100
Item #5 Operator: *

Save it! (how many times I haven't forgotten this after editing a CDEF :( )

then apply this CDEF to a threshold to test, and if it works apply it to all that you want a percentage monitored from, and apply it to your threshold template.

Good luck.
Attachments
with CDEF
with CDEF
item1.jpg (24.2 KiB) Viewed 4594 times
without CDEF
without CDEF
item2.jpg (64.21 KiB) Viewed 4594 times
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

i think you've replied to wrong subject.
User avatar
johnrembo
Cacti User
Posts: 216
Joined: Mon Apr 24, 2006 3:33 am

Post by johnrembo »

you had to look in patched section, not in beginning of the file:

Code: Select all

//------------------------------------------------TPEP BEGIN-------------------------------------------//
if ((stristr($item["thold_hi"],"%") or stristr($item["thold_low"],"%"))==true) {
	$verbose=true;//info about percentage evaluation proccess (php check-thold.php)
check the code between "___TPEP BEGIN___" and "___TPEP END___". Shortly it does the following:

if upper_limit(80% for example) contains % sign, then it must be replaced with the following:

Code: Select all

80%->80*graph_template_upper_limit/100
idle wrote:
johnrembo wrote:it is as it should be. precentage values are converted to digits only during pooling proccess(set $verbose=true in plugins/thold/check-thold.php and manualy run that file from command line - you will see how it works). i've not implemented those conversion functions anywhere else, because no-one requested for it ;]
I did manually run from command line(btw. there isn't variable $verbose, only $debug and $show), that what I'v seen:

Code: Select all

Checking Threshold : "host - Used Space - /var"
     Data Source : hdd_used went above threshold of 100% with 482560000
I don't see from this how comparison occur...
And those values are far from 100%.
Any ideas why is it being triggered?
lucgomes
Posts: 8
Joined: Wed Apr 06, 2005 11:31 am

Problems THOLD and HPUX ( The values dont match)

Post by lucgomes »

Please, when i apply the CDEF "relative percentage" in my treshold i see one message error :
CDEF property not implemented yet: ALL_DATA_SOURCES_NODUPS,

And the values are long number like 1904673.67 and the value correct should be 95.04.

Howto resolve the problem ?


Thanks.
Attachments
error-THOLD.JPG
error-THOLD.JPG (99.44 KiB) Viewed 4473 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests