Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with checkheartbeat.php and hostnames #360

Open
karmaatom opened this issue Apr 1, 2021 · 1 comment
Open

Problem with checkheartbeat.php and hostnames #360

karmaatom opened this issue Apr 1, 2021 · 1 comment

Comments

@karmaatom
Copy link

karmaatom commented Apr 1, 2021

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
Copy link
Author

Also same problem with check_multiple_metrics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant