Eric Mislivec - Getting Started With Nagios Core

Download as odp, pdf, or txt
Download as odp, pdf, or txt
You are on page 1of 40

Getting Started with Nagios Core

Eric Mislivec
[email protected]
The Plan


What is Nagios Core?

Features & Benefits

Architecture

Installation & Configuration

Resources & Support

Get Involved

Questions
What is...


The Standard in Open Source IT Monitoring

15+ years

A monitoring and alerting engine

Why we're here
Comprehensive Monitoring

A few 'Nagiosable' things
– System metrics

– Service status
– Applications
– Network devices

???
– “There's a check for that.”

Network / logical hierarchy
Visibility
Alerting & Awareness


Multiple methods

email, SMS, ...

Customizable

Targetable

Escalations for multi-user setups

Schedule downtime, avoid false alerts
Problem Remediation


Acknowledge problems online

Event handlers for automation
Reporting
Extendable Architecture


List of 'objects' to monitor

Schedule of things to do

Run checks, other commands

Other work as requested
Objects


Hosts & Host Groups

Services & Service Groups

Contacts & Contact Groups

Commands

Time Periods

Notification Escalations

Notification and Execution Dependencies
Checks


Active

Initiated by Nagios process

Regularly scheduled

On demand

Passive

Initiated externally

Results sent to Core
Formats & APIs


Configurable commands

Plugin / check result format

Performance data

External commands

Query handler

Check results spool

CGIs, now with JSON
NEBs


Nagios Event Broker Modules

Loaded into Core on startup

Hook into key steps

Can override or cancel some

Examples

Distribute checks: mod_gearman

Export data: NDOUtils
That's Nice, but...

...how do I get started?


Installation - 'Soft' Requirements


UNIX OS: Linux, BSD, OS X, Solaris, AIX, …

C compiler & development tools

Web server, PHP, gd (CGIs)


Network access
Installation - 'Hard' Requirements

General Monitoring
Minimum Recommended
Processor 1 GHz 2 GHz+
Memory 512 MB 1 GB+
Storage 512 MB 2 GB+

...or a Raspberry Pi...


Depends on rate and type of checks
Installation - Before We Begin...

WARNING: Comand Line Follows!


It doesn't last forever

Let's install Core on CentOS 6.5 Minimal


Installation - Prerequisites

# Install dependencies for Core and popular plugins


yum install -y autoconf automake gcc glibc glibc-common make wget \
fping bind-utils net-snmp net-snmp-utils perl-Net-SNMP samba-client \
openssl-devel openssh-devel mysql-devel gettext gd gd-devel httpd php

# Setup users and groups


groupadd nagcmd
useradd nagios -s /sbin/nologin -M -d /usr/local/nagios/ -U -G nagcmd
usermod -a -G nagcmd apache
usermod -a -G nagios apache
Installation - Nagios Plugins

Official collection of common plugins
– nagios-plugins.org

# Get the Nagios Plugins source code


cd /tmp
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
tar xzvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
# Build and install the plugins
./tools/setup
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make && make install
Installation - Nagios Core
# Get the Nagios Core source code
cd /tmp
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
tar xzvf nagios-4.0.8.tar.gz
cd nagios-4.0.8

# Build and Install Nagios Core


./configure --with-command-group=nagcmd --with-nagios-group=nagios
make all
make install install-init
make install-config
make install-commandmode
make install-webconf

# Setup credentials for accessing the web backend.


sudo -u nagios htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Installation - System Setup
# SELinux is enforcing by default on CentOS. Disable it for this example.
setenforce 0

# Open up ports for HTTP. We use -I to insert the new rules at the head of
# the INPUT chain; -A adds them at the tail, possibly after a REJECT rule.
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
service iptables save

# Now (re)start our services to use the new configuration.


service httpd restart
service nagios start

# Have our services start automatically.


chkconfig nagios on
chkconfig httpd on
Installation - Try It Out
Installation - Try It Out
Anatomy of an Installation


/usr/local/nagios/

bin/ - Nagios Core binaries

etc/ - Configuration files

libexec/ - Plugins, event handlers, cmds

sbin/ - CGI binaries

share/ - Web UI files

var/ - Runtime files, data, logs
etc/nagios.cfg

General program settings

File paths

NEBs to load

Loading other configuration
# You can specify individual config files:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg

# Configuration for multiple hosts:


cfg_dir=/usr/local/nagios/etc/hosts
Configuration Basics


Basic format
define someobjecttype {
some_variable Some text
another_variable 1234
}
A Partial Template Example

Template
define host {
check_command check-host-alive
notification_options d,u,r
max_check_attempts 5
name host_template
register 0
}


Host
define host {
use host_template
host_name example-host
alias Partial Host Example
host_address 127.0.0.1
}
A Real Host Template

define host {
name generic-host ; Name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Keep status info across restarts
retain_nonstatus_information 1 ; Keep non-status info across restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; Don't register, this is a template!
}
More configuration

Where to from here?

Sample config: etc/

Experiment

Core Manual
nagios.sourceforge.net/docs/nagioscore/4/
en/toc.html
Nagios Exchange
exchange.nagios.org
Nagios Library
library.nagios.com
General Support Forum
support.nagios.com/forum
Professional Support Contracts

www.nagios.com/services/support
Additional Solutions & Services

Preconfigured VMs
www.nagios.org/download/core

Consulting / Implementation Services


[email protected]
Additional Services

Training
go.nagios.org/training

Certification
www.nagios.com/services/certification
Nagios XI
nagios.com/products/nagiosxi
Get Involved


Learn, share and help on the forums
support.nagios.com/forum

Share on Exchange
exchange.nagios.org

We're on GitHub
github.com/NagiosEnterprises
github.com/NagiosEnterprises/nagioscore
Summary


Enables comprehensive monitoring

Awarness, visibility, resolution, reporting

Extensible architecture

Installation

Introduction to configuration concepts

Where to find more resources

How to contribute
Questions?
Thank You
Eric Mislivec
[email protected]

You might also like