[rrd-users] rrdgraph_libdbi issue with port number

Maciek Kolbusz kolbusz at sdf.org
Wed Nov 6 16:50:29 CET 2013


Ok, I found the source of the problem: port number has to be set with
dbi_conn_set_option_numeric rather than dbi_conn_set_option which handles
strings. Probably not the best piece of C code you've ever seen, but the
following works for me:

in rrdtool-1.4.20131003/src/rrd_fetch_libdbi.c line 193 was:

    if (dbi_conn_set_option(th->conn,key,value)) {
      dbi_conn_error(th->conn,(const char**)&dbi_errstr);
      rrd_set_error( "libdbi: problems setting %s to %s -
%s",key,value,dbi_errstr);
      _sql_close(th);
      return -1;
    }

and I changed it to:

  if (strcmp(key, "port") == 0) {
    if (dbi_conn_set_option_numeric(th->conn,key,atoi(value))) {
      dbi_conn_error(th->conn,(const char**)&dbi_errstr);
      rrd_set_error( "libdbi: problems setting %s to %s -
%s",key,value,dbi_errstr);
      _sql_close(th);
      return -1;
    }
  } else {
    if (dbi_conn_set_option(th->conn,key,value)) {
      dbi_conn_error(th->conn,(const char**)&dbi_errstr);
      rrd_set_error( "libdbi: problems setting %s to %s -
%s",key,value,dbi_errstr);
      _sql_close(th);
      return -1;
    }
  }

Regards,
MK



--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/rrdgraph-libdbi-issue-with-port-number-tp7581395p7581396.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.



More information about the rrd-users mailing list