[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] Monit 5.0.2 question

From: Martin Pala
Subject: Re: [monit] Monit 5.0.2 question
Date: Thu, 14 May 2009 07:50:40 +0200

The problem is that there is no reliable way how to get correct FQDN. There is unreliable interface getdomainname() which returns on many platforms empty string or often default domains like "localdomain", "mydomain" when no other specific domain was set during system installation. The getdomainname() takes the value on some platforms from sysctl, on other platforms from file in /etc/ and on other platforms it's completely ignored. The name service lookup is not reliable as well - it depends on how the name service was set (usually NSS switch uses local files first which often have the shortname in front of longname for the given IP address and thus return often shortname first).

There are at least two possible solutions:

1.) set the machine hostname to FQDN instead of shortname (usually in / etc/hostname, but it's platform depended) ... the hostname can be checked with "uname -n" - monit's $HOST will then expand to FQDN

2.) expand the $HOST in monitrc to FQDN hostname manually ... in mail- format{} statement simply set the "from:" option to FQDN address, the "set mailserver" option allows to specify the hostname which should be used in SMTP communication (message-id header and HELO/EHLO command) this way:
  set mailserver using hostname ""

Other software usually handles the problem same way - for example MTAs like Postfix, Sendmail require manual configuration of domain name when "uname -n" is not fully qualified.


On May 13, 2009, at 5:51 PM, Aleksander Kamenik wrote:

David Paper wrote:
$HOST appears to be the short name that the host is known by. This presents a problem when there are two hosts that have identical short names, but different subdomains like:

Good point. Though I've tried to always have different names be cause of this kind of problems.

On SuSE linux, 'hostname' returns just foo07. 'hostname -f' returns the fully qualified domain name.

On Fedora 10 hostname returns the fqdn. -f returns localhost.localdomain for me. Do you by chance know a more reliable way to get the FQDN? I'm asking be cause I've had this problem when writing shell scripts which should work on several distros.

Is it possible to tell monit in the monitrc file either to use the FQDN of the host, or to specify what the FQDN is?

I'd prefer using the FQDN instead of the short host name too.



Aleksander Kamenik
System Administrator
Krediidiinfo AS
an Experian Company
Phone: +372 665 9649
Email: address@hidden

To unsubscribe:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]