mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
Smokeping menu and title use device displayname (#15387)
* Menu and title use displayname * Fix empty strings * Fix array creation * Use groupby instead of loop * Change one forgotten var * Revert to working simple changes * Change test data to include displayname * Fix bad copy paste in test data
This commit is contained in:
parent
6134d9c153
commit
7a6ef2491e
@ -127,7 +127,10 @@ class SmokepingGenerateCommand extends LnmsCommand
|
||||
// Take the devices array and build it into a hierarchical list
|
||||
$smokelist = [];
|
||||
foreach ($devices as $device) {
|
||||
$smokelist[$device->type][$device->hostname] = ['transport' => $device->transport];
|
||||
$smokelist[$device->type][$device->hostname] = [
|
||||
'transport' => $device->transport,
|
||||
'displayname' => $device->displayName(),
|
||||
];
|
||||
}
|
||||
|
||||
$targets = $this->buildTargets($smokelist, Config::get('smokeping.probes'), $this->option('single-process'));
|
||||
@ -315,8 +318,8 @@ class SmokepingGenerateCommand extends LnmsCommand
|
||||
foreach ($devices as $hostname => $config) {
|
||||
if (! $this->dnsLookup || $this->deviceIsResolvable($hostname)) {
|
||||
$lines[] = sprintf('++ %s', $this->buildMenuEntry($hostname));
|
||||
$lines[] = sprintf(' menu = %s', $hostname);
|
||||
$lines[] = sprintf(' title = %s', $hostname);
|
||||
$lines[] = sprintf(' menu = %s', $config['displayname']);
|
||||
$lines[] = sprintf(' title = %s', $config['displayname']);
|
||||
|
||||
if (! $singleProcess) {
|
||||
$lines[] = sprintf(' probe = %s', $this->balanceProbes($config['transport'], $probeCount));
|
||||
|
@ -39,43 +39,55 @@ class SmokepingCliTest extends DBTestCase
|
||||
'Le23HKVMvN' => [
|
||||
'Cl09bZU4sn' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => 'Cl09bZU4sn',
|
||||
],
|
||||
'c559TvthzY' => [
|
||||
'transport' => 'udp6',
|
||||
'displayname' => 'c559TvthzY',
|
||||
],
|
||||
'sNtzSdxdw8' => [
|
||||
'transport' => 'udp6',
|
||||
'displayname' => 'sNtzSdxdw8',
|
||||
],
|
||||
'10.0.0.3' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => '10.0.0.3',
|
||||
],
|
||||
'2600::' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => '2600::',
|
||||
],
|
||||
],
|
||||
'Psv9oZcxdC' => [
|
||||
'oHiPfLzrmU' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => 'oHiPfLzrmU',
|
||||
],
|
||||
'kEn7hZ7N37' => [
|
||||
'transport' => 'udp6',
|
||||
'displayname' => 'kEn7hZ7N37',
|
||||
],
|
||||
'PcbZ5FKtS3' => [
|
||||
'transport' => 'udp6',
|
||||
'displayname' => 'PcbZ5FKtS3',
|
||||
],
|
||||
'192.168.1.1' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => '192.168.1.1',
|
||||
],
|
||||
'fe80::' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => 'fe80::',
|
||||
],
|
||||
],
|
||||
'4diY0pWFik' => [
|
||||
'example.org' => [
|
||||
'transport' => 'udp',
|
||||
'displayname' => 'example.org',
|
||||
],
|
||||
'host_with_under_score.example.org' => [
|
||||
'transport' => 'udp6',
|
||||
'displayname' => 'host_with_under_score.example.org',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user