ganglia / ganglia-web

Ganglia Web Frontend
BSD 3-Clause "New" or "Revised" License
317 stars 169 forks source link

Problem with checkheartbeat.php and hostnames #360

Open karmaatom opened 3 years ago

karmaatom commented 3 years ago

Hello. I have a problem with hostnames like n1 and n10, because you using strpos when searching for hostname. Maybe it would be better search for full name compare and if it fails find by substring:

$host_found = 0; $host_found_by_substr = 0;

foreach ( $ganglia_hosts_array as $ganglia_host ) { if ( strcmp( $ganglia_host, $host ) === 0 ) { $fqdn = $ganglia_host; $host_found = 1; break; } if ( strpos( $ganglia_host, $host ) !== false ) { $fqdn_by_substr = $ganglia_host; $host_found_by_substr = 1; } }

if ( $host_found !== 1 && $host_found_by_substr === 1 ) { $host_found = 1; $fqdn = $fqdn_by_substr; }

karmaatom commented 3 years ago

Also same problem with check_multiple_metrics