[rrd-users] Using RRDTool in C App - Graph is not being produced and there is no error

Mark Easton mark.easton at azurebell.co.nz
Sun Feb 25 20:26:51 CET 2007


I am working in Visual Studio 2005. My code creates the gopher.rrd file and
updates data successfully. When I do a fetch I am returned some data, so all
good. But when I create the graph image I get no errors and no image file is
created. I am trying to learn RRDTool, but this is confusing me. Any
pointers would be appreciated.

This is the main code:

	int ret;
	int ret_2;
	time_t seconds1, seconds2;
	char argstr[200];

seconds1 = time (NULL) - 100;
	sprintf(argstr, "gopher.rrd --start %ld --step 300 DS:temp:GAUGE:1200:U:U
RRA:MAX:0.5:1:576", (long)seconds1);

	ret = wrap_rrd_create( argstr);
	if (ret != -1)
	{
		test_interfacekit();
		seconds2 = time (NULL);

		sprintf(argstr, "gopher.rrd MAX --start %ld --end %ld", (long)seconds1,
(long)seconds2);

		ret_2 = wrap_rrd_fetch( argstr);   
		if (ret_2 == -1)
			printf("RRD error fetching: %s\n", rrd_get_error());

		sprintf(argstr, "temp.png --start %ld --end %ld
DEF:mytemp=gopher.rrd:temp:MAX", (long)seconds1, (long)seconds2);

		ret_2 = wrap_rrd_graph( argstr);               
		if (ret_2 == -1)
			printf("RRD error creating temp.png: %s\n", rrd_get_error());
	}else                
		printf("RRD error creating gopher.rrd: %s\n", rrd_get_error());



The method test_interfacekit() receives data from a temperature sensor and
updates it into the RRD. The call back method does this:

time_t seconds;
	char str[200];
	int ret;

	if (Index == 0)
	{
		seconds = time (NULL);
		printf("Time is %ld\n", (long)seconds);
		sprintf(str, "gopher.rrd %ld:%d", (long)seconds, (int)Value);
		ret = wrap_rrd_update( str);
		if (ret == -1)
			printf("RRD update error: %s\n", rrd_get_error());
	}

	printf("Sensor %d is %d\n", Index, Value);
	return 0;

-- 
View this message in context: http://www.nabble.com/Using-RRDTool-in-C-App---Graph-is-not-being-produced-and-there-is-no-error-tf3288407.html#a9146991
Sent from the RRDTool - User mailing list archive at Nabble.com.



More information about the rrd-users mailing list