Threshold with CDEF'd graphs, i.e. Disk space by percentage
Moderators: Developers, Moderators
Threshold with CDEF'd graphs, i.e. Disk space by percentage
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,*
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,*
Re: CDEF
how defined a&b?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.
and how calculate this formula?
a/b*100?!
Cacti Version - 0.8.7 & spine
Plugin Architecture - 1.3
Server Info - Windows 2003 EP
Web Server -IIS6.0
PHP - 5.2.3
MySQL - 4.1.10
RRDTool - 1.2.15
SNMP - 5.4.1
--------------------------
plugins:
reportit 0.5.1|monitor 0.8.1|thold 0.3.8
Plugin Architecture - 1.3
Server Info - Windows 2003 EP
Web Server -IIS6.0
PHP - 5.2.3
MySQL - 4.1.10
RRDTool - 1.2.15
SNMP - 5.4.1
--------------------------
plugins:
reportit 0.5.1|monitor 0.8.1|thold 0.3.8
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?
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?
Cacti Version - 0.8.7 & spine
Plugin Architecture - 1.3
Server Info - Windows 2003 EP
Web Server -IIS6.0
PHP - 5.2.3
MySQL - 4.1.10
RRDTool - 1.2.15
SNMP - 5.4.1
--------------------------
plugins:
reportit 0.5.1|monitor 0.8.1|thold 0.3.8
Plugin Architecture - 1.3
Server Info - Windows 2003 EP
Web Server -IIS6.0
PHP - 5.2.3
MySQL - 4.1.10
RRDTool - 1.2.15
SNMP - 5.4.1
--------------------------
plugins:
reportit 0.5.1|monitor 0.8.1|thold 0.3.8
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.
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.
- Attachments
-
- thold-alldatasources.patch
- (764 Bytes) Downloaded 644 times
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.
- Attachments
-
- thold-alldatasources-v2.patch
- (1.49 KiB) Downloaded 903 times
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
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 momentllow 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.
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!)
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!)
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.
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.
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
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:
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.
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: Select all
// NOT THIS -> if (!is_array($ds)) $ds[0] = $ds;
if (!is_array($ds)) {
$ds_tmp = $ds;
$ds = array();
$ds[0] = $ds_tmp;
}
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.
- Attachments
-
- hj.thold_functions.rpn.all_data_sources.patch
- patch for threshold to allow ALL_DATA_SOURCES in CDEFs, and to allow more CDEFs to work correctly..
- (6.5 KiB) Downloaded 642 times
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!)
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!)
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Sure here you go. It has a little more than it needs to have, because I cleaned up the indenting inside the case statementllow 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
- Attachments
-
- hj.thold_functions.rpn.all_data_sources.unifiedpatch.txt
- (6.88 KiB) Downloaded 918 times
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!)
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!)
Who is online
Users browsing this forum: No registered users and 1 guest