mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix "improper label name" in Prometheus datastore (#11602)
* base64 encode tags with forward slashes "/" in it * Use of Str::contains and ternary statement * Like this * Update Prometheus.php Co-authored-by: Daniel Baeza <d.baeza@tvt-datos.es> Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -30,6 +30,7 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Data\Measure\Measurement;
|
||||
use Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Prometheus extends BaseDatastore
|
||||
{
|
||||
@@ -87,7 +88,7 @@ class Prometheus extends BaseDatastore
|
||||
|
||||
foreach ($tags as $t => $v) {
|
||||
if ($v !== null) {
|
||||
$promtags .= "/$t/$v";
|
||||
$promtags .= (Str::contains($v, "/") ? "/$t@base64/". base64_encode($v) : "/$t/$v");
|
||||
}
|
||||
}
|
||||
$options = $this->getDefaultOptions();
|
||||
|
Reference in New Issue
Block a user