Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Threshold with CDEF'd graphs, i.e. Disk space by percentage
Goto page 1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Threshold)
Author Message
benhanson



Joined: 08 Feb 2005
Posts: 29

PostPosted: Tue Mar 22, 2005 2:47 pm    Post subject: Threshold with CDEF'd graphs, i.e. Disk space by percentage Reply with quote

Would there be any way to have the threshold module alert on a CDEF value? I've just figured out how to graph my drive space based on percentage rather than bytes free, only to realize that now I can't alert on the percent value since it is not an actual data source in the RRD. If you could do this, you would gain all of the flexibility of CDEF's in alerting as well.

Example:

Disk bytes free has 2 Data Sources: hdd_total and hdd_used
I can set a threshold on these. I've changed my graphs by adding a new graph item with no source, but a CDEF - a,b,/,100,*
Back to top
ABX
Cacti User


Joined: 01 Mar 2007
Posts: 61

PostPosted: Mon Nov 12, 2007 8:38 am    Post subject: Reply with quote

I'd like to see this too.

Cacti 0.8.7
Back to top
ejensen
Cacti User


Joined: 12 Jul 2004
Posts: 55

PostPosted: Mon Nov 12, 2007 9:15 am    Post subject: Reply with quote

can you share with us how to setup a CDEF to calculate the percentage?

an idea i have (forgive me if its stupid, i am kinda new to cacti)... could you just setup a new datasource that stores the percentage from the disk?
Back to top
benhanson



Joined: 08 Feb 2005
Posts: 29

PostPosted: Tue Nov 13, 2007 12:48 pm    Post subject: CDEF Reply with quote

The CDEF formula is there in my first message, a,b,/,100,*

I was never able to set a threshold on this, but I haven't tried in quite a few versions.
Back to top
looc
Cacti User


Joined: 13 Aug 2007
Posts: 110

PostPosted: Fri Nov 16, 2007 4:53 am    Post subject: Re: CDEF Reply with quote

benhanson wrote:
The CDEF formula is there in my first message, a,b,/,100,*

I was never able to set a threshold on this, but I haven't tried in quite a few versions.

how defined a&b?
and how calculate this formula?
a/b*100?!
Back to top
looc
Cacti User


Joined: 13 Aug 2007
Posts: 110

PostPosted: Fri Nov 16, 2007 5:09 am    Post subject: Reply with quote

you want to used these?
DEF:a="E\:/www/rra/localhost_hdd_used_9.rrd":hdd_total:AVERAGE \
DEF:b="E\:/www/rra/localhost_hdd_used_9.rrd":hdd_used:AVERAGE \
DEF:a&DEF:b?
custom string can define These two variables?
Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Tue Dec 04, 2007 4:59 pm    Post subject: Reply with quote

Here is a patch that will allow you to use the ALL_DATA_SOURCES_DUPS and ALL_DATA_SOURCES_NODUPS (they will perform the same since this is based on the data soruce and not the graph.

Example use:

Data source with mem_used and mem_free.
Create threshold on mem_used and use a CDEF of CURRENT_DATA_SOURCE,100,*,ALL_DATA_SOURCES_NODUPS,/ and you will get a percentage of mem_used.

There should only be a performance impact if this DS is used and it only pertains to an extra sql query.



thold-alldatasources.patch
 Description:

Download
 Filename:  thold-alldatasources.patch
 Filesize:  764 Bytes
 Downloaded:  283 Time(s)

Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Wed Dec 05, 2007 12:59 pm    Post subject: Reply with quote

Here is a better patch, will only perform one lookup of the data source. There is some problem I am having an odd problem with no data being returned from rrdtool_function_fetch on the hdd rrds.


thold-alldatasources-v2.patch
 Description:

Download
 Filename:  thold-alldatasources-v2.patch
 Filesize:  1.49 KB
 Downloaded:  333 Time(s)

Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2135
Location: United Kingdom

PostPosted: Tue Jan 29, 2008 1:58 pm    Post subject: Reply with quote

llow wrote:
Here is a better patch, will only perform one lookup of the data source. There is some problem I am having an odd problem with no data being returned from rrdtool_function_fetch on the hdd rrds.


llow, did you solve your hdd problem? I have just tried your patch, and I'm seeing an issue too. Unfortunately, hdd's are all I care about at the moment
Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Tue Jan 29, 2008 3:30 pm    Post subject: Reply with quote

It will only work "properly" if the rras used are updated at the same time. I have about 600 routers where I pull % of memory and have no issue. I use the UCD-SNMP mib for all my Linux servers and have no issue.

The only problem is when I use the HOST-MIB with a script server that returns hdd_free and hdd_used and since the script server is called multiple times there is a problem with having the hdd_free and hdd_used updated by the time the thold poll is taken. This is especially more difficult in my setup where my HDD data is polled at 5 minutes but my poller runs every minute. The two data sources may not even be polled in the same poller interval.

I haven't come up with a good idea to solve this yet as I would like to have the script server be able to handle data like data input methods can.

I think this is more of something that needs to be solved in the base code instead of directly within Threshold.
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2135
Location: United Kingdom

PostPosted: Sun Feb 03, 2008 12:05 pm    Post subject: Reply with quote

OK. I think I have this working now.

First of all, I'm using a different query than llow for the CDEF part - I don't really understand the one they used - $ds is a field name - when would it ever be in the id field? I skipped the changes to get_current_value(), but I would say that I was getting type-related errors from your patch, one of which I fixed with:
Code:

// NOT THIS ->   if (!is_array($ds)) $ds[0] = $ds;
       if (!is_array($ds)) {
         $ds_tmp = $ds;
         $ds = array();
         $ds[0] = $ds_tmp;
      }


I then ended up rewriting the RPN code in thold to actually do RPN properly with a stack, since my valid CDEF had two operators in a row, which threw off thold.

So here's a different patch against the original thold_functions.php, with improved RPN handling and ALL_DATA_SOURCES implemented.

I don't use 1 minute polling on this particular install, so I doubt anything has changed there.



hj.thold_functions.rpn.all_data_sources.patch
 Description:
patch for threshold to allow ALL_DATA_SOURCES in CDEFs, and to allow more CDEFs to work correctly..

Download
 Filename:  hj.thold_functions.rpn.all_data_sources.patch
 Filesize:  6.5 KB
 Downloaded:  263 Time(s)

Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Tue Feb 05, 2008 2:48 pm    Post subject: Reply with quote

I'll have to check out your ideas. Any chance you could post a patch in unified format as it is much easier to read changes
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2135
Location: United Kingdom

PostPosted: Tue Feb 05, 2008 5:40 pm    Post subject: Reply with quote

llow wrote:
I'll have to check out your ideas. Any chance you could post a patch in unified format as it is much easier to read changes


Sure here you go. It has a little more than it needs to have, because I cleaned up the indenting inside the case statement



hj.thold_functions.rpn.all_data_sources.unifiedpatch.txt
 Description:

Download
 Filename:  hj.thold_functions.rpn.all_data_sources.unifiedpatch.txt
 Filesize:  6.88 KB
 Downloaded:  302 Time(s)

Back to top
mcutting
Cacti Pro User


Joined: 16 Oct 2006
Posts: 974

PostPosted: Wed Feb 06, 2008 1:39 am    Post subject: Reply with quote

Howie - do you have a patched php file for us windows uers ?

Thanks
Back to top
cyrill
Cacti User


Joined: 25 Jan 2008
Posts: 268
Location: California - USA

PostPosted: Wed Feb 06, 2008 11:39 am    Post subject: Reply with quote

Hello !

I'm a newbie with cacti and my english is bad. Can you help me ? A new CDEF should be created ???

Can you explain me how can I created it and how it work ?

thanks for your help
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Threshold) All times are GMT - 5 Hours
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 



Powered by phpBB © 2001, 2005 phpBB Group