Nagios PDF
Nagios PDF
Nagios PDF
Sebastian Buettrich
PacNOG 6
Nadi, Fiji
Introduction
Installation
In Debian/Ubuntu 9.04 and up
http://localhost/nagios3/
Installation
Configuration
orsuch
Nagios Configuration
Nagios Configuration
In Nagios, essentially everything is
Objects with many relations between
them.
Objects can be:
Hosts, services, contacts, plugins,
dependencies (e.g. parent-child),
escalations, time periods, ...
Remembertorestartinorderforchangesto
show:
#/etc/init.d/nagios3reload
generichost
;Inheritdefaultvaluesfromatemplate
host_name
remotehost
;Thenamewe'regivingtothishost
alias
SomeRemoteHost
;Alongernameassociatedwiththehost
address
192.168.1.50
;IPaddressofthehost
hostgroups
}
all
;Hostgroupsthishostisassociatedwith
service_notifications_enabled
service_notification_period24x7
host_notification_period24x7
service_notification_optionsw,u,c,r
host_notification_optionsd,u,r
service_notification_commandsnotifyservicebyemail
host_notification_commandsnotifyhostbyemail
email
pager
address1
homehood7
address2
2200cphn
can_submit_commands 1
}
Features
Features cont.
Features cont.
CRITICAL
WARNING
UNKNOWN
Event handlers
Parameters
Re-check interval
DOWN
UNREACHABLE
Network Viewpoint
Configuration Files
Located in /etc/nagios3/
Important files include:
cgi.cfg
Controls the web
interface and security options.
commands.cfg The commands that
Nagios uses for notifications.
nagios.cfg
conf.d/*
goes here!
Configuration Files
Under conf.d/*
(sample only)
contacts_nagios3.cfg
generic-host_nagios2.cfg
default host template
generic-service_nagios2.cfg
default service template
hostgroups_nagios2.cfg
groups of nodes
services_nagios2.cfg
what services to check
timeperiods_nagios2.cfg
when to check and who to notify
Configuration Files
Under conf.d some other possible configfiles:
host-gateway.cfg
extinfo.cfg
servicegroups.cfig
localhost.cfg
pcs.cfg
switches.cfg
routers.cfg
Plugins Configuration
The Nagios package in Ubuntu comes with a bunch of
pre-installed plugins:
apt.cfg
breeze.cfg dhcp.cfg
disk-smb.cfg
disk.cfg
dns.cfg
dummy.cfg
flexlm.cfg
fping.cfg
ftp.cfg
games.cfg
hppjd.cfg http.cfg
ifstatus.cfg ldap.cfg
load.cfg mail.cfg
mrtg.cfg
mysql.cfg
netware.cfg news.cfg
nt.cfg
ntp.cfg
pgsql.cfg ping.cfg
procs.cfg
radius.cfg
real.cfg
rpc-nfs.cfg snmp.cfg ssh.cfg
tcp_udp.cfg
telnet.cfg users.cfg vsz.cfg
CGI Configuration
Archivo: /etc/nagios3/cgi.cfg
authorized_for_system_information
authorized_for_configuration_information
authorized_for_system_commands
authorized_for_all_services
authorized_for_all_hosts
authorized_for_all_service_commands
authorized_for_all_host_commands
Time Periods
This defines the base periods that
control checks, notifications, etc.
Defaults: 24 x 7
# '24x7'
# '24x7'
define
timeperiod{
define timeperiod_name
timeperiod{
24x7
timeperiod_name24
24x7
alias
Hours A Day, 7 Days A Week
alias
24
Hours A Day, 7 Days A Week
sunday
00:00-24:00
sunday
00:00-24:00
monday
00:00-24:00
monday
00:00-24:00
tuesday
00:00-24:00
tuesday
00:00-24:00
wednesday
00:00-24:00
wednesday
00:00-24:00
thursday
00:00-24:00
thursday
00:00-24:00
friday
00:00-24:00
friday
00:00-24:00
saturday
00:00-24:00
00:00-24:00
} saturday
}
Notification Commands
Allows you to utilize any command you wish. We'll do
this for generating tickets in RT.
# 'notify-by-email' command definition
define command{
command_name
notify-by-email
command_line
/usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost:
$HOSTNAME$\nIn: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
$SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $SHORTDATETIME$" | /bin/mail
-s '$NOTIFICATIONTYPE$: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$'
$CONTACTEMAIL$
}
From: [email protected]
To:
grupo-redes@localdomain
Subject: Host DOWN alert for switch1!
Date:
Thu, 29 Jun 2006 15:13:30 -0700
Host: switch1
In: Core_Switches
State: DOWN
Address: 111.222.333.444
Date/Time: 06-29-2006 15:13:30
Info: CRITICAL - Plugin timed out after 6 seconds
generic node
generic service
generic contact
define
definehost{
host{
use
use
host_name
host_name
alias
alias
address
address
parents
parents
contact_groups
contact_groups
}}
generic-host
generic-host
switch1
switch1
Core_switches
Core_switches
192.168.1.2
192.168.1.2
router1
router1
switch_group
switch_group
generic-service
1generic-service
11
11
1
0
10
11
11
11
11
1
0
24x7 0
524x7
55
5 1
1
60
60
24x7
24x7c,r
0c,r
0
switch1
switch1
generic-service
generic-service
PING
PING
check-host-alive
check-host-alive
5
5
5
5
c,r,f
c,r,f
switch-group
switch-group
Mensajes a Beepers/SMS
A Few References
http://www.nagios.org
Nagios web site
http://sourceforge.net/projects/nagiosplug
Nagios plugins site
Nagios. System and Network Monitoring by
Wolfgang Barth. Good book about Nagios
http://www.nagiosexchange.org
Unofficial Nagios plugin site
http://www.debianhelp.co.uk/nagios.htm
A Debian tutorial on Nagios
http://www.nagios.com/
Commercial Nagios support