C API?

View: New views
9 Messages — Rating Filter:   Alert me  

C API?

by Camilo Rostoker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Is there a C API for RRDtool?  I read the thread from back in Feb 2006
about the update/creation of a C API
(http://www.mail-archive.com/rrd-developers@.../msg01664.html),
but I can't seem to find anything else about it.

I'm looking to mainly use the C API for storing data, and would likely
use one of the Perl or other API's for retrieving/displaying the data.

Any help/suggestions is greatly appreciated.

Cheers,
Camilo

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: C API?

by henrik-rrdusers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Feb 06, 2007 at 11:02:45AM -0800, Camilo Rostoker wrote:
> Is there a C API for RRDtool?  I read the thread from back in Feb 2006
> about the update/creation of a C API
> (http://www.mail-archive.com/rrd-developers@.../msg01664.html),
> but I can't seem to find anything else about it.

There is an API - it's specified in the "rrd.h" file - but it isn't
really documented anywhere.

I found the easiest way of learning this API was to look at the source
for the "rrdtool" program. The functions use more or less the same
parameters as the commandline utilities.

If it's of any help, you can see how I use the RRDtool API to
create and update RRD files. My project is the "Hobbit Monitor"
on http://hobbitmon.sourceforge.net/ - you can browse the source
at http://www.hswn.dk/beta/snapshot/ . The RRD create/update happens in
http://www.hswn.dk/beta/snapshot/hobbitd/do_rrd.c


Regards,
Henrik

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: C API?

by Mark Easton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>There is an API - it's specified in the "rrd.h" file - but it isn't
>really documented anywhere.

Many thanks for your post Henrik!

I am interfacing to phidgets (www.phidgets.com) so need to write a program in c to receive data from these phidgets and update into RRDTool.


Anyone can help me with building RRDTool on Windows XP with VS .NET 2005??

Re: C API?

by Mark Easton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok - I have built and produced an rrd.lib wit VS.NET 2005. No idea if it will work. I am wanting now to produce a small c app that uses this, so I guess I will include rrd.h and use your go_rrd.c and go from there. Any pointers?

Ta
mark

Re: C API?

by Travis Spencer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2/6/07, Mark Easton <mark.easton@...> wrote:
> Gosh the C api is a closely guarded secret it seems.

I wouldn't say that.  Almost everything that you need to know is at
http://oss.oetiker.ch/rrdtool/doc/index.en.html.  The only real
secrets have been discussed on this and the developer list before.
This is what I've picked up:

1. Free any double pointers you pass into RRD upon success
2. Lock other threads out before calling any of RRD's function if
you're running in a multithreaded environment and calling a
non-reentrant version of an RRD function
3. Clear optint, opterr, and call rrd_clear_error before invoking an
RRD function
4. All RRD functions return a non-zero value on failure and zero upon success.
5. You can call rrd_test_error to find out more when something goes wrong.
6 Ask here if you get stuck ;-)

Did I miss any?

See https://lists.oetiker.ch/pipermail/rrd-developers/2006-July/001729.html
for a few more details.  Also, I would suggest that you subscribe to
the lists with a gmail account or something, so you can search them
easily.  (That's what I do anyway.)

Happy hacking, Mark.

--

Regards,

Travis Spencer

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: C API?

by Mark Easton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool, thanks Travis,

Yes I have worked out all of this.

I am pleased now it is working - so now am just learning how to use the various rrdtool methods.

Cheers
Mark


Travis Spencer wrote:
On 2/6/07, Mark Easton <mark.easton@azurebell.co.nz> wrote:
> Gosh the C api is a closely guarded secret it seems.

I wouldn't say that.  Almost everything that you need to know is at
http://oss.oetiker.ch/rrdtool/doc/index.en.html.  The only real
secrets have been discussed on this and the developer list before.
This is what I've picked up:

1. Free any double pointers you pass into RRD upon success
2. Lock other threads out before calling any of RRD's function if
you're running in a multithreaded environment and calling a
non-reentrant version of an RRD function
3. Clear optint, opterr, and call rrd_clear_error before invoking an
RRD function
4. All RRD functions return a non-zero value on failure and zero upon success.
5. You can call rrd_test_error to find out more when something goes wrong.
6 Ask here if you get stuck ;-)

Did I miss any?

See https://lists.oetiker.ch/pipermail/rrd-developers/2006-July/001729.html
for a few more details.  Also, I would suggest that you subscribe to
the lists with a gmail account or something, so you can search them
easily.  (That's what I do anyway.)

Happy hacking, Mark.

--

Regards,

Travis Spencer

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: C API?

by steven765 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark or anyone
    Are there any pre-build visual studio solutions out there? Or one you might be willing to share?


Mark Easton wrote:
Ok - I have built and produced an rrd.lib wit VS.NET 2005. No idea if it will work. I am wanting now to produce a small c app that uses this, so I guess I will include rrd.h and use your go_rrd.c and go from there. Any pointers?

Ta
mark

Re: C API?

by Mark Easton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes my build works partially. The only things I need to fix and am doing at the moment is that some of the wrapper c code which I used from the rrdtool website is outdated and so the parameter counts of some methods have changed, but the main methods work.

You can download my VS.NET 2005 solution (..\rrdtool-1.2.19\win32\rrdtool.sln) which builds and saves the exe to ..\rrdtool-1.2.19\win32\tooldebug. Download from :

www.agile4.co.nz/downloads/rrdtool-1.2.19.rar, and
www.agile4.co.nz/downloads/GnuWin32.rar (... to get the gnuwin32.rar files included in the build. This is installed on my machine in C:\Program Files\GnuWin32.)

Good luck,
Mark

Re: C API?

by steven765 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Mark Easton wrote:
Yes my build works partially. The only things I need to fix and am doing at the moment is that some of the wrapper c code which I used from the rrdtool website is outdated and so the parameter counts of some methods have changed, but the main methods work.

You can download my VS.NET 2005 solution (..\rrdtool-1.2.19\win32\rrdtool.sln) which builds and saves the exe to ..\rrdtool-1.2.19\win32\tooldebug. Download from :

www.agile4.co.nz/downloads/rrdtool-1.2.19.rar, and
www.agile4.co.nz/downloads/GnuWin32.rar (... to get the gnuwin32.rar files included in the build. This is installed on my machine in C:\Program Files\GnuWin32.)

Good luck,
Mark

Okay got it working except the wrap_rrdgraph function. Any luck here? I've tried various things. Now it doesn't crash, but no picture is output either.

i modified it to read
ret_2 = wrap_rrd_graph( "speed.png --start 920804400 --end 920808000 -h 200 -w 400 DEF:data=test.rrd:AVERAGE LINE:data#FF0000");