Professional Documents
Culture Documents
Nagios at a glance
Nagios configuration
Checks and their execution
Advanced configurations
ISSNSM’2008, Zurich
Introduction
Nagios at a glance
Nagios configuration
Checks and their execution
Advanced configurations
Introduction
Nagios at a glance
Key concepts
Functional architecture
Services and service states
Nagios configuration
Object definitions
Other elements
Example scenario
Checks and their execution
Local checks
Remote checks
Advanced configurations
Conclusions
Laurent Andrey, Rémi Badonnel An Introduction to Monitoring with Nagios 2/32
Introduction
Nagios at a glance
References
Nagios configuration
Motivations
Checks and their execution
Advanced configurations
References
W. Barth.
Nagios, System and Network Monitoring.
Open Source Press GmbH, first edition, 2006.
ISBN: 1-59327-070-4.
Introduction
Nagios at a glance
References
Nagios configuration
Motivations
Checks and their execution
Advanced configurations
Key concepts
Introduction
Nagios at a glance Key concepts
Nagios configuration Functional architecture
Checks and their execution Services and service states
Advanced configurations
Functional architecture
log
Notification System
Filters, Contact Delivery
NAGIOS
Architecture at run-time
Introduction
Nagios at a glance Key concepts
Nagios configuration Functional architecture
Checks and their execution Services and service states
Advanced configurations
Service
Service delivered by a software
Percentage of free space on a partition
Bandwith usage on a network interface ...
Service check
Provides state information on a service
Returns a value: OK, WARNING, CRITICAL (exit status 0, 1,
2), UNKNOWN (exit status 3, due to time out or plugin
runtime trouble) to reflect the Nagios view about this service
Can be local (OS calls) or remote (ICMP, NRPE, SNMP ...)
Is implemented by a plugin (external command/script)
Service states
Introduction
Nagios at a glance Key concepts
Nagios configuration Functional architecture
Checks and their execution Services and service states
Advanced configurations
Introduction
Nagios at a glance Key concepts
Nagios configuration Functional architecture
Checks and their execution Services and service states
Advanced configurations
Nagios configuration
Object-oriented representation
A nagios object describes a specific unit: a service, an host, a
contact, a contactgroup ... with attributes and values
kind of inheritance mechanisms, dependencies amongst objets
Set of configuration files
Main file: nagios.cfg (ref. to other cfg. files)
1 file per object type: services.cfg, hosts.cfg, contacts.cfg,
checkcommands.cfg, misccommands.cfg, timeperiods.cfg ...
Requires an a priori knowledge
Configuration can also stand into a database
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
Host
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
Example scenario
dnsext webloria
http://www.loria.fr
152.81.144.14 152.81.144.22
152.81.144.0/20
cat-481 Internet
152.81.0.0/20
hosts.cfg
define host {
host name webloria
alias w e b l o r i a l i n u x machine
address 152.81.144.22
check command check −h o s t − a l i v e
max check attempts 3
check period 24 x7
notification interval 180 # 3 hours
notification period 24 x7
notification options d,r ,f ,u
# down , r e c o v e r y , f l a p p i n g , u n r e a c h a b l e
contact groups administrators
}
Laurent Andrey, Rémi Badonnel An Introduction to Monitoring with Nagios 17/32
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
services.cfg
define service {
host name webloria
service description http s e r v i c e
check command check http
max check attempts 3
normal check interval 5
retry check interval 1
check period 24 x7
notification interval 180
notification period 24 x7
notification options w, c , r , f , u
# warning , c r i t i c a l , r e c o v e r y , flapping , unreachable
contact groups administrators
}
Laurent Andrey, Rémi Badonnel An Introduction to Monitoring with Nagios 18/32
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
checkcommands.cfg
d e f i n e command{
command name check −h o s t − a l i v e
command line $USER1$/ c h e c k i c m p −H $HOSTADDRESS$
}
d e f i n e command{
command name check http
command line $USER1$/ c h e c k h t t p −H $HOSTADDRESS$
}
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
services.cfg
define service {
host name dnsext
service description dns s e r v i c e
check command check name for given dns
!www. l o r i a . f r ! 1 5 2 . 8 1 . 1 4 4 . 2 2
max check attempts 3
normal check interval 5
retry check interval 1
check period 24 x7
notification interval 180
notification period 24 x7
notification options w, c , r , f , u
contact groups administrators
}
Laurent Andrey, Rémi Badonnel An Introduction to Monitoring with Nagios 20/32
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
checkcommands.cfg
d e f i n e command{
command name c h e c k n a m e f o r g i v e n d n s
c o m m a n d l i n e $USER1$/ c h e c k d n s −H $ARG1$ −a $ARG2$
−s $HOSTADDRESS$
# $ARG1$ : f u l l y q u a l i f i e d name
# $ARG2$ : IP a d d r e s s
}
Introduction
Nagios at a glance Object definitions
Nagios configuration Other elements
Checks and their execution Example scenario
Advanced configurations
contacts.cfg
define contact {
contact name andrey
alias l a u r e n t andrey
service notification period 24 x7
host notification period 24 x7
service notification options w, u , c , r
host notification options d, r
service notification commands n o t i f y −by−e m a i l
host notification commands h o s t −n o t i f y −by−e m a i l
email andrey@loria . fr
}
contacts.cfg
define contactgroup {
contactgroup name administrators
alias group of a d m i n i s t r a t o r s
members andrey
}
Introduction
Nagios at a glance
Local checks
Nagios configuration
Remote checks
Checks and their execution
Advanced configurations
Local checks
Introduction
Nagios at a glance
Local checks
Nagios configuration
Remote checks
Checks and their execution
Advanced configurations
NAGIOS CLIENT
sshd
(daemon)
check_by_ssh (plugin)
check_xyz
NETWORK
(plugin)
priv.key pub.key
NAGIOS CLIENT
nrpe (daemon)
n
check_nrpe (plugin) tcp connectio ref1 check_xyz arg1 arg2
ref2 check_abc arg3 arg4
ref ... ...
NETWORK
check_xyz
(plugin)
Introduction
Nagios at a glance
Local checks
Nagios configuration
Remote checks
Checks and their execution
Advanced configurations
Introduction
Nagios at a glance
Making configuration more simple
Nagios configuration
Specifying Dependencies
Checks and their execution
Advanced configurations
define hostgroup{
hostgroup name dns hosts
alias h o s t s s u p p o r t i n g DNS
members dns1 , d n s 2 , d n s e x t
}
define service{
hostgroup name dns hosts
service description dns s e r v i c e
check command check name for given dns
!www . l o r i a . f r ! 1 5 2 . 8 1 . 1 4 4 . 2 2
max check attempts 3
normal check interval 5
retry check interval 1
check period 24 x7
notification interval 180
notification period 24 x7
notification options w, c , r , f , u
contact groups administrators
}
Specifying dependencies
Introduction
Nagios at a glance
Making configuration more simple
Nagios configuration
Specifying Dependencies
Checks and their execution
Advanced configurations
Conclusions