Nagios Monitoring Service Setup

Source: Internet
Author: User
Tags disk usage

Introduction

This are intended to provide if you have simple instructions on how to install Nagios from source (code) on Ubuntu and H Ave It monitoring your local machine inside of minutes. No Advanced installation Options is discussed here-just the basics that would work for 95% of the users who want to get star Re ".

These instructions should work with the most recent vesrions of Ubuntu with minor changes on some versions.

What are you ' ll End up with

If you follow these instructions, here's what you'll end up with:

    • Nagios and the plugins would be installed Underneath/usr/local/nagios
    • Nagios would be configured to monitor a few aspects of your local system (CPU load, disk usage, etc)
    • The Nagios Web interface is accessible at http://localhost/nagios/
Required Packages

Make sure you ' ve installed the following packages on your Ubuntu installation before continuing.

    • Autoconf
    • Apache 2
    • Php
    • GCC Compiler and development libraries
    • GD Development Libraries
    • Unzip

You can use apt-get to install these packages by running the following commands:

sudo apt-get install autoconf gcc libc6 build-essential BC gawk DC gettext Libmcrypt-dev Libssl-dev make unzip apache2 APA Che2-utils php5 Libgd2-xpm-dev
1) Create account information

Become the root user.

Sudo-s

Create a new nagios user account and give it a password.

/usr/sbin/useradd-m-s/bin/bash nagiospasswd Nagios

You'll need to also add a nagios group (if it's not created by default).

/usr/sbin/groupadd nagios/usr/sbin/usermod-g Nagios Nagios

Create a new nagcmd Group for allowing external commands to be submitted through the Web interface. Add both the Nagios user and the Apache user to the group.

/usr/sbin/groupadd nagcmd/usr/sbin/usermod-a-G nagcmd nagios/usr/sbin/usermod-a-G nagcmd www-data
2) Download Nagios and the Plugins

Create a directory for storing the downloads.

mkdir ~/DOWNLOADSCD ~/downloads

Download the source code tarballs of both Nagios Core and the Nagios plugins (visit https://www.nagios.org/download/for l Inks to the latest versions). These directions were tested with Nagios 4.2.4 and Nagios Plugins 2.1.4.

wget Http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.2.4.tar.gzwget/HTTP Prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-2.2.1.tar.gz
3) Compile and Install Nagios Core

Extract the Nagios Core source code tarball.

CD ~/downloadstar XZF NAGIOS-4.2.4.TAR.GZCD nagios-4.2.4

Run The Nagios configure script, passing the name of the group created earlier, and pointing to the correct Apache con Figuration directory, like so:

./configure--with-command-group=nagcmd--with-httpd-conf=/etc/apache2/sites-enabled

Compile the Nagios Core source code.

Make all

Install binaries, init script, sample config files and set permissions on the external command directory.

Make Installmake install-initmake install-configmake install-commandmodeupdate-rc.d nagios Defaults

Don ' t start Nagios Core Yet-there ' s still more this needs to being done ...

4) Customize Configuration

Sample configuration files has now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios Core. You'll need just one change before you proceed ...

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email ad Dress associated with the nagiosadmin contact definition to the address of you ' d like to use for receiving alerts.

Vi/usr/local/nagios/etc/objects/contacts.cfg
5) Configure the Web Interface

Install the Nagios Core Web Config file in the Apache conf.d directory.

Make Install-webconfa2enmod rewritea2enmod CGI

Create a nagiosadmin account for logging into the Nagios Core Web interface. Remember The password you assign to this account-you ' ll need it later.

Htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin

Restart Apache to make the new settings take effect.

UFW Allow APACHEUFW Reload

Note:consider implementing the Ehanced CGI security measures described here to ensure that your Web authentication Creden Tials is not compromised.

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

CD ~/downloadstar XZF NAGIOS-PLUGINS-2.2.1.TAR.GZCD nagios-plugins-2.2.1

Compile and install the plugins.

./configuremakemake Install
7) Start Nagios Core

Verify the sample Nagios Core configuration files.

/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

If There is no errors, start Nagios Core.

Systemctl Start Nagios.service
8) Login to the Web Interface

You should now is able to access the Nagios Core Web interface at the URL below. You'll be prompted to the username (nagiosadmin) and password you specified earlier.

http://localhost/nagios/

Click on the "Service Detail" NavBar link to see details of the "s being monitored on your local machine. It'll take a few minutes for Nagios Core to check all the services associated with your machine, as the checks is Sprea D out over time.

9) Other modifications

If you are want to receive e-mail notifications for Nagios Core alerts, your need to install the MAILX (Postfix) package.

sudo apt-get install mailxsudo apt-get install Postfix

You'll have to edit the Nagios Core e-mail notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any '/bin/mail ' references to '/usr/bin/mail '. Once you don't have need to restart Nagios Core to make the configuration changes live.

sudo systemctl restart Nagios.service

Configuring email Notifications is outside the scope of this documentation. Refer to your system documentation, search the Web, or look to the Nagios support Portal or Nagios Community Wiki for spec IFIC instructions on configuring your Ubuntu system to send mail messages to external addresses.

Ten) you ' re done

congratulations! You sucessfully installed Nagios Core. Your journey to monitoring is just beginning. You'll no doubt want to monitor more than just your local machine, so check out the following docs ...

    • Monitoring Windows Machines
    • Monitoring Linux/unix Machines
    • Monitoring Netware Servers
    • Monitoring Routers/switches
    • Monitoring publicly available services (HTTP, FTP, SSH, etc)

Nagios Monitoring Service Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.