Ticket ID #208 ‐ Set Up Nagios Monitoring Using Puppet Module - GriffinKat/group-a GitHub Wiki
Set Up Nagios Monitoring Using Puppet Module
Create this file structure on the mgmt server
Using these commands
sudo mkdir nagios
cd nagios
sudo mkdir manifests
sudo mkdir files
sudo mkdir templates
cd manifests/
sudo touch {init.pp,install.pp,config.pp,service.pp}
Create a nagios group and a nagios user in /nagios/manifests/install.pp
class nagios::install { package { "nagios4": ensure => present, require => User["nagios"], }
user { "nagios":
ensure => present,
comment => "Nagios user",
gid => "nagios",
shell => "/bin/false",
require => Group["nagios"],
}
group { "nagios":
ensure => present,
}
exec { 'install-puppet-nagios-plugin':
command => '/opt/puppetlabs/bin/puppet module install puppetlabs-nagios_core>
creates => '/etc/puppetlabs/code/environments/production/modules/nagios_core>
require => Package['nagios4']
}
}
Check each class is correct after creation so if there are errors, it is apparent where
Create the main nagios class in the init.pp files in manifests
sudo nano init.pp
In init.pp put this code
class nagios4 {
include nagios4::install
}
Check if the Class is configured correctly by going to
cd /etc/puppetlabs/code/environments/production/manifests
sudo nano site.pp
And adding nagios to the db-a node
Run the puppetagent on the db-a server by running
sudo /opt/puppetlabs/puppet/bin/puppet agent --server=mgmt-a --no-daemonize --verbose --onetime
Check the status using
sudo systemctl status nagios4
On my first attempt I had nagios in the incorrect node, THUS the red