Keeping Data longer for select hosts

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Keeping Data longer for select hosts

Post by megamojo »

I would like to keep data with 5 minute precision for a very detailed Monthly graph, but only for a handful of hosts since I understand that doing it for all ~2400 of the ports I'm graphing would be disastrous to my disks. I've created a new RRA called "Monthly with 5 Minute Precision" defined as AVERAGE and MAX just like the other RRAs, and with the following parameters:
X-Files Factor: 0.5
Steps: 1
Rows: 18000
Timespan: 2678400

I also created new Graph and Data templates modeled on the existing Interface Traffic templates and including my newly defined timespan, but no matter what I try I can't get a graph to be created. The graphs simply don't get created, as opposed to being full of NaN for data.

Is making new graph and data templates even the right way to go about what I want to do? Did I define the new RRA with the appropriate parameters? If I'm going about this the wrong way I won't be offended in the slightest to be corrected.

The debug of one of the graphs is below. Obviously it's not creating the RRD file, but why?

Code: Select all

RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Facility Router Long Term Test 2 - Traffic (long term)" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/usr/share/cacti/site/rra/facility_router_long_term_test_2_traffic_in_2405.rrd":traffic_in:AVERAGE \
DEF:b="/usr/share/cacti/site/rra/facility_router_long_term_test_2_traffic_in_2405.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
AREA:cdefa#00CF00FF:"Inbound"  \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefe#002A97FF:"Outbound"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"  \
COMMENT:" \n" \
HRULE:0#FF0000FF:"95th Percentile"  \
COMMENT:"(0 mbit in+out)" 
RRDTool Says:
ERROR: opening '/usr/share/cacti/site/rra/facility_router_long_term_test_2_traffic_in_2405.rrd': No such file or directory
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

DEBUG for Data Source would be required to judge
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

gandalf wrote:DEBUG for Data Source would be required to judge
R.
As requested:

Code: Select all

Data Source Debug
/usr/bin/rrdtool create \
/usr/share/cacti/site/rra/facility_router_long_term_test_2_traffic_in_2405.rrd \
--step 300  \
DS:traffic_in:COUNTER:600:0:44736000 \
DS:traffic_out:COUNTER:600:0:44736000 \
RRA:AVERAGE:0.5:1:18000 \
RRA:MAX:0.5:1:18000 \
The only timescale that I have clicked in the Data Template is the new one I made, so to me it looks correct.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

That is correct. But it will allow to view only a single timespan when clicking on any graph.
Currently, Cacti requires an RRA definition to define a new timespan to be viewed (by default, there are 4 timespans). You may add some "pseudo-RRA" definitions to have a timespan with only very few CDPs to get around that
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

gandalf wrote:That is correct. But it will allow to view only a single timespan when clicking on any graph.
Currently, Cacti requires an RRA definition to define a new timespan to be viewed (by default, there are 4 timespans). You may add some "pseudo-RRA" definitions to have a timespan with only very few CDPs to get around that
R.
I'm only interested in a single timespan for this so that is not an issue. I did define a new RRA in the gui, but is there more to it than that or did I choose badly for the parameters? I've included a screenshot of it below.

Finally, if I'm going about this completely wrong let me know that too. My goal is simply to have a monthly graph with a 5 minute level of precision, but only for select hosts so that my collection of RRD files doesn't grow to enormous proportions.
Attachments
Screenshot of new RRA.
Screenshot of new RRA.
RRA.PNG (11.11 KiB) Viewed 2542 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The RRA itself looks fine.
But to use it, you need a data template that refers to THAT rra set.
In general, you will duplicate an existing Data Template and change the RRA associations only.
Then, duplicate the graph template and associate the graph template items to that new data template.
Next, apply that graph template to those hosts.

Yes, that's ugly.
We have plans to improve that area, but our main focus is to support different poller intervals. This hits the same part of the code. So perhaps, we'll improve it, but not before 089.
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

That's basically what I did before by trial and error, but just to be sure I deleted my previous data and graph templates and did it again in the way that you described. Now when I try to create a graph with the new graph template I get the following error:

Code: Select all

Notice: Undefined index: local_data_id in /usr/share/cacti/site/graphs_new.php on line 214

Warning: Invalid argument supplied for foreach() in /usr/share/cacti/site/graphs_new.php on line 214

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/cacti/site/graphs_new.php:214) in /usr/share/cacti/site/graphs_new.php on line 330
I checked the lines in the file referred to and they are:

Code: Select all

214: foreach($return_array["local_data_id"] as $item) {
330: header("Location: graphs_new.php?host_id=" . $_POST["host_id"]);
I get the same error when I try to create the graphs on a new host for testing or an existing host.

Do I need to change the Internal Data Source Name in the data template to something other than traffic_in?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please post data template definition screen first.
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

Not showing on the screen at the bottom are index value and index type, which are checked. And just in case you ever need it, here's the technical support info for my cacti installation. Thank you so much for taking the time to work through this with me. It is very impressive to get personal attention from the developer of such a useful project.

Code: Select all

Technical Support

General Information
Date	Wed, 21 Jul 2010 13:38:37 -0500
Cacti Version	0.8.7e
Cacti OS	unix
SNMP Version	NET-SNMP version: 5.2.3 
RRDTool Version	RRDTool 1.2.x 
Hosts	141
Graphs	2167
Data Sources	Script/Command: 32
SNMP: 37
SNMP Query: 2051
Script Query: 1
Script Query - Script Server: 48
Total: 2169

Poller Information
Interval	300
Type	spine
Items	Action[0]: 4171
Action[1]: 29
Action[2]: 92
Total: 4292
Concurrent Processes	2
Max Threads	5
PHP Servers	5
Script Timeout	25
Max OID	10
Last Run Statistics	Time:41.5094 Method:spine Processes:2 Threads:5 Hosts:141 HostsPerProcess:71 DataSources:4292 RRDsProcessed:2014

PHP Information
PHP Version	5.2.5-0.dotdeb.2
PHP OS	Linux
PHP uname	Linux howard 2.6.18-6-686 #1 SMP Fri Feb 19 23:40:03 UTC 2010 i686
PHP SNMP	Not Installed
max_execution_time	30
memory_limit	128M
Attachments
Data Template
Data Template
datatemplate.PNG (47.12 KiB) Viewed 2526 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

There has been a patch for exactly this part of the code with cacti087g:

Code: Select all

			}elseif ($current_form_type == "sg") {
				while (list($snmp_index, $true) = each($snmp_index_array)) {
					$snmp_query_array["snmp_index"] = decode_data_query_index($snmp_index, $snmp_query_array["snmp_query_id"], $_POST["host_id"]);

					$return_array = create_complete_graph_from_template($graph_template_id, $_POST["host_id"], $snmp_query_array, $values["sg"]{$snmp_query_array["snmp_query_id"]});

					debug_log_insert("new_graphs", "Created graph: " . get_graph_title($return_array["local_graph_id"]));

					/* lastly push host-specific information to our data sources */
					if (sizeof($return_array["local_data_id"])) { # we expect at least one data source associated
						foreach($return_array["local_data_id"] as $item) {
							push_out_host($_POST["host_id"], $item);
						}
					} else {
						debug_log_insert("new_graphs", "ERROR: no Data Source associated. Check Template");
					}
				}
			}
This leads to the assumption, that sth is wrong with the templates. The data template looks indeed fine, from a first glance. So I suspect the graph template ...
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

Well I fixed the error about not being able to create graphs. I had forgotten to update the data query for "SNMP - Interface Statistics" to point to the new graph template. With that fixed, I still get non-existent graphs and this on the graph debug.

Code: Select all

RRDTool Says:
ERROR: opening '/usr/share/cacti/site/rra/facility_router_long_traffic_in_2410.rrd': No such file or directory
I get the same result from using that data query and from making a graph completely manually. You mentioned you suspect the graph template. Did you mean you suspect that I did something wrong in creating the new one, which is quite possible, or there is a bug in the code? Do I need to upgrade to e from g?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

No change of code required.
I will have to play through all steps again to make sure that I did not forget anything important. From theory, it should be doable. But sometimes the real world is hard enough.
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I just reproduced all steps:
  • create new RRA like yours
  • copy the data template and change titles at will, select the new RRA only
  • copy the graph template. Change all graph items to point the the new data sources. Delete the superfluous Graph Item Inputs as both the new ones show up now
  • visit Data Query. Add the new Graph Template. Edit it and associate the correct Data Source Items. Check the checkboxes! At will, add some "Suggested Values"
works for me; tested on 087g.
R.
megamojo
Posts: 14
Joined: Mon May 10, 2010 8:11 am

Post by megamojo »

gandalf wrote:I just reproduced all steps:
  • create new RRA like yours
  • copy the data template and change titles at will, select the new RRA only
  • copy the graph template. Change all graph items to point the the new data sources. Delete the superfluous Graph Item Inputs as both the new ones show up now
  • visit Data Query. Add the new Graph Template. Edit it and associate the correct Data Source Items. Check the checkboxes! At will, add some "Suggested Values"
works for me; tested on 087g.
R.
This works for me now. I believe I was neglecting to check the checkboxes earlier when I was editing the Data Query.

However, I am experiencing something quite strange. On some of the interfaces the traffic is much lower than it should be. It's hard to put into words so I'm attaching a screenshot. The first graph is the WAN side of one of our routers, the T3 1/1 interface. This is the completely stock bits/sec with 95th percentile template. The next graph is the LAN interface of the same router, but with my new longer term templates. It should be and is a mirror image of the first graph, other than the fact they were started at slightly different times. The strange part is the 3rd graph in the screenshot. It should be exactly the same as the first graph, and a mirror image of the second. HDLC 1 is just the logical interface of the T3 1/1 shown in the first graph. If I had a longer screen you could see the T3 1/1 below matches exactly the HDLC 1 in the third graph, and does not match the first graph at all.

This screenshot is of a fresh new host I made just for testing this, but this behavior is the same when I add these alternate timescale graphs to the existing host. The LAN side Eth 0/1 interface graphs fine in the stock and my modified templates, but the T3 and HDLC interfaces graph much less traffic in my modified templates, but still graph fine in the stock templates.

If I can't get this resolved I'll just use the Eth 0/1 interface for this timescale, but it's puzzling either way.
Attachments
3graphs.PNG
3graphs.PNG (74.65 KiB) Viewed 2416 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

At least the 2nd graph, perhaps the 3rd as well, is broken. It shows same data for both outbound and inbound. I assume, that the data sources are wrong either on the graph template or at least on the graph itself.

Please create "old fashioned" graph for the logical interfaces as well to compare them to the "new" ones
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests