UNKNOWN localhost - Hostname info not available.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dimitris
Posts: 5
Joined: Tue Oct 20, 2015 5:40 am

UNKNOWN localhost - Hostname info not available.

Post 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?
Attachments
6.png
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: UNKNOWN localhost - Hostname info not available.

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dimitris
Posts: 5
Joined: Tue Oct 20, 2015 5:40 am

Re: UNKNOWN localhost - Hostname info not available.

Post by dimitris »

Thank you for your reply but unfortunately it's not that. Any other suggestion to try please?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: UNKNOWN localhost - Hostname info not available.

Post 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'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dimitris
Posts: 5
Joined: Tue Oct 20, 2015 5:40 am

Re: UNKNOWN localhost - Hostname info not available.

Post by dimitris »

Thank you Box293. I'm getting the same error. UNKNOWN localhost - Hostname info not available. Likely invalid hostname
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: UNKNOWN localhost - Hostname info not available.

Post 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?
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
dimitris
Posts: 5
Joined: Tue Oct 20, 2015 5:40 am

Re: UNKNOWN localhost - Hostname info not available.

Post by dimitris »

Forgive my Joison I'm not sure what do you mean exactly?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: UNKNOWN localhost - Hostname info not available.

Post by rkennedy »

The hosts directive, it should look similar to -

Code: Select all

define host {
        host_name   localhost
Former Nagios Employee
dimitris
Posts: 5
Joined: Tue Oct 20, 2015 5:40 am

Re: UNKNOWN localhost - Hostname info not available.

Post 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!!!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: UNKNOWN localhost - Hostname info not available.

Post 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.
Former Nagios Employee.
me.
Locked