--- a/html/includes/collectd/functions.php
+++ b/html/includes/collectd/functions.php
@@ -774,6 +774,14 @@
function collectd_draw_meta_stack(&$opts, &$sources)
{
global $config;
+
+ // Nothing to draw (e.g. no RRD matching the expected type instances):
+ // let the caller fall back to the generic graph instead of building
+ // an invalid rrdtool command line.
+ if (empty($sources)) {
+ return FALSE;
+ }
+
$timespan_def = NULL;
if (!isset($opts['timespan'])) {
$timespan_def = reset($config['timespan']);
@@ -891,6 +899,14 @@
function collectd_draw_meta_line(&$opts, &$sources)
{
global $config;
+
+ // Nothing to draw (e.g. no RRD matching the expected type instances):
+ // let the caller fall back to the generic graph instead of building
+ // an invalid rrdtool command line.
+ if (empty($sources)) {
+ return FALSE;
+ }
+
$timespan_def = NULL;
if (!isset($opts['timespan'])) {
$timespan_def = reset($config['timespan']);
--- a/html/includes/graphs/device/collectd.inc.php
+++ b/html/includes/graphs/device/collectd.inc.php
@@ -102,7 +102,12 @@
}
collectd_flush($identifiers);
$rrd_cmd = $MetaGraphDefs[$type]($host, $plugin, $pinst, $type, $all_tinst, $opts);
-} else {
+}
+
+// No meta graph for this type, or the meta graph found nothing to draw
+// (e.g. "memory" type written by another plugin than "memory"): use the
+// generic single-file graph.
+if ($rrd_cmd === FALSE) {
if (!in_array(is_null($tinst) ? '' : $tinst, $all_tinst)) {
return error404($host . '/' . $plugin . (!is_null($pinst) ? '-' . $pinst : '') . '/' . $type . (!is_null($tinst) ? '-' . $tinst : ''), "No rrd file found for graphing");
}