Page 1 of 1

UNKNOWN localhost - Hostname info not available.

Posted: Fri Nov 06, 2015 6:33 am
by dimitris
I'm trying to use check_multiple_metrics.sh and I'm getting
UNKNOWN localhost - Hostname info not available. Likely invalid hostname
My nagios.log and /var/log/messages

Code: Select all

[1446798122] SERVICE NOTIFICATION: nagiosadmin;localhost;Check Multiple Metrics;UNKNOWN;notify-service-by-email;UNKNOWN localhost - Hostname info not available. Likely invalid hostname
which is the same in nagios web interface

In error_log I'm getting this warning which I think is irrelevant.
tail -f /var/log/httpd/error_log

Code: Select all

[Fri Nov 06 11:12:46 2015] [error] [client ::1] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EET/2.0/no DST' instead in /usr/share/ganglia/cluster_view.php on line 36
My ganglia-services.cfg is

Code: Select all

define command {
  command_name  check_ganglia_multiple_metrics
  command_line  /bin/sh /var/www/html/ganglia2/nagios/check_multiple_metrics.sh host=$HOSTNAME$ checks='$ARG1$'
}

define service {
  service_description   Check Multiple Metrics
  use                   generic-service
  check_command         check_ganglia_multiple_metrics!disk_free_rootfs,less,10:disk_free_tmp,less,20
  host_name             localhost
}
I also tried to change host_name into 127.0.0.1 but didn't fix it. Any help please?

Re: UNKNOWN localhost - Hostname info not available.

Posted: Fri Nov 06, 2015 2:24 pm
by tgriep
Try changing your command from

Code: Select all

command_line  /bin/sh /var/www/html/ganglia2/nagios/check_multiple_metrics.sh host=$HOSTNAME$ checks='$ARG1$'
to

Code: Select all

command_line  /bin/sh /var/www/html/ganglia2/nagios/check_multiple_metrics.sh host=$HOSTADDRESS$ checks='$ARG1$'
Try that and see if that works for you.

Re: UNKNOWN localhost - Hostname info not available.

Posted: Fri Nov 06, 2015 4:40 pm
by dimitris
Thank you for your reply but unfortunately it's not that. Any other suggestion to try please?

Re: UNKNOWN localhost - Hostname info not available.

Posted: Sun Nov 08, 2015 11:32 pm
by Box293
What happens when you execute it at the command line?

Code: Select all

su nagios
/bin/sh /var/www/html/ganglia2/nagios/check_multiple_metrics.sh host=localhost checks='disk_free_rootfs,less,10:disk_free_tmp,less,20'

Re: UNKNOWN localhost - Hostname info not available.

Posted: Mon Nov 09, 2015 4:43 am
by dimitris
Thank you Box293. I'm getting the same error. UNKNOWN localhost - Hostname info not available. Likely invalid hostname

Re: UNKNOWN localhost - Hostname info not available.

Posted: Mon Nov 09, 2015 5:13 pm
by jolson
Interesting. Could you share your localhost host definition with us please? Are you certain that there are no extra spaces in the hostname or similar?

Re: UNKNOWN localhost - Hostname info not available.

Posted: Tue Nov 10, 2015 7:29 am
by dimitris
Forgive my Joison I'm not sure what do you mean exactly?

Re: UNKNOWN localhost - Hostname info not available.

Posted: Tue Nov 10, 2015 10:22 am
by rkennedy
The hosts directive, it should look similar to -

Code: Select all

define host {
        host_name   localhost

Re: UNKNOWN localhost - Hostname info not available.

Posted: Wed Nov 11, 2015 7:40 am
by dimitris
and that was the problem!
When I changed, in the host definition of the localhost.cfg in /usr/local/nagios/etc/objects, the address from the default 127.0.0.1 to my node's address it started running correctly.
Thank you all for your help!!!

Re: UNKNOWN localhost - Hostname info not available.

Posted: Wed Nov 11, 2015 10:21 am
by hsmith
Glad to hear it's working. I'll go ahead and close this one and mark it as resolved. Please let us know if anything else comes up.