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    


Graph template with "No value" zone

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: General
Author Message
Tulan



Joined: 15 Apr 2010
Posts: 3

PostPosted: Thu Apr 15, 2010 4:25 am    Post subject: Graph template with "No value" zone Reply with quote

Hello,
an ISP provider give us Cacti graphs for bandwith usage with a cool feature: when Cacti can't access the device a red area is displayed on the graph.

Do you know how to add this feature in a graph template? The Cacti system is very powerfull but a little too complicated sometimes

We are using Cacti 0.8.7e.



getGraphCacti.php.png
 Description:
 Filesize:  5 KB
 Viewed:  340 Time(s)

getGraphCacti.php.png


Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Thu Apr 15, 2010 1:19 pm    Post subject: Reply with quote

Primarily, you are not asking for a Cacti feature but an RRDTool Feature.
Do you see a wrench next to the graph? Then, please hit it and post the rrdtool garph statement found. Else, please see http://docs.cacti.net/manual:087:6_reference.2_cdef#cdefs to learn how to solve similar approaches. Be prepared for some hard work ahead
R.
Back to top
Tulan



Joined: 15 Apr 2010
Posts: 3

PostPosted: Fri Apr 16, 2010 11:27 am    Post subject: Reply with quote

You are right it is a RRDTOOL problem. After reading the RRDTOOL manual, I have discovered the solution is very simple ... after understanding the RPN notation

  • Create a new CDEF (called "Unknown Data" for me) with content: CURRENT_DATA_SOURCE,UN,INF,UNKN,IF

    • 1st step: CURRENT_DATA_SOURCE,UN test if the current data value is Unknown. Result is 1 if yes, 0 if not
      After this step the function is 1,INF,UNKN,IF or 0,INF,UNKN,IF
    • 2nd step: the IF statement test if the previous result is 1 or 0. If yes it return INF (infinity), UNKN (unknown) if not

  • In the graph template, create a new "Graph Template Item" with the datasource in input, type AREA and the new created CDEF as CDEF function. If the result of the CDEF function is INF, the grapher fill the area to maximum, but don't draw anything if the result is UNKN

The final RRDTOOL command for the attached graph
Code:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="xxxxxxx - Exchange Connections" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Connections" \
--slope-mode \
--font TITLE:10: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/cacti/rra/xxxxx_count_active_users_1800.rrd":count_active_users:AVERAGE \
DEF:b="/var/www/cacti/rra/xxxxx_count_active_users_1800.rrd":active_connections:AVERAGE \
CDEF:cdefi=a,UN,INF,UNKN,IF \
AREA:a#FF7D00FF:"Active Users"  \
GPRINT:a:LAST:"      Cur\:%8.0lf"  \
GPRINT:a:AVERAGE:"Avg\:%8.0lf"  \
GPRINT:a:MAX:"Max\:%8.0lf\n"  \
LINE2:b#00FF00FF:"Active Connections"  \
GPRINT:b:LAST:"Cur\:%8.0lf"  \
GPRINT:b:AVERAGE:"Avg\:%8.0lf"  \
GPRINT:b:MAX:"Max\:%8.0lf\n"  \
AREA:cdefi#797C6EFF:""



graph_image.php.png
 Description:
 Filesize:  25.84 KB
 Viewed:  304 Time(s)

graph_image.php.png


Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 13135
Location: MI, USA

PostPosted: Fri Apr 16, 2010 11:39 am    Post subject: Reply with quote

Pretty cool
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Fri Apr 16, 2010 4:12 pm    Post subject: Reply with quote

Tulan wrote:
...I have discovered the solution is very simple ... after understanding the RPN notation
SIMPLE, RPN? I quite never seen anybody understanding RPN that fast and, that has to be noted, CORRECT. We should hire you as a CDEF Designer
R.
Back to top
Tulan



Joined: 15 Apr 2010
Posts: 3

PostPosted: Sat Apr 17, 2010 4:26 am    Post subject: Reply with quote

gandalf wrote:
SIMPLE, RPN? I quite never seen anybody understanding RPN that fast and, that has to be noted, CORRECT. We should hire you as a CDEF Designer
R.

No, I would to say the solution for my problem is a simple CDEF function, RPN is totally awful
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: General All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group