// Call the implementation to add some arguments
r = self->impl->render(self->ctx, self, options, args, object);
- if (r < 0)
- goto ERROR;
+ if (r < 0) {
+ switch (-r) {
+ // Fall through if we could not find any of the sources, we will
+ // then create an empty graph instead.
+ case ENOENT:
+ break;
+
+ default:
+ goto ERROR;
+ }
+ }
// We cannot render the graph if there are no sources
if (!td_args_has_sources(args)) {
if (r < 0)
return r;
+ // Commit any buffered data right now
+ r = td_daemon_flush_source(self->daemon, self, object);
+ if (r < 0)
+ return r;
+
+ // Fail if the path does not exist
+ r = access(path, R_OK);
+ if (r < 0)
+ return -errno;
+
// Add all data sources
for (const td_rrd_ds* ds = self->impl->rrd_dss; ds->field; ds++) {
r = td_source_render_add_DEF(self, args, path, ds, object);
return r;
}
- // Commit any buffered data right now
- return td_daemon_flush_source(self->daemon, self, object);
+ return 0;
}