Open karmaatom opened 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; }
Also same problem with check_multiple_metrics
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; }