Threshold with CDEF'd graphs, i.e. Disk space by percentage

Support questions about the Threshold plugin

Moderators: Developers, Moderators

new
Posts: 23
Joined: Mon Dec 10, 2007 10:37 am

Post by new »

Howie wrote:
new wrote: No, it is not an interface traffic, some dhcp server gives IP adresses from the poll, I need to have threshold of percentage of given from the total.

This is from the rrdtool graph
DEF:a="/opt/lampp/htdocs/cacti/rra/fbsr64k01_total_22994.rrd":total:AVERAGE \
DEF:b="/opt/lampp/htdocs/cacti/rra/fbsr64k01_total_22994.rrd":used:AVERAGE \
CDEF:cdeff=b,a,/,100,* \

I need to have a threshold when CDEF reaches for example 75 %.
OK, I see. Then yes, the same formula should work. What do you actually see? an error? 0? something else?
The current values is either = 0 (when I use ALL_DATA_SOURCES_NODUPS in CDEF) or the threshold are reached for all the devices (when I use SIMILAR_DATA_SOURCES_NODUPS), independent on the value. I tried to apply the CDEF to the hdd DS and the situation is the same, so this is a general problem.

What should I change in the thold-functions? In the topic there are several patches, I tried to apply the last one that you included, it does not work, maybe because I have a linux OS, therefore I would like to include the necessary changes in the original thold-functions file.
new
Posts: 23
Joined: Mon Dec 10, 2007 10:37 am

Post by new »

Howie wrote:
new wrote: No, it is not an interface traffic, some dhcp server gives IP adresses from the poll, I need to have threshold of percentage of given from the total.

This is from the rrdtool graph
DEF:a="/opt/lampp/htdocs/cacti/rra/fbsr64k01_total_22994.rrd":total:AVERAGE \
DEF:b="/opt/lampp/htdocs/cacti/rra/fbsr64k01_total_22994.rrd":used:AVERAGE \
CDEF:cdeff=b,a,/,100,* \

I need to have a threshold when CDEF reaches for example 75 %.
OK, I see. Then yes, the same formula should work. What do you actually see? an error? 0? something else?
Howie, I found your patch it other forum:
http://cactiusers.org/forums/topic1305.html

applied it and it works! Great! Thanks a lot!
peecee
Cacti User
Posts: 146
Joined: Tue Feb 26, 2008 7:26 am

Post by peecee »

I made the modifications to thold_functions.php and created a new cdef for Percentage. The modification is working fine, I'm getting alerts, but I'm also getting a message in my cacti log for every alert:

Code: Select all

03/05/2008 06:06:14 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
Obviously something is wrong, but I'm not exactly sure where to fix it.
cwahlin
Cacti User
Posts: 91
Joined: Fri Oct 10, 2003 7:23 am

Post by cwahlin »

I am getting an error trying to patch thold-functions.php:

[root@cacti thold]# patch thold-functions.php hj.thold_functions.rpn.all_data_sources.patch
patching file thold-functions.php
Hunk #1 FAILED at 298.
patch: **** `<' expected at line 66 of patch

Is this patch for the newer version of thold only? I am still using 0.3.2

Carl
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

cwahlin wrote:I am getting an error trying to patch thold-functions.php:

[root@cacti thold]# patch thold-functions.php hj.thold_functions.rpn.all_data_sources.patch
patching file thold-functions.php
Hunk #1 FAILED at 298.
patch: **** `<' expected at line 66 of patch

Is this patch for the newer version of thold only? I am still using 0.3.2

Carl
Yes, it's for the latest version (0.3.9).
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
peecee
Cacti User
Posts: 146
Joined: Tue Feb 26, 2008 7:26 am

Post by peecee »

Howie,

I have been using this mod for the last few days and it seems to be working great. For an enhancement, is there a way to display the percentage in the thold tab, rather than the hdd_free (or used) instead? Obviously, right now the "Current" number being displayed is the actual number, not the percentage. If you alert on a percentage, it would be nice to display the percentage the metric is at, not the actual number.

Nice simple mod for something so useful!
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

peecee wrote:Howie,

I have been using this mod for the last few days and it seems to be working great. For an enhancement, is there a way to display the percentage in the thold tab, rather than the hdd_free (or used) instead? Obviously, right now the "Current" number being displayed is the actual number, not the percentage. If you alert on a percentage, it would be nice to display the percentage the metric is at, not the actual number.

Nice simple mod for something so useful!
I see what you mean. It wouldn't be too hard to store the 'post-CDEF' value somewhere...
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
cwahlin
Cacti User
Posts: 91
Joined: Fri Oct 10, 2003 7:23 am

Post by cwahlin »

Howie wrote:
cwahlin wrote:I am getting an error trying to patch thold-functions.php:

[root@cacti thold]# patch thold-functions.php hj.thold_functions.rpn.all_data_sources.patch
patching file thold-functions.php
Hunk #1 FAILED at 298.
patch: **** `<' expected at line 66 of patch

Is this patch for the newer version of thold only? I am still using 0.3.2

Carl
Yes, it's for the latest version (0.3.9).
I just upgraded our installation to 0.8.7b, get the new thold (and settings) and tried to run the patch again. Even downloaded the patch again to make sure... Exact same problem!!

[root@cacti thold]# patch thold_functions.php hjthold_functionsrpnall_data_sources_830.patch
(Stripping trailing CRs from patch.)
patching file thold_functions.php
Hunk #1 FAILED at 298.
patch: **** `<' expected at line 66 of patch

I don't know if it's funny, or just sad. I feel kind of stupid though as it is most likely something I did...

/Carl
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

cwahlin wrote: I don't know if it's funny, or just sad. I feel kind of stupid though as it is most likely something I did...

/Carl
It probably is something you did, but you can just sidestep the whole thing by downloading the .txt file that's prepatched, a few posts further on. Rename it to .php, and you're done.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Howie wrote: I see what you mean. It wouldn't be too hard to store the 'post-CDEF' value somewhere...
Actually, mine already *does* show the percentage. It doesn't have a percentage sign after it, but it is the percentage and not the raw value. I don't think it's something I changed either.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
peecee
Cacti User
Posts: 146
Joined: Tue Feb 26, 2008 7:26 am

Post by peecee »

Howie wrote:Actually, mine already *does* show the percentage. It doesn't have a percentage sign after it, but it is the percentage and not the raw value. I don't think it's something I changed either.
Huh, in looking closer, mine does too. I thought the period was a comma. I just don't need five digits of percentage points. One would be fine...
cwahlin
Cacti User
Posts: 91
Joined: Fri Oct 10, 2003 7:23 am

Post by cwahlin »

Howie wrote:
cwahlin wrote: I don't know if it's funny, or just sad. I feel kind of stupid though as it is most likely something I did...

/Carl
It probably is something you did, but you can just sidestep the whole thing by downloading the .txt file that's prepatched, a few posts further on. Rename it to .php, and you're done.
That worked. Now I just have to make the CDEF work :)

Edit: Howie, your CDEF doesn't work for me. I am getting -100. My CDEF looks like yours:
cdef=CURRENT_DATA_SOURCE,100,*,ALL_DATA_SOURCES_NODUPS,CURRENT_DATA_SOURCE,-,/

And, I am trying to use this on the SNMP based hdd_used that comes with cacti.

I don't think it likes ALL_DATA_SOURCES_NODUPS. This value does not exist for me. When I do ALL_DATA_SOURCES_NODUPS - CURRENT_DATA_SOURCE I just get a negative value of the current used disk.

/Carl
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Setting up Threshold Baby steps

Post by lerwin »

This seems to be going the direction I need, however a lack of knowledge on my side is preventing me to grasp all this. I have installed the patch to thold_functions.php. I have added CDEF as Howie stated. I still can't get multiple different HDD sizes on the same machine to show different High Thresholds. The CDEF I created does not show up on the Threshold Template I try to create. I am new to CACTI and RRD.

Cacti System:
Ubuntu 7.10
MySQL 5
PHP5
Cacti (latest and greatest)
PA (same)
Settings (same)
Thold (same)

Could someone just quickly do a step by step on what to do? People are referencing other posts, and I guess I am missing something. Cacti does 80% of what I need, the last part would be notifications and Thold has the possibility to do this.

Thank y'all for all your hard work.
Loren Erwin
namiradaki
Posts: 10
Joined: Thu Jan 04, 2007 7:21 pm

cdef problem

Post by namiradaki »

Hi Guys,

Please help im so close!

Running latest version of everything.

When creating the cdef im not able to select it in the Threshold Template.

Fair enough.

So i updated my thold_functions.php under plugins\thold with an updated one... Still no joy.

Also im not able to use the patch because im running under windows, however this should not matter as the patch basically does what over writing the thold_functions.php does.

Any assistance would be appreciated.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: cdef problem

Post by Howie »

namiradaki wrote:Hi Guys,

Please help im so close!

Running latest version of everything.

When creating the cdef im not able to select it in the Threshold Template.

Fair enough.

So i updated my thold_functions.php under plugins\thold with an updated one... Still no joy.

Also im not able to use the patch because im running under windows, however this should not matter as the patch basically does what over writing the thold_functions.php does.

Any assistance would be appreciated.
What does the CDEF look like? There are restrictions on which CDEFs Thold can use (from memory, I think it must contain CURRENT_DATA_SOURCE, and possibly not contain certain other things).
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest