Main perposes - automation building and configuration nagios box based on SOC mini computers (RPi or BBB). Vagrant used for debug and test configuration.
vagrant up
vagrant provision
vagrant ssh
Same problems in ansible provision configuration. Sudo - need set only in yml, not in Vagrant file.
conf dir contain configs files, this files copied on the target machine
- nagios-plugins - additional plugins to /usr/local/nagios/libexec
- ssh - key nagios user to /usr/local/nagios/.ssh, used nagios process for connecting to the management host
- www - index.html - redirector to /nagios/ and phpinfo.php, replacemnt for default www pages
- localhost - nagios config to /usr/local/nagios/etc
Place files in this directory - copy this files to the target.
My Nagios configuration use make for maintaining.
m4 used for generating working config files. *.m4 - replase *.cfg files with same name. Using prepared templates we have most services single line defined.
m4 directory contain common templates from this files cfg files not generated
Regenerate config and restart nagios
make
Test config
make test
Backup config - produce ../localhost-xx.tar.gz with timestamp
make backup
m4/nagios.m4 - base file for using in templates
first line in template
include(`nagios.m4')dnl
Ansible playlist based on http://networklore.com/ansible-install-nagios/
Not use split configuration. Three yml:
- lighttpd_php.yml
- nagios1.yml - install nagios from source
- nagios_cfg.yml - provision my working config on installed nagios
nagios_cfg.yml - overload working config, may using for update config
Standalone ansible playlist may using for maintaning working configuration on the nagios server device. For independent startup need inventory file - nagios_inventory
echo monitorbb ansible_ssh_user=debian > nagios_inventory
ansible_playlist -i nagios_inventory --list-host nagios_cfg.yml
ansible_playlist -i nagios_inventory nagios1.yml
Install date: 21.08.2014
Flasher from http://elinux.org/BeagleBoardDebian
diskutil list
diskutil umount disk2s1
sudo dd if=./BBB-eMMC-flasher-debian-7.6-console-armhf-2014-08-13-2gb.img of=/dev/rdisk2 bs=1m
10 min - writing flash
Insert flash - BOOT button + power on - after start flash off button. Lid run ~ 5 min. Write end all lid.
debian: temppwd
apt-get update
apt-get upgrade
apt-get install ntp
apt-get install locales
dpk-reconfigure locales
dpk-reconfigure tzdata
# -> beaglebone <-
passwd
vi /etc/hostname
Reboot. Copy ssh key for nonpassword accessfor ansible and management
ssh-copy-id -i ~/.ssh/id_rsa debian@monitorbb
Bootstrap nagios configuration:
apt-get install python
ansible_playlist -i nagios_inventory nagios1.yml