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    


rrd.php

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions
Author Message
Willie
Guest





PostPosted: Wed Sep 29, 2004 8:24 am    Post subject: rrd.php Reply with quote

Larry & Ian,

I would like to propose the following changes to rrd.php
1) before this line in rrdtool_function_graph
/* lets make that sql query... */

Add the following code:
$ifSpeed = db_fetch_row("select
host_snmp_cache.field_value
from graph_templates_graph,graph_local,host_snmp_cache
where graph_local.id=graph_templates_graph.local_graph_id
and graph_templates_graph.local_graph_id=$local_graph_id
and host_snmp_cache.host_id=graph_local.host_id
and host_snmp_cache.snmp_index=graph_local.snmp_index
and host_snmp_cache.field_value>1000");


2) in the CDEFS section of the same function, add this line directly abouve the $cdef)string = str_replace("CURRENT_DATA_SOURCE"...)

$cdef_string = str_replace("|query_ifSpeed|", (empty($ifSpeed["field_value"]) ? $graph_item["rrd_maximum"] : $ifSpeed["field_value"]), $cdef_string);

these 2 things will let me use the query_ifspeed from a cdef where I can compute the bandwidth like mrtg. I am currently adding this code in each time a new build is posted. the cdef is a little different that what was posted befroe on the forum as I am checking for empty instead of assuming that the device will return a interface speed. some of the old cabletron equipment will not and without the empty, you will get a runtime error.

Regards,

Willie
Back to top
raX
Lead Developer


Joined: 13 Oct 2001
Posts: 2235
Location: Carlisle, PA

PostPosted: Sun Oct 10, 2004 9:44 am    Post subject: Reply with quote

The code you provide here gets the ifSpeed for the current data source so you can use it in a CDEF. Have you tried using the "Current Data Source Item: Maximum Value" (CURRENT_DS_MAXIMUM_VALUE) special data source? If most cases, this value should be exactly the same as the ifSpeed since the maximum value is derived from ifSpeed on traffic graphs.

-Ian
Back to top
Willie
Guest





PostPosted: Sun Oct 10, 2004 5:44 pm    Post subject: ifSpeed Reply with quote

Ian,

I will try that. If I recall, I had tried it in the past and it did not work for my cabletron equipment (still have a lot of OLD stuff in the network) that did not return a proper ifSpeed. The Maximum was returning 100mbs instead of 10mbs. That threw off the pct utilization. But, I will retest under the new cacti.

Regards,

Willie
Back to top
Willie
Guest





PostPosted: Thu Oct 14, 2004 12:56 pm    Post subject: ifspeed Reply with quote

Ian,

The change seemed to work on the cabletron where I set the interface speed on the aditional info screen. however, it did not work on router interfaces. It still looked like it picked up 100mbs when it should have been 1.54mbs.

I have reverted back to the original code I posted at the front of this thread. I can sent you the graphing templates I am using for pct if you need them.

Regards,

Willie
Back to top
raX
Lead Developer


Joined: 13 Oct 2001
Posts: 2235
Location: Carlisle, PA

PostPosted: Thu Oct 14, 2004 6:36 pm    Post subject: Reply with quote

I realize that the maximum value for the data source item isn't always the best substitute for ifSpeed. For one, it relies on the default templates that Cacti ships with to work as advertised. Hopefully within the next Cacti version or two, I will get the chance to redo the way variables are implemented in CDEFs. Currently there is a lot of inconsistencies in Cacti with the way variables are implemented.

Thanks a lot for taking the time to write this!

-Ian
Back to top
Willie
Guest





PostPosted: Fri Oct 15, 2004 7:29 am    Post subject: rrd.php Reply with quote

Ian,

Here is the export of the pct template that I am using. I hope that it is helpful. If you use the code at the start of the thread along with this template, you should be very close to the MRTG style graph.

I am still looking for a way to capture and display the syslocation, sysname on the graph.

Regards,

Willie



cacti_graph_template_interface_traffic_bytessec_percentage.xml
 Description:
MRTG style graph template

Download
 Filename:  cacti_graph_template_interface_traffic_bytessec_percentage.xml
 Filesize:  17.9 KB
 Downloaded:  254 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group