Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories


Installing Nagios Core monitoring system (client and server)

Ástþór IPÁstþór IP

nagios-logoNagios Core allows you to monitor your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, it can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers.

The monitoring server

1. Install Nagios Core and dependancies

apt-get install nagios3 nagios-nrpe-plugin

2. Create the admin user

htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

3. Create a host to monitor (pico /etc/nagios3/conf.d/server1.cfg)

define host {
use generic-host
host_name server1
alias server1
address 192.168.1.3
}
define service {
use generic-service
host_name server1
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service {
use generic-service
host_name server1
service_description Current Users
check_command check_users!20!50
}
define service {
use generic-service
host_name server1
service_description Total Processes
check_command check_procs!250!400
}
define service {
use generic-service
host_name server1
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
}

Replace server1 with the actual hostname of the server being monitored and the IP address to correct one.

This configuration will allow you to monitor the disk usage, active users, number of processes and the cpu load of a single server. Configuring host groups and other services are outside the scope of this article.

4. Restart Nagios

/etc/init.d/nagios3 restart

4. Enter the webadmin by opening this location in a web browser: http://yourserver/nagios3

Clients monitored by the monitoring server

1. Install the Nagios NRPE (Nagios Remote Plugin Executor)

apt-get install nagios-nrpe-server

2. Allow the monitoring server to connect to this NRPE (pico /etc/nagios/nrpe.cfg)

allowed_hosts=192.168.1.2

Replace 192.168.1.2 with the IP address of the monitoring server.

NRPE listens for connections on TCP port 5666 so make sure your firewall allows connections to that port from the monitoring server.

3. Restart NRPE

/etc/init.d/nagios-nrpe-server restart

Click the image below to see the results

nagios

Comments 4
  • Brayton Stafford
    Posted on

    Brayton Stafford Brayton Stafford

    Author

    iptables -A INPUT -i eth0 -s IPADDRESSOFREMOTENAGIOSSERVER -p tcp –dport 5666 -j ACCEPT

    This helped me when setting up a Debian server to be monitored by a different machine.


  • Help!
    Posted on

    Help! Help!

    Author

    Processing object config file ‘/etc/nagios3/conf.d/server1.cfg’…
    Error: Invalid host object directive ‘{‘.
    Error: Could not add object property in file ‘/etc/nagios3/conf.d/server1.cfg’ on line 2.
    Error processing object config files!

    ***> One or more problems was encountered while processing the config files…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    errors in config! … failed!
    failed!


  • Kinnow Grower
    Posted on

    Kinnow Grower Kinnow Grower

    Author

    The curly bracket ( { ) after “define host” is reason of error

    define host
    {
    use generic-host
    host_name server1
    alias server1

    Above show the wrong place for Curly bracket

    To correct it

    define host {
    use generic-host
    host_name server1
    alias server1

    Note that the curly bracket is in same line as “define host” NOT the second line

    Try it have FUN 🙂


  • Jeff W
    Posted on

    Jeff W Jeff W

    Author

    What web interface are you using?