graphing ratios based on 2 DS ?
Moderators: Developers, Moderators
graphing ratios based on 2 DS ?
hi,
i'm interested in graphing ratios with data coming from 2 DS using the same DIM.
unfortunately, i haven't found so far...
of course i could modify the script and create one which does the ratio and so create a nez DIM and a new DS, but then, nothing is really generic anymore if i must create a new DIM for each ratio, isn't it ?
so is it, that i didn't find ?
or
should it be a feature request ?
precise example would be monitoring key_cache usage in MySQL, or see the proportion of slow queries amongs total queries (still in mysql...)
any help or entry appreciated
i'm interested in graphing ratios with data coming from 2 DS using the same DIM.
unfortunately, i haven't found so far...
of course i could modify the script and create one which does the ratio and so create a nez DIM and a new DS, but then, nothing is really generic anymore if i must create a new DIM for each ratio, isn't it ?
so is it, that i didn't find ?
or
should it be a feature request ?
precise example would be monitoring key_cache usage in MySQL, or see the proportion of slow queries amongs total queries (still in mysql...)
any help or entry appreciated
-
- Cacti User
- Posts: 311
- Joined: Tue Jun 29, 2004 12:52 pm
- Location: Indiana
you could do it with a CDEF. Basically you graph the (from your example) slow and total queries on the same graph. Then you set up this:
slow / (total_all_data_sources - slow) which translates to the following:
Since the "ALL_DATA_SOURCES_NODUPS" is equal to slow + total, taking ((slow + total) - slow) = total. So then slow / total = ratio.
slow / (total_all_data_sources - slow) which translates to the following:
Code: Select all
cdef=CURRENT_DATA_SOURCE,ALL_DATA_SOURCES_NODUPS,CURRENT_DATA_SOURCE,-,/
Dave
well...
my CDEF is the following (it compares sizes not queries...) :
and my graph is defined with first item : the total (represent as a line with no color)
2nd item : the number of blocks (thus the *1024) defined with an area and using my custom CDEF definition.....
so far, no graph !!
i yet have to check that the new data i needed is gathered correctly (it should) but if there is something else i missed ?
my CDEF is the following (it compares sizes not queries...) :
Code: Select all
cdef=(CURRENT_DATA_SOURCE,1024,*),ALL_DATA_SOURCES_NODUPS,(CURRENT_DATA_SOURCE,1024,*),-,/
2nd item : the number of blocks (thus the *1024) defined with an area and using my custom CDEF definition.....
so far, no graph !!
i yet have to check that the new data i needed is gathered correctly (it should) but if there is something else i missed ?
-
- Cacti User
- Posts: 311
- Joined: Tue Jun 29, 2004 12:52 pm
- Location: Indiana
looks good except for 1 thing which I'm not sure if it will make a differance. You are not multiplying your ALL_DATA_SOURCE_NO_DUPS by 1024 like the other things, so that might screw up the calculation. Check the debug output from the graph, and the graph source. If you can't find anything, post both here and I or somebody else can look through it and perhaps spot a problem. A further check would be to verify that cmd.php is actually getting data from the device and updating the rrd files.
Dave
i checked cmd.php output, there was a problem which i corrected, but still no graph
the 2 DS debug outputs look good but the graph debug output shows nothing....
i just have an empty image placeholder + "RRDtool says : " and that's all, no text after that....
what i lack is a CDEF debugger
i'll try and post something more precise so that you can help me after my lunch (lunch time here ! )
the 2 DS debug outputs look good but the graph debug output shows nothing....
i just have an empty image placeholder + "RRDtool says : " and that's all, no text after that....
what i lack is a CDEF debugger
i'll try and post something more precise so that you can help me after my lunch (lunch time here ! )
so, back now and here is the remainder.
I forgot to explain th *1024 thing...
actually i am graphing (willing to...) the key_cache usage of MySQL.
so on the one hand i get key_cache_size in bytes (fixed value)
and on the other hand i get key_used_blocks..... which i have to multiply by the block_size (in my case fixed to 1024 bytes...) (changing value)
Now with the debug outputs....
here is what i get for my 2 DSs (which i changed 2 minutes ago because they seemed inappropriate) :
I forgot to explain th *1024 thing...
actually i am graphing (willing to...) the key_cache usage of MySQL.
so on the one hand i get key_cache_size in bytes (fixed value)
and on the other hand i get key_used_blocks..... which i have to multiply by the block_size (in my case fixed to 1024 bytes...) (changing value)
Now with the debug outputs....
here is what i get for my 2 DSs (which i changed 2 minutes ago because they seemed inappropriate) :
Code: Select all
[i]First DS[/i]
/usr/local/bin/rrdtool create \
/home/www/cacti/rra/localhost_mysql_key_blocks_12.rrd \
--step 300 \
DS:mysql_key_blocks:COUNTER:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
Code: Select all
[i] Second DS[/i]
Data Source Debug
/usr/local/bin/rrdtool create \
/home/www/cacti/rra/localhost_mysql_key_buf_size_11.rrd \
--step 300 \
DS:mysql_key_buf_size:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
- Attachments
-
- definition of item #2 with th CDEF used (cdef is already quoted in the post)
- item2_def.JPG (69.48 KiB) Viewed 1901 times
-
- graph definition (with 2 items)
- graph_def.JPG (70.75 KiB) Viewed 1904 times
-
- Cacti User
- Posts: 311
- Joined: Tue Jun 29, 2004 12:52 pm
- Location: Indiana
What I said about the 1024 stuff.... if your two stats come is as 2 and 100 (so we should get 2%)
then the cdef does this: 2 / (102 - 2) = 2%
but you are multiplying the individual data sources by 1024, and not the ALL_DS_NO_DUPS, so the cdef now does this (2*1024) / (102 - (2*1024)) = 2048 / 102 - 2048 = 2048 / -1946 = /.9 something. So perhaps that is why it isn't working, you are dividing by a negative number?
What I would try to do, is graph both items as "AREA". No special CDEF or anything. Verify that Cacti can get the data and is updating the rrd files and stuff. Once that is complete, then you can start messing with the CDEF, and if changing the CDEF makes the graph not work anymore, than you know there is a problem with the CDEF.
then the cdef does this: 2 / (102 - 2) = 2%
but you are multiplying the individual data sources by 1024, and not the ALL_DS_NO_DUPS, so the cdef now does this (2*1024) / (102 - (2*1024)) = 2048 / 102 - 2048 = 2048 / -1946 = /.9 something. So perhaps that is why it isn't working, you are dividing by a negative number?
What I would try to do, is graph both items as "AREA". No special CDEF or anything. Verify that Cacti can get the data and is updating the rrd files and stuff. Once that is complete, then you can start messing with the CDEF, and if changing the CDEF makes the graph not work anymore, than you know there is a problem with the CDEF.
Dave
Who is online
Users browsing this forum: No registered users and 2 guests