Configurable device display name (#13528)

* Configurable device display name
You can just set the display name in device settings.

It also accepts simple template format with  the variables: hostname, sysName, sysName_fallback, ip

Default controlled by device_display_default, (set from old force_hostname_to_sysname and force_ip_to_sysname settings

* remove second argument to format_hostname()

* Style fixes

* Update schema

* update phpstan baseline

* Improved settings strings (and add for translation)
This commit is contained in:
Tony Murray
2021-11-18 15:46:22 -06:00
committed by GitHub
parent 69d0753ec4
commit 790c4b3402
24 changed files with 196 additions and 159 deletions

View File

@@ -446,6 +446,18 @@ class Config
self::deprecatedVariable('poller_modules.cisco-sla', 'poller_modules.slas');
self::deprecatedVariable('oxidized.group', 'oxidized.maps.group');
// migrate device display
if (! self::has('device_display_default')) {
$display_value = '{{ $hostname }}';
if (self::get('force_hostname_to_sysname')) {
$display_value = '{{ $sysName }}';
} elseif (self::get('force_ip_to_sysname')) {
$display_value = '{{ $sysName_fallback }}';
}
self::persist('device_display_default', $display_value);
}
$persist = Eloquent::isConnected();
// make sure we have full path to binaries in case PATH isn't set
foreach (['fping', 'fping6', 'snmpgetnext', 'rrdtool', 'traceroute', 'traceroute6'] as $bin) {