Show off percent of memory with two values

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Show off percent of memory with two values

Post by combellm »

Hi cacti community,
I have been working on my map that shows off the live memory of some equipments.

Here is an exemple of the code for one node: (it works)
#----------------------------------------------------------------------------------------------------
# regular NODEs:
#----------------------------------------------------------------------------------------------------

NODE AG_VSS
LABEL AG_VSS
ICON images/IBM-Server-icon.png
LABELBGCOLOR 30 127 203
POSITION 100 50

NODE AG_VSSa
LABEL Free:{node:this:bandwidth_in:%k}
TARGET gauge:[path_to_cacti]/rra/agrgi1f01_cisco_memfree_2874.rrd:cisco_memfree:-
USESCALE FREESCALE
POSITION AG_VSS 0 18

NODE AG_VSSb
LABEL Used:{node:this:bandwidth_in:%k}
TARGET gauge:[path_to_cacti]/rra/agrgi1f01_cisco_memused_2875.rrd:cisco_memused:-
POSITION AG_VSS 0 36


#----------------------------------------------------------------------------------------------------
It gives me three labels:
The first one for the name
The second for the free memory
The third for the used memory.

My problem is that i can't have a scale working with it.

Does anyone knows how to make a ratio like used/free or any method to have a scale working with 0-100%.

I'm still working on it and I will post something if I find the solution.

Untill this if someone make it works I would like to know how he did it.

Thanks and have a nice day.
--
knowledge is the only thing which increases, when shared
thuck
Posts: 21
Joined: Mon Mar 09, 2009 6:13 pm

Re: Show off percent of memory with two values

Post by thuck »

Usually I use the graph template to create the percentage.
So you should retrieve your raw data and uses the CDEF Function 'Multiple by 100, Divided by Total All Data Sources'.
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

thuck wrote:Usually I use the graph template to create the percentage.
So you should retrieve your raw data and uses the CDEF Function 'Multiple by 100, Divided by Total All Data Sources'.
That's smart! I never thought about going to the roots of the problem...
Thanks I will try that!
(If you have a screeshot of the graph template configuration, or even the xml file I would definitely like to see it :oops: )

Thanks I take your solution for now!
--
knowledge is the only thing which increases, when shared
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

I tried making a new CDEF function like this:
http://www.hostingpics.net/viewer.php?i ... titre1.png

Then I added it to my new graph template:
http://www.hostingpics.net/viewer.php?i ... titre2.png

Not working... First time for me to use CDEF and it's harder than I thought...
Any tips? Something missing?

Thanks
--
knowledge is the only thing which increases, when shared
thuck
Posts: 21
Joined: Mon Mar 09, 2009 6:13 pm

Re: Show off percent of memory with two values

Post by thuck »

There is already a CDEF for that, the one that I said to you to use: ' Multiply by 100...'; it should be in your cacti by default.
Can you show all the graph template? Also the data input method and the data template?
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

Actually it is not in Cacti... Here are all the CDEF I have:

Code: Select all

Advanced Ping ALT - Loss 0.01-0.02	
Advanced Ping ALT - Loss 0.03-0.05	
Advanced Ping ALT - Loss 0.06-010	
Advanced Ping ALT - Loss 0.11-0.15	
Advanced Ping ALT - Loss 0.16-0.50	
Advanced Ping ALT - Loss 0.51-0.95	
Advanced Ping ALT - Loss 0.96-0.99	
Advanced Ping ALT - Loss 0.99-1.00	
Advanced Ping ALT - SDEV Position 1,2 (sdev)	
Advanced Ping ALT - SDEV Position 3 Max	
Advanced Ping ALT - SDEV Position 3 Min	
Bandwidth Percentage - 0 to 10%	
Bandwidth Percentage - 10 to 20%	
Bandwidth Percentage - 20 to 30%	
Bandwidth Percentage - 30 to 40%	
Bandwidth Percentage - 40 to 50%	
Bandwidth Percentage - 50 to 60%	
Bandwidth Percentage - 60 to 70%	
Bandwidth Percentage - 70 to 80%	
Bandwidth Percentage - 80 to 90%	
Bandwidth Percentage - 90 to 100%	
Bytes/Bits Draw Negative	
CPU Seconds As Percentage	
Difference of Two	
Divide by 1000	
Divide by 8640000 (Ticks to Days)	
Eliminate hunderdths	
Make Per 5 Minutes	
Make Stack Negative	
Multiply by 1024	
Percentage Bandwidth Utilization	
percentage for memory	
TECLinkStatus_Down	
TECLinkStatus_Up	
Total All Data Sources	
Total All Data Sources, Multiply by 1024	
Total All Data Sources, Multiply by 8	
Turn Bytes into Bits	
Turn Bytes into bits, make negative	
Turn Bytes into Bits, Make per Second, Convert in Percent	
Turn Bytes into negative bits	
Turn kilobytes into bits	
Unknown-Data	
Usage by Percentage	
_MAKE 0
My graph template is the default for Cisco Router "memory usage" and I just changed the CDEF function.
I didn't change the data template...
--
knowledge is the only thing which increases, when shared
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

Do you have the code of this CDEF like this:
cdef=CURRENT_DATA_SOURCE,*,100,/,ALL_DATA_SOURCES_NODUPS

I think I choose a wrong thing in the list... After that I can work on the graph template!

Thanks for everything :)
--
knowledge is the only thing which increases, when shared
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Show off percent of memory with two values

Post by Howie »

The CDEF doesn't change the data STORED in the rrd file though - only what is shown in the graph. Weathermap uses the data from the rrd.
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!)
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

Howie wrote:The CDEF doesn't change the data STORED in the rrd file though - only what is shown in the graph. Weathermap uses the data from the rrd.
Yes true!
I now have it working in the graphs but no way to plug the target of my map to the value of the graph...
Any other solution?
How did you do?
--
knowledge is the only thing which increases, when shared
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Show off percent of memory with two values

Post by Howie »

I don't think there is a solution right now. I am thinking about how something to have MAXVALUE be fetched from a target would work (lots of possibilities for divide-by-zero and other strange stuff).
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!)
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

Howie wrote:I don't think there is a solution right now. I am thinking about how something to have MAXVALUE be fetched from a target would work (lots of possibilities for divide-by-zero and other strange stuff).
Hum :/ OK thanks for the answer. I think I am not the only one that would be interested with this.
I will keep my basic map with the free and used memory but without scale.

Thanks everyone!
--
knowledge is the only thing which increases, when shared
combellm
Cacti User
Posts: 111
Joined: Mon Oct 10, 2011 9:51 am
Location: PARIS, France

Re: Show off percent of memory with two values

Post by combellm »

If it can help someone I found a solution :)
The important thing is the MAXVALUE in the node default.
I show off the value as it is in my code before (three nodes: name / free / used) with the normal memory usage graph template.
I fixed the MAXVALUE in NODE DEFAULT TO 10Go (MAXVALUE 10000000000)

After that I made a scale for the free memory like this:

Code: Select all

KEYSTYLE FREESCALE tags
SCALE FREESCALE 0       0.5     255 0 0         0 - 50M
SCALE FREESCALE 0.5     1       250 164 1               50M - 100M
SCALE FREESCALE 1       5       194 247 50      100M - 500M
SCALE FREESCALE 5       15      20 148 20       500M - 1.5G
SCALE FREESCALE 15      100     9 82 40         1.5G et +
It makes a "percent" of 10Go so if the free memory goes under 50M it is in RED, between 50 and 100 in yellow/orange etc...

It is not dynamic but enough as all our memories are higher than 1Go and lower than 10Go so 50M is really low and we have to know it.

Good luck :)
--
knowledge is the only thing which increases, when shared
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests