We have a situation here where we have multiple internal subdomains, but want 
to configure Nagios to identify  hosts without our main domain.  Thus, the 
'hostname' we use for some items would be hostname.subdomain .  We also have to 
strrip off a certain subdomain (I wont go into the convoluted reasons for this).

To do this (in the cases it is necessary) I simply take the fqdn and use 
search/replace to replace the trailing domain name with nothing.  So, no need 
to change facter as I can use fqdn.

$hostname = foo
$fqdn = foo.dept.auckland.ac.nz
$nagioshostname = regsubst( $fqdn, '(\.itss|\.no)?\.auckland\.ac\.nz$', '','I' )

This might be sufficuient for what the original poster was asking?

Of course, they could always define a custom fact to hold the output of uname 
if they prefer.  One of the great things about the puppet/facter model is that 
you can do this with very little effort.

I would definitely not want to change the current behaviour of fqdn and 
hostname.

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.ship...@auckland.ac.nz
Ph: +64 9 373 7599 ext 86487


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to