mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Changing measurement to name in result set
This commit is contained in:
@@ -55,7 +55,7 @@ class ResultSet
|
||||
$points = array();
|
||||
|
||||
foreach ($this->getSeries() as $serie) {
|
||||
if ($serie['measurement'] == $metricName || array_intersect($tags, $serie['tags'])) {
|
||||
if ($serie['name'] == $metricName || array_intersect($tags, $serie['tags'])) {
|
||||
$points = array_merge($points, $this->getPointsFromSerie($serie));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,22 @@ class ResultSetTest extends \PHPUnit_Framework_TestCase
|
||||
new ResultSet($invalidJSON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws Exception if something went wrong with influxDB
|
||||
* @expectedException \Leaseweb\InfluxDB\InfluxDBClientError
|
||||
*/
|
||||
public function testThrowsInfluxDBException()
|
||||
{
|
||||
|
||||
$errorResult = <<<EOD
|
||||
{
|
||||
"series": [],
|
||||
"error": "Big error, many problems."
|
||||
}
|
||||
EOD;
|
||||
new ResultSet($errorResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* We can get points from measurement
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"series": [
|
||||
{
|
||||
"measurement": "cpu_load_short",
|
||||
"name": "cpu_load_short",
|
||||
"tags": {
|
||||
"host": "server01",
|
||||
"region": "us-west"
|
||||
@@ -20,7 +20,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"measurement": "cpu_load_short",
|
||||
"name": "cpu_load_short",
|
||||
"tags": {
|
||||
"host": "server02",
|
||||
"region": "us-west"
|
||||
@@ -37,7 +37,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"measurement": "other_serie",
|
||||
"name": "other_serie",
|
||||
"tags": {
|
||||
"host": "server01",
|
||||
"region": "us-west"
|
||||
|
||||
Reference in New Issue
Block a user