mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Allow setting the target shorthost length. (#7453)
* Create a target shorthost length. Addresses #7452. * Update defaults.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
3f27357951
commit
fe8d011dce
@@ -298,6 +298,14 @@ $config['percentile_value'] = X;
|
||||
```
|
||||
Show the `X`th percentile in the graph instead of the default 95th percentile.
|
||||
|
||||
```php
|
||||
$config['shorthost_target_length'] = X;
|
||||
```
|
||||
The target maximum hostname length when applying the shorthost() function.
|
||||
You can increase this if you want to try and fit more of the hostname in graph titles.
|
||||
The default value is 12
|
||||
However, this can possibly break graph generation if this is very long.
|
||||
|
||||
### Add host settings
|
||||
The following setting controls how hosts are added. If a host is added as an ip address it is checked to ensure the ip is not already present. If the ip is present the host is not added.
|
||||
If host is added by hostname this check is not performed. If the setting is true hostnames are resolved and the check is also performed. This helps prevents accidental duplicate hosts.
|
||||
|
@@ -86,6 +86,7 @@ function shorthost($hostname, $len = 12)
|
||||
if (filter_var($hostname, FILTER_VALIDATE_IP)) {
|
||||
return $hostname;
|
||||
}
|
||||
$len = Config::get('shorthost_target_length', $len);
|
||||
|
||||
$parts = explode(".", $hostname);
|
||||
$shorthost = $parts[0];
|
||||
|
Reference in New Issue
Block a user