谁能帮我找出如何从http://oss.oetiker.ch/rrdtool/index.en.html调用 rrdtool c API 的 rrd_update_r 函数?
调用 rrd_update 的非线程安全版本很容易,但这个更棘手......
正常的rrd_update:
char *updateparams[] = {
"rrdupdate",
rrd_file,
values,
NULL
};
rrd_clear_error();
result = rrd_update(3, updateparams); //argc is first arg
因为程序必须在多线程环境中运行,所以我因为不使用线程安全函数而遇到了几个错误!但是使用rrd_update_r并不是那么容易,因为它也需要一个模板......
int rrd_update_r(const char *filename, const char *_template,
int argc, const char **argv);
我真的不知道如何创建一个......
char *updateparams[] = {
"rrdupdate",
rrd_file,
values,
NULL
};
rrd_clear_error();
result = rrd_update_r(rrd_file, NULL,3, updateparams);
不起作用并在执行时产生以下错误...
error: /var/tmp/rrds/1.rrd: expected timestamp not found in data source from rrdupdate
希望有人可以帮助我!
thx and br, roegi