
Table of Content
Introduction
Nagios
Nagios is an Open Source monitoring tool that provides a comprehensive monitoring environment. It monitors the entire IT infrastructure such as servers, switches, applications, network and services sending alert messages about issues and system recovery.
Technical benefits of Nagios
- Monitors our entire IT infrastructure
- Enables problem forecasting
- Generates immediate alerts on issues
- Facilitates Information sharing with stakeholders
- Minimizes downtime and business loss
System Monitoring Tool Voting Results
The screenshot below illustrates the output of the system monitoring tool – “voting results”
Use case
This use case details the procedures to setup Nagios monitoring and Nagios plug-in installations with Puppet services.
Prerequisites
- Install & Configure Puppet
- Configure Nagios using Puppet
Solution
Install & Configure Puppet
Numerous blog resources provide information on Puppet installation and configuration procedures.
Click the links below to learn more:
http://terokarvinen.com/2012/puppetmaster-on-ubuntu-12-04
Configure Nagios using Puppet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#puppet resource package puppetdb ensure=latest Create /etc/puppet/puppetdb.conf # vi /etc/puppet/puppetdb.conf [main] server = ubuntu.server.com port = 8081 soft_write_failure = false Add to /etc/puppet/puppet.conf # vi /etc/puppet/puppet.conf [main] storeconfigs = true storeconfigs_backend = puppetdb Create /etc/puppet/routes.yaml # vi /etc/puppet/routes.yaml master: facts: terminus: puppetdb cache: yaml |
1 2 |
#service puppetdb start #service puppetmaster restart |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# vi nagios/manifests/init.pp class nagios { include nagios::install include nagios::service include nagios::import } # vi nagios/manifests/install.pp class nagios::install { package { [ 'nagios', 'nagios-plugins', 'nagios-nrpe-plugin' ]: ensure => present, } } # vi nagios/manifests/service.pp class nagios::service { exec { 'fix-permissions': command => "find /etc/nagios/conf.d -type f -name '*cfg' | xargs chmod +r", refreshonly => true, } service { 'nagios': ensure => running, enable => true, require => Class[ 'nagios::install' ], } } # vi nagios/manifests/import.pp class nagios::import { Nagios_host <<||>> { require => Class[ 'nagios::install' ], notify => Class[ 'nagios::service' ] } Nagios_service <<||>> { require => Class[ 'nagios::install' ], notify => Class[ 'nagios::service' ] } } #vi nagios/manifests/nrpe.pp class nagios::nrpe { package { [ 'nagios-nrpe-server', 'nagios-plugins' ]: ensure => present, } service { 'nagios-nrpe-server': ensure => running, enable => true, require => Package[ 'nagios-nrpe-server', 'nagios-plugins' ] ], } } # vi nagios/manifests/export.pp class nagios::export { @@nagios_host { $::hostname : ensure => present, address => $::ipaddress, use => 'generic-host', check_command => 'check-host-alive', hostgroups => 'all-servers', target => "/etc/nagios/conf.d/${::hostname}.cfg", } @@nagios_service { "${::hostname}_check-load": ensure => present, use => 'generic-service', host_name => $::hostname, service_description => 'Current Load', check_command => 'check_nrpe!check_load', target => "/etc/nagios/conf.d/${::hostname}.cfg", } @@nagios_service { "${::hostname}_check-disk": ensure => present, use => 'generic-service', host_name => $::hostname, service_description => 'Disk Usage, check_command => 'check_nrpe!check_hda1', target => "/etc/nagios/conf.d/${::hostname}.cfg", } } # vi manifests/nodes.pp node default { include nagios::nrpe include nagios::export } |
Finally, apply the puppet
1 |
# puppet apply nodes.pp |
Check http://localhost/nagios – It works…
Conclusion
- Nagios provides an insight into our network performance and availability. It enables a fast response to errors in our network, and most importantly quickly notifies errors even before others sense the issues. It’s a very good example to understand how the Open Source community can assist you in network management.
References
- Refer https://exchange.nagios.org/directory/Tutorials/Nagios-Core-Tutorials for any further information.