g2n - Ganglia to Nagios
This script will get all hosts from Ganglia (gmetad) and convert to Nagios configs. The convertion done using template mappings.
Getting started:
Look in
config.example/*
for reference
- Set all required config settings in
config/g2n.yml
. - Edit the
config/mappings.yml
to map Ganglia cluster to Nagios templates (located by default inconfig/templates
) - Run the
g2n
(for example:cd <project-dir>; ruby -Ilib bin/g2n
, to generate the Nagios configs and put them intooutput_path
(default is:/var/tmp/g2n
) - Finally copy the generated Nagios configs to nagios configuration dir. (e.g.
/etc/nagios
)
Example sync script:
- There is an example script (located in
scripts/sync.sh
) which can be used in cronjobs. - The script will run
g2n
and copy the generated configs into Nagios configuration folder. - After copying it will restart Nagios daemon, in order for the changes to take effect.
- The script will check for changes before copying the generated configs to Nagios configuration directory and before restarting Nagios daemon. So when no changes found, the sync script won't do any restarts to Nagios daemon.
FYI: edit the sync script and change the
NAGIOS_CFG_DIR
variable to desired Nagios configuration directory
while developing, run the script like this:
cd <project-dir>
ruby -Ilib bin/g2n