Fixed fail2ban jails eventlog spam (#10061)

Sort the jails before saving so it always matches.
Not sure why it would be different order, but this fixes the spam in any case.
This commit is contained in:
Tony Murray
2019-04-03 17:21:27 -05:00
committed by Neil Lathwood
parent 64897c273c
commit c305d2b520

View File

@@ -1,5 +1,6 @@
<?php <?php
use Illuminate\Support\Arr;
use LibreNMS\Exceptions\JsonAppParsingFailedException; use LibreNMS\Exceptions\JsonAppParsingFailedException;
use LibreNMS\Exceptions\JsonAppException; use LibreNMS\Exceptions\JsonAppException;
use LibreNMS\RRD\RrdDefinition; use LibreNMS\RRD\RrdDefinition;
@@ -92,7 +93,7 @@ if (empty($f2b['jails'])) {
$id = $component->getFirstComponentID($f2bc); $id = $component->getFirstComponentID($f2bc);
$f2bc[$id]['label'] = 'Fail2ban Jails'; $f2bc[$id]['label'] = 'Fail2ban Jails';
$f2bc[$id]['jails'] = json_encode(array_keys($f2b['jails'])); $f2bc[$id]['jails'] = json_encode(Arr::sort(array_keys($f2b['jails'])));
$component->setComponentPrefs($device_id, $f2bc); $component->setComponentPrefs($device_id, $f2bc);
} }