diff --git a/library/Graphite/Graphing/Template.php b/library/Graphite/Graphing/Template.php index e47cb0c..f8b2f41 100644 --- a/library/Graphite/Graphing/Template.php +++ b/library/Graphite/Graphing/Template.php @@ -67,18 +67,16 @@ class Template $metricsExcluded = 0; foreach ($this->curves as $curveName => $curve) { - $query = $dataSource->select()->from($curve[0]->resolve([ - 'host_name_template' => static::getHostNameTemplate()->resolve([ - 'host.check_command' => $checkCommand, - '' => '$$' - ]), - 'service_name_template' => static::getServiceNameTemplate()->resolve([ - 'service.check_command' => $checkCommand, - '' => '$$' - ]), + $fullMetricTemplate = new MacroTemplate($curve[0]->resolve([ + 'host_name_template' => static::getHostNameTemplate(), + 'service_name_template' => static::getServiceNameTemplate(), '' => '$$' ])); + $query = $dataSource->select()->from($fullMetricTemplate) + ->where('host.check_command', $checkCommand) + ->where('service.check_command', $checkCommand); + foreach ($filter as $key => $value) { $query->where($key, $value); }