-
Nagios
Open Source Network Monitoring
-
What Is Nagios?
- Network monitoring system
- Watches hosts and services on your network, and notifies you about problems
- Capable of resolving certain issues
- Less stress for you, the admin!
-
Why would I use Nagios?
- You're responsible for maintaining a network
- You don't want to spend all of your time babysitting it
- You prefer to solve problems before your bosses know they even exist
- You don't want to throw large sums of money at a poor propietary solution
- You'd like more time for drinking beer.
-
Installation
- Debian, Suse, Red Hat, and most other distros have packages available.
- Source is available, building from it is a bit of work
-
Configuration
- Lots of config files, a few that are critical
- contacts.cfg
- contactgroups.cfg
- hosts.cfg
- hostgroups.cfg
- services.cfg
-
contacts.cfg
- Defines who gets notifications about problems with hosts and services
define contact{
contact_name nagios
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email nagios@chrisclymer.com
}
-
contactgroups.cfg
- Defines groups of contacts who receive notifications
define contactgroup{
contactgroup_name admins
alias Administrators
members nagios
}
-
hosts.cfg
- Defines the hosts that we will monitor
define host {
use generic-host
host_name akron-web
alias Akron Webserver
address 192.168.10.51
parents akron-fw1
check_command check-host-alive
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
-
hostgroups.cfg
- Defines groups for the hosts we will monitor
define hostgroup{
hostgroup_name akron
alias Akron Office
contact_groups admins,akron-admins
members akron-web,akron-mail,akron-file
}
-
services.cfg
- Defines the services that we will monitor for each host
define service{
use generic-service
host_name akron-web
service_description HTTP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups akron-admins,admins
notification_interval 240
notification_period 24x7
notification_options n
check_command check_http
}
-
Templating
- Nagios configs can get terribly repetitve
- Solution: templates!
- All of the Nagios config files support "templating"
- templating works much like include statements in a multitude of programming languages
-
Template Definition
define service{
use generic-service
name http-service
service_description HTTP
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_http
register 0
}
-
Template Usage
define service{
use http-service
host_name akron-web
}
-
Additional Configs
- escalations.cfg - defines what procedure to follow in escalating various problems
- timeperiods.cfg - defines time periods used by all of the other configs
- misccommands.cfg - defines miscellaneous custom commands, such as notifications
- checkcommands.cfg - defines your own custom Nagios check commands
-
Nagios Plugins
- Without plugins, Nagios is pretty useless
- Plugins are what do the actual checking of each service and host
- There are included plugins, such as check_ping, check_http, check_dns, check_pop, check_imap, check_tcp and many others.
- Plugins are easy to write! With a little effort, you can write your own custom plugin.
- There is also a large collection of community created plugins at http://nagiosexchange.org
-
NRPE
- NRPE is the Nagios Remote Plugin Executor
- NRPE lets you do local host checks, instead of just external ones
- NRPE runs on Linux, BSD, Solaris, and Windows
- NRPE uses the same plugins as the Nagios daemon
- NRPE Config
allowed_hosts=127.0.0.1,192.168.10.10
nrpe_user=nagios
nrpe_group=nagios
command_timeout=60
command[check_load]=/usr/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk1]=/usr/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1
-
Web Interface
- Default view
- Acknowledgements
- Mapping
-
This is just the beginning!
- This is a basic primer to Nagios. Its capablities are largely limited only by how imaginative you can be
- Auto-generating Nagios configs, self-mapping networks, self-healing networks, and more!
- #nagios on irc.freenode.net
- Nagios: System and Network Monitoring, Wolfgang Barth, No Starch Press