~brad-marshall/charms/precise/nrpe-external-master/fix-lxc-nagios-hostname-type

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Tom Haddon
  • Date: 2012-10-26 07:10:22 UTC
  • Revision ID: tom.haddon@canonical.com-20121026071022-7396xmm46dqmnq0r
Allow for changes to nagios_host_context by consistently being able to generate the NAGIOS_HOSTNAME variable from the config-changed hook

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#------------------------------------------------------
44
44
# Host check
45
45
#------------------------------------------------------
46
 
export NAGIOS_HOSTNAME="$(config-get nagios_host_context)-$(relation-list -r ${JUJU_RELATION_ID})"
47
 
if [ "${NAGIOS_HOSTNAME}" != "$(config-get nagios_host_context)-" ]; then
48
 
    export NAGIOS_HOSTNAME=${NAGIOS_HOSTNAME//\//-}
49
 
    export IPADDRESS=$(unit-get private-address)
50
 
    export HOSTCHECK_INHERIT=$(config-get hostcheck_inherit)
51
 
    export HOSTGROUPS=$(config-get hostgroups)
52
 
    cheetah fill --env --oext compiled templates/host.cfg.tmpl
53
 
    cp templates/host.cfg.compiled /var/lib/nagios/export/host__${NAGIOS_HOSTNAME}.cfg
54
 
fi
 
46
export NAGIOS_HOSTNAME="$(config-get nagios_host_context)-$(relation-list -r $(relation-ids nrpe-external-master))"
 
47
export NAGIOS_HOSTNAME=${NAGIOS_HOSTNAME//\//-}
 
48
export IPADDRESS=$(unit-get private-address)
 
49
export HOSTCHECK_INHERIT=$(config-get hostcheck_inherit)
 
50
export HOSTGROUPS=$(config-get hostgroups)
 
51
cheetah fill --env --oext compiled templates/host.cfg.tmpl
 
52
rm /var/lib/nagios/export/host__*.cfg
 
53
cp templates/host.cfg.compiled /var/lib/nagios/export/host__${NAGIOS_HOSTNAME}.cfg
55
54
 
56
55
#------------------------------------------------------
57
56
# Service specific checks