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

Support questions about the Threshold plugin

Moderators: Developers, Moderators

gsaray101
Cacti User
Posts: 233
Joined: Thu May 17, 2007 9:18 am

Re: used space as percentage

Post by gsaray101 »

I got this working but I have a little issue. When I receive the alerts, It does not say like 10%. Would it be possible to append % at the end of the number.

My current alert is as follows:

localhost - File System Capacity - /var [hdd_used] is still above threshold of 10 with 52.9116

I would like to see the alerts as:
localhost - File System Capacity - /var [hdd_used] is still above threshold of 10% with 52.9116
gab
Posts: 12
Joined: Tue Apr 22, 2008 9:55 am

Post by gab »

You should modified thold_functions.php in the plugins/thold directory.
It's the same function for all the threshold.
So, if an other threshold is in GHz or Go ... it's not a good idea to modify thold_functions.php
jjhans
Posts: 8
Joined: Thu Jan 03, 2008 10:40 am

Post by jjhans »

Here's a thought... these patches seem like a sort of awkward hack... What if the Threshold plugin was modified so that instead of defining a threshold on a data source, you defined it on a graph item? That way, anything that's already being graphed could trivially be thresholded, even if it's a result of a complex CDEF based on multiple data items.
redawg
Posts: 6
Joined: Sun Mar 30, 2008 10:58 pm

Post by redawg »

Check out my post, this work and fixes the percentage fight

http://forums.cacti.net/viewtopic.php?t=28156
jrego
Posts: 44
Joined: Mon Jul 14, 2008 9:55 am

Post by jrego »

OK can someone help me. I think i missed something. here is what i have done.

replaced the thold_functions.php with the one provided.
Then created a CDEF of

CURRENT_DATA_SOURCE,100,*,ALL_DATA_SOURCES_NODUPS,CURRENT_DATA_SOURCE,-,/

then i applied it to a windows server but i got the following output.
LynnBB - Used Space - C: Label: Seri [hdd_used] 95 n/a 1 0 on 53192925184 yes on
LynnBB - Used Space - E: Label:BBCont [hdd_used] 95 n/a 1 0 on 81900695552 yes on
jrego
Posts: 44
Joined: Mon Jul 14, 2008 9:55 am

Post by jrego »

isnt it supposed to do some sort of conversion?

please let me know.

thanks.
jrego
Posts: 44
Joined: Mon Jul 14, 2008 9:55 am

Post by jrego »

Can Somone Post the complete instructions in one posting step by step?

Its kindof confusing trying to figure it out..as well as posting the patch file or a new version of the thold_functions.php file.

Also when i go to create the CDEF i dont see an option for CURRENT_DATA_SOURCE. I only see ones for min and max.

Thanks for your help and patience
jadus
Posts: 10
Joined: Fri Aug 08, 2008 12:39 pm

Post by jadus »

Here's what I did for those looking for a walkthrough:

Download the appropriate patch or PHP file posted by Howie earlier in this thread, and apply/overwrite your current version.

In Cacti, under Graph Management, click CDEFs. Click Add at the top right to create a new one.

Enter the new name as Used/Total > Percentage

Now you want to add the CDEF items in the formula that was posted earlier. It should be like this:
1. Special Data Source/Current Graph Item Data Source
2. Custom String/100
3. Operator/ *
4. Special Data source/All Data sources (Don't include duplicates)
5. Special Data source/Current Graph Item Data Source
6. Operator/ -
7. Operator/ / (division symbol)

Now in your threshold template, under "other setting" you want to select that CDEF.

Those were the steps I followed and it is "mostly" working for me...see next post.
jadus
Posts: 10
Joined: Fri Aug 08, 2008 12:39 pm

Post by jadus »

I have used the steps posted above, but about twice a day something happens that causes the threshold to be triggered. For example, I just received an email that states the following:

"Server - Used Space - D: Label: Seri [hdd_used] went above threshold of 90 with 152.552"

I have no idea how the value could be 152%, so when I went to look at the threshold under the "Management" interface, it lists current value as 65.0899. However, looking at the thold tab, it displays the incorrect value of 152.552 flagged in red.

This occurs for multiple servers, but only on thresholds created from a template of the "Host MIB - Hard Drive Space".

Usually 5 minutes later there is an email saying the threshold has recovered. Does anyone know why this would happen?
gsaray101
Cacti User
Posts: 233
Joined: Thu May 17, 2007 9:18 am

false positive alarm

Post by gsaray101 »

Yes I see this problem to on my side. After looking at it little closer, I discovered that sometimes, hdd_total is not poll, thus hdd_used become greater than hdd_total and this results in a number greater than 100.

In order to get around it, I created another cdef function to toss out numbers greater than 100, but according to some people in this form, threshold only supports *,+,- and / so my cdef is inaccurate. In order to fix it, threshold needs to include all of the cdef functionality. Can anybody help out with that?

my cdef function is:

Special Data Source: CURRENT_DATA_SOURCE
Custom String: 100
Operator: *
Special Data Source: ALL_DATA_SOURCES_NODUPS
Special Data Source: CURRENT_DATA_SOURCE
Operator: -
Operator: /
Custom String: 100
Function: GT
Function: UNKN
Special Data Source: CURRENT_DATA_SOURCE
Custom String: 100
Operator: *
Special Data Source: ALL_DATA_SOURCES_NODUPS
Special Data Source: CURRENT_DATA_SOURCE
Operator: -
Operator: /
Function: IF
juge
Posts: 4
Joined: Tue Aug 12, 2008 3:07 am

Post by juge »

Hello, I have been able to follow Howie's advices and patch. It is almost working, but I have a singuliar problem:
1- percentage is shown when accessing thold configuration page for the ds
2- for the main thold page, only -100 are shown, I am very amazed

I tried to debug, and understand why, and locate the differences, but I lack something.

my version of cacti (0.8.7b-2.1) is the last, debian style, I patched manually with PA (2.1), is the last, (patched ok, but had to do it with my bare hands all alone old fashion style), and last version of thold (0.3.9). As anyone an idea where I can look in the code for an answer ? >_<
Attachments
threshold2.JPG
threshold2.JPG (137.98 KiB) Viewed 7206 times
threshold1.JPG
threshold1.JPG (4.47 KiB) Viewed 7206 times
juge
Posts: 4
Joined: Tue Aug 12, 2008 3:07 am

Post by juge »

I have been able to identify the problem, the ALL_DATA_SOURCES_NODUPS variable is ok only on the configuration page of the threshold, not when updating the mysql database (in my case).

I tried Redawg patch, adding a hdd_percent variable in the rrd, and this is ok now. thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests