Nagios 2.6 Basic Configuration

Overview

Nagios is an application that monitors any device on a network that is addressable. It is easily configured to monitor a servers availability on the network from just simple TCP/IP ping requests, to more advanced service monitors such as http, dns, and telnet. With plugins it can also monitor health status of devices such as CPU load, memory utilizaton and drive usage.

Before nagios can be configured it needs to be installed. That documentation can be found here: Nagios 2.6 Installation on Ubuntu 6.06 Linux


This tutorial will be broken into two halves. First I’ll cover the individual configuration files to get a basic install working. There are many ways to organize these files but I’m only covering the basics. Many of these files will be somewhat self explanatory. The second half will be the step-by-step guide that walks through the process of creating and editing the files.

I’ve included a downloadable file archive of the configuration files used in this tutorial. They would be useful to have for review while going through the tutorial. (Sample Nagios 2.6 Configuration Files)

Configuration Files

Nagios stores it’s configuration settings in text files. The organizaion of these text files is variable depending on your preference but the method described here uses the following files for configuration settings:

  • cgi.cfg
  • commands.cfg
  • contactgroups.cfg
  • contacts.cfg
  • hostgroups.cfg
  • hosts.cfg
  • nagios.cfg
  • resource.cfg
  • services.cfg
  • timeperiods.cfg

cgi.cfg

The cgi.cfg file allows you to modify user permissions and set paths for the nagios system. The excerpt below shows the path where the main nagios configuration file (nagios.cfg) is located.

#################################################################
#
# CGI.CFG - Sample CGI Configuration File for Nagios 2.6
#
# Last Modified: 11-21-2006
#
#################################################################
# MAIN CONFIGURATION FILE
# This tells the CGIs where to find your main configuration file.
# The CGIs will read the main and host config files for any other
# data they might need.

main_config_file=/usr/local/share/nagios/etc/nagios.cfg

commands.cfg

A sample commands.cfg file is installed when you run the configure script. It will contain some basic check commands that nagios can use. In our case we’ll be using the check_host_alive command.

#################################################################################
# SAMPLE HOST CHECK COMMANDS
#################################################################################
# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
# average time to produce a critical error.
# Note: Only one ICMP echo packet is sent (determined by the '-p 1' argument)
# 'check-host-alive' command definition
define command{
command_name    check-host-alive
command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1
}

contactgroups.cfg

A contact group definition is used to group one or more contacts together for the purpose of sending out alert/recovery notifications. When a host or service has a problem or recovers, Nagios will find the appropriate contact groups to send notifications to, and notify all contacts in those contact groups.

define contactgroup{
contactgroup_name       admins
alias                   Nagios Administrators
members                 nagios-admin
}

contacts.cfg

A contact definition is used to identify someone who should be contacted in the event of a problem on your network.

define contact{
contact_name                    nagios-admin
alias                           Nagios Admin
service_notification_period     24x7
host_notification_period        24x7
service_notification_options    w,u,c,r
host_notification_options       d,r
service_notification_commands   notify-by-email
host_notification_commands      host-notify-by-email
email                           youremail@mail.com
}

hostgroups.cfg

The hostgroups.cfg file allows you to organize your devices into logical groups like swtiches, firewalls, citrix servers etc… Groups are pretty easy to create. All you need to do is define the group and assign devices. When assigning devices you must use the hostname used in the hosts.cfg file.

define hostgroup{
hostgroup_name  Linux Servers
alias           Linux Servers
members         ZEUS
}

Multiple devices can be added by using “,” (commas) as delimiters for your entries.

define hostgroup{
hostgroup_name  Linux Servers
alias           Linux Servers
members         ZEUS,HADES,POSEIDON
}

hosts.cfg

hosts.cfg contain all the unique information that pertains to a individual host. There are many options that can be configured for hosts. One way to keep your configurations smaller and reduce repetition is by using templates. Templates allow you to set common settings that can be used for multiple hosts.

# Generic host definition template - This is NOT a real host, just a template!
define host{
name                            generic-host    ; The 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
failure_prediction_enabled      1       ; Failure prediction is enabled
process_perf_data               1       ; Process performance data
retain_status_information       1       ; Retain status information across program restarts
retain_nonstatus_information    1       ; Retain non-status information across program restarts
register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

Once your template is setup you can begin adding hosts…

define host{
use                     generic-host            ; Name of host template to use
host_name               ZEUS                   ; Name of device being monitored
alias                   ZEUS                   ; Longer name or description of device
address                 127.0.0.1               ; IP or FQDN of device being monitored
check_command           check-host-alive        ; Short name of command used to check if host is up or down, usually a ping
max_check_attempts      10                      ; Number of reties before an alert is sent
check_period            24x7
notification_interval   120                     ; Time period to wait until re-notifying contacts
notification_period     24x7                    ; Time period where notifications are allowed to be sent
notification_options    d,r
contact_groups          admins                  ; Groups that are notified when notifications are sent
}

nagios.cfg

nagios.cfg holds global configuration options for the nagios application. It also tells nagios what and where to find the other configuration files. In order to make nagios recognize the above list of configuration files, you will need to uncomment their entries in the nagios.cfg file. The following is an excerpt from the nagios.cfg files that shows the section controls what configuration files are used.

# You can split other types of object definitions across several
# config files if you wish (as done here), or keep them all in a
# single config file.

cfg_file=/usr/local/share/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/share/nagios/etc/contacts.cfg
#cfg_file=/usr/local/share/nagios/etc/dependencies.cfg
#cfg_file=/usr/local/share/nagios/etc/escalations.cfg
cfg_file=/usr/local/share/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/share/nagios/etc/hosts.cfg
cfg_file=/usr/local/share/nagios/etc/services.cfg
cfg_file=/usr/local/share/nagios/etc/timeperiods.cfg

resource.cfg

The resource.cfg file is used to define resources external to nagios such as plugins.

services.cfg

A service definition is used to identify a “service” that runs on a host. The term “service” is used very loosely. It can mean an actual service that runs on the host (POP, SMTP, HTTP, etc.) or some other type of metric associated with the host (response to a ping, number of logged in users, free disk space, etc.).

Again, a template is created to set some of the more common options.

# Generic service definition template - This is NOT a real service, just a template!
define service{
name                            generic-service ; The 'name' of this service template
active_checks_enabled           1       ; Active service checks are enabled
passive_checks_enabled          1       ; Passive service checks are enabled/accepted
parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service             1       ; We should obsess over this service (if necessary)
check_freshness                 0       ; Default is to NOT check service 'freshness'
notifications_enabled           1       ; Service notifications are enabled
event_handler_enabled           1       ; Service event handler is enabled
flap_detection_enabled          1       ; Flap detection is enabled
failure_prediction_enabled      1       ; Failure prediction is enabled
process_perf_data               1       ; Process performance data
retain_status_information       1       ; Retain status information across program restarts
retain_nonstatus_information    1       ; Retain non-status information across program restarts
register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}

# Define a service to "ping" a machine
define service{
use                             generic-service         ; Name of service template to use
host_name                       ZEUS
service_description             PING
is_volatile                     0
check_period                    24x7
max_check_attempts              4
normal_check_interval           5
retry_check_interval            1
contact_groups                  admins
notification_options            w,u,c,r
notification_interval           960
notification_period             24x7
check_command                   check_ping!100.0,20%!500.0,60%
}

timeperiods.cfg

The timeperiods.cfg file allows us to set time schedules for nagios to enable or disable checks and notifications.

Configuration Steps

(*note: Commands preceded by a “$” are run as a normal user and commands preceded by a “#” are run as root.)

Logon to your nagios system and change to root privileges.

# root

configuring_nagios_2-6_0.png

Change to the nagios config directory.

# cd /usr/local/share/nagios/etc/

configuring_nagios_2-6_1.png

View a listing of the etc folder contents.

# ls

configuring_nagios_2-6_2.png

The contents should show sample configuration files created when you ran the configuration script during the nagios install.

configuring_nagios_2-6_3.png

Let’s create a folder called backup to store those files in case we need them in the future.

# mkdir backup

configuring_nagios_2-6_4.png

Now we’ll copy all the files to the new backup folder.

# cp *.* backup/

configuring_nagios_2-6_5.png

View the contents of the backup folder to make sure the files made it in there.

# ls backup

configuring_nagios_2-6_6.png

The files are listed in the backup folder.

configuring_nagios_2-6_7.png

Now we can begin the process of configure nagios for our use. We’ll start with the nagios.cfg file by renaming the nagios.cfg-sample file.

# mv nagios.cfg-sample nagios.cfg

configuring_nagios_2-6_8.png

Now let’s open nagios.cfg in the nano editor.

# nano nagios.cfg

configuring_nagios_2-6_9.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/commands.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/commands.cfg

configuring_nagios_2-6_10.png

Find the line

cfg_file=/usr/local/share/nagios/etc/localhost.cfg

and comment it by adding a leading “#” symbol.

#cfg_file=/usr/local/share/nagios/etc/localhost.cfg

configuring_nagios_2-6_11.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/contactgroups.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/contactgroups.cfg

configuring_nagios_2-6_12.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/contacts.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/contacts.cfg

configuring_nagios_2-6_13.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/hostgroups.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/hostgroups.cfg

configuring_nagios_2-6_14.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/hosts.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/hosts.cfg

configuring_nagios_2-6_15.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/services.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/services.cfg

configuring_nagios_2-6_16.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/timeperiods.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/timeperiods.cfg

configuring_nagios_2-6_17.png

Find the line

#cfg_file=/usr/local/share/nagios/etc/resource.cfg

and uncomment it by removing the leading “#” symbol.

cfg_file=/usr/local/share/nagios/etc/resource.cfg

configuring_nagios_2-6_18.png

Save the modifications to nagios.cfg by pressing “ctrl-x” and then “y” to confirm.

configuring_nagios_2-6_19.png

Press “enter” to save the file as the default original name.

configuring_nagios_2-6_20.png

We’ve just configured nagios to be aware of several files. Now, let’s rename the available sample files to the corresponding names set in the nagios.cfg file.

First up is the resourse.cfg file.

# mv resource.cfg-sample resource.cfg

configuring_nagios_2-6_21.png

Next, the commands.cfg file.

# mv commands.cfg-sample commands.cfg

configuring_nagios_2-6_22.png

Now, the cgi.cfg file.

# mv cgi.cfg-sample cgi.cfg

configuring_nagios_2-6_23.png

A listing shows the renamed files.

configuring_nagios_2-6_24.png

Now, we will create the hosts.cfg file.

# nano hosts.cfg

configuring_nagios_2-6_25.png

As you can see, we have a blank editor to work in.

configuring_nagios_2-6_26.png

The easiest way to enter the hosts.cfg information is by pasting it in. I’m using the PuTTY SSH client to access my server. One nice feature is that you can paste text from the clipboard by simply right-clicking. You can find a copy of the hosts.cfg file in the Sample Nagios 2.6 Configuration File

The first definition of the hosts.cfg file will be a template. This template will define common settings that can be applied to individual hosts with the “use” entry.

configuring_nagios_2-6_27.png

For this tutorial we are setting up nagios to monitor one host, the nagios server itself. Most of the default settings in the host.cfg file are acceptable to get us up and running. All we need to edit is the “host_name” and “alias” to be the name of our nagios server. In my case the server is named “ZEUS”.

configuring_nagios_2-6_28.png

I’ve entereed ZEUS as the host_name.

configuring_nagios_2-6_29.png

I also went ahead and entered ZEUS for the alias as well. The address is the IP address of the device you are monitoring.

The process of adding more hosts is easy. All you need to do in the hosts.cfg file is duplicate the “define host” section for each host your are monitoring.

configuring_nagios_2-6_30.png

Press “ctrl-x” to exit and press “y” to save your changes.

configuring_nagios_2-6_31.png

Press enter to save with the default name of hosts.cfg.

configuring_nagios_2-6_32.png

Next, we will create the hostgroups.cfg file.

# nano hostgroups.cfg

configuring_nagios_2-6_34.png

Here is our blank editor waiting for us to paste the configuration information. You can find the hostgroups.cfg file in the Sample Nagios 2.6 Configuration Files

configuring_nagios_2-6_35.png

Here is a typical hostgroup entry name Linux Servers. I’ll be putting the nagios server in this group.

configuring_nagios_2-6_36.png

It’s simple to add a host to a group. Just type the name of the host next to the members entry. If you wanted to add multiple hosts to a group you would simply enter each host name separating them by commas.

configuring_nagios_2-6_37.png

Exit and save the changes.

configuring_nagios_2-6_38.png

Save the file as hostgroups.cfg

configuring_nagios_2-6_39.png

Next, we’ll create the services.cfg file.

# nano services.cfg

configuring_nagios_2-6_41.png

Once, again we have a blank editor to past the services configuration in. The services.cfg file can be found in the Sample Nagios 2.6 Configuration Files

configuring_nagios_2-6_42.png

The first definition of the services.cfg file is a template similar to the template in the hosts.cfg file.

configuring_nagios_2-6_43.png

The next definition in the services.cfg file defines the check command and what host to apply it to, as well as other custom options. For our purposes we only need to enter the correct host name. You can change some of these settings to suit your needs but I’d recommend not changing them until you have a working system.

configuring_nagios_2-6_44.png

Exit and save.

configuring_nagios_2-6_45.png

Save the file as services.cfg

configuring_nagios_2-6_46.png

Next up is the contacts.cfg file.

# nano contacts.cfg

configuring_nagios_2-6_48.png

Again, we have a blank editor to paste the contacts.cfg sample into.

configuring_nagios_2-6_49.png

This file will need to have the email address modified if you plan on getting email notifications.

configuring_nagios_2-6_50.png

Exit and save.

configuring_nagios_2-6_51.png

Save the file as contacts.cfg

configuring_nagios_2-6_52.png

The next file we create will be contactgroups.cfg

# nano contactgroups.cfg

configuring_nagios_2-6_54.png

Again we have a blank editor.

configuring_nagios_2-6_55.png

Paste in the sample contactgroups.cfg file.

configuring_nagios_2-6_56.png

Exit and save the file as contactgroups.cfg

configuring_nagios_2-6_57.png

Last, we will create the timeperiods.cfg file.

# nano timeperiods.cfg

configuring_nagios_2-6_58.png

Blank editor.

configuring_nagios_2-6_59.png

Paste in the sample timeperiods.cfg file. As with any of the configuration files we’ve created, it is completely customizable. However, I recommend that you leave it as is until you get nagios functioning… then tweak as much as you’d like.

configuring_nagios_2-6_60.png

Exit and save the file.

configuring_nagios_2-6_61.png

Save it as timeperiods.cfg

configuring_nagios_2-6_62.png

Now let’s use nagios to verify the structure of your configuration files. With any luck we will have zero errors. In the case of an error, nagios will attempt to direct you to the location of the error.

We will tell nagios to verify the nagios.cfg configuration.

# ../bin/nagios -v nagios.cfg

configuring_nagios_2-6_64.png

We didn’t get any errors and can proceed to starting nagios.

configuring_nagios_2-6_65.png

Let’s start nagios… or in my case restart nagios.

The command to start is:

# /etc/init.d/nagios start

The command to kill and restart nagios is:

# /etc/init.d/nagios restart

Take your pick.

configuring_nagios_2-6_66.png

We didn’t get any errors other that nagios not being able kill the nagios process before starting… why? because it wasn’t running.

configuring_nagios_2-6_67.png

Now that nagios is running, let’s open a web browser and access the nagios web interface.

If you followed the previous tutorial you should be prompted with a login box.

configuring_nagios_2-6_68.png

configuring_nagios_2-6_69.png

After entering your username and password, you will be directed to the nagios home page.

configuring_nagios_2-6_70.png

Click on “Host Detail” in the left navigation bar. We’ve gotten a permissions error and will have to modify the cgi.cfg file.

configuring_nagios_2-6_71.png

Return back to the nagios configuration directory.

configuring_nagios_2-6_72.png

Web interface permissions are stored in the cgi.cfg file so we’ll edit that and grant ourselves access.

# nano cgi.cfg

configuring_nagios_2-6_73.png

We’ll edit several permissions settings to grant ourselves more control.

Locate the line:

authorized_for_system_information

Make sure you add your username to the list of users like in the image below.

configuring_nagios_2-6_74.png

Next add your username to the line

authorized_for_configuration_information

configuring_nagios_2-6_75.png

Next add your username to the line

authorized_for_system_commands

configuring_nagios_2-6_76.png

Next add your username to the line

authorized_for_all_services

configuring_nagios_2-6_77.png

Next add your username to the line

authorized_for_all_hosts

configuring_nagios_2-6_78.png

Next add your username to the line

authorized_for_all_service_commands

configuring_nagios_2-6_79.png

Next add your username to the line

authorized_for_all_host_commands

configuring_nagios_2-6_80.png

Exit and save.

configuring_nagios_2-6_81.png

Make sure to save the file as cgi.cfg

configuring_nagios_2-6_82.png

Return to the web interface and try the “Host Detail” link again. This time you should see the Host Status Details for your monitored host(s). Click on the host name of your nagios server. In my case that would be ZEUS.

configuring_nagios_2-6_84.png

You will be directed to the status page for that host. Notice how there isn’t any status information available. That’s because nagios hasn’t had time to do it’s scheduled check for this host.

configuring_nagios_2-6_85.png

Click on “Scheduling Queue” in the left navigation.

configuring_nagios_2-6_86.png

You should get a page the lists all devices currently queued for checks along with the time of the last check and the time of the next check.

configuring_nagios_2-6_86.png

Notice how I have about a minute to wait before nagios checks this host.

configuring_nagios_2-6_87.png

configuring_nagios_2-6_88.png

Now that nagios has checked the host the status has changed from pending to green/up which indicates that the host is alive and healthy.

configuring_nagios_2-6_89.png

configuring_nagios_2-6_90.png

Credits

Nagios:
http://www.nagios.org

Nagios Documentation:
http://nagios.sourceforge.net/docs/2_0/

Tags: , ,

55 Comments so far »

  1. Baron said,

    Wrote on May 31, 2007 @ 10:01 am

    Once again great job! Gives people a very nice roadmap to work with. My one question is that is there any snmp configuration AND where do you set the mail server for notifications?

  2. Mark said,

    Wrote on May 31, 2007 @ 1:41 pm

    @ Baron

    There are plugins that will enable snmp checks. There are other options to snmp depending on what you want to accomplish. I’ll probably write up some tutorials in the future on more advanced configurations. You can download tons of plugins at http://www.nagiosexchange.org

    You’ll need to install a mail package like postfix and adjust the notification commands in the commands.cfg file. There are some sample notification entries at the bottom of that file. You’ll have to change the paths to point to the mail agent. ie. /usr/bin/mail

  3. Gavin said,

    Wrote on June 7, 2007 @ 5:16 pm

    Hi,

    the install and configure tutorials are excellent. I have installed on Ubuntu 7.04 workstation, using Nagios 2.9 and 1.4.9 plugins.

    Thanks

    ps

    typo in second command

    cd /user/local/share/nagios/etc/

    Should be

    cd /usr/local/share/nagios/etc/

  4. apt said,

    Wrote on June 7, 2007 @ 8:19 pm

    great job.. no problem found using debian etch + nagios 2.9… now im working with nrpe…

  5. Mark said,

    Wrote on June 8, 2007 @ 6:26 am

    @ Gavin,

    Thanks for letting me know about the typo. I’ve made the corrections.

  6. raket said,

    Wrote on June 11, 2007 @ 10:26 am

    Thank you very much for the great documentation, At the moment im writing Slackware-based documentation in pdf-format. Will post url when im done.

  7. Rob said,

    Wrote on June 21, 2007 @ 2:11 am

    Excellent guide once again. Thanks heaps as this has really got me going. If you were interested in making another guide a SNMP doc would be very cool. Thanks again - these guides are the best.

  8. Mark said,

    Wrote on June 21, 2007 @ 8:20 am

    I’m planning on writing up a howto for using NSClient++ to get host resource information into nagios. I don’t really have a timeframe for this at the moment however.

  9. sarah said,

    Wrote on June 22, 2007 @ 2:59 am

    hi!
    Thanks for this doc, it’s very clear!
    I have a problem when i try to execute a cgi from the web interface… i can’t see why it doesn’t work, it says that: The server encountered an internal error or misconfiguration and was unable to complete your request.

    Do you see from what this problem can come?
    thanks again for your help

  10. Will said,

    Wrote on July 2, 2007 @ 11:46 am

    Hello
    I have problem with

    debian:/usr/local/share/nagios/etc# ../bin/nagios -v nagios.cfg

    Nagios 2.6
    Copyright (c) 1999-2006 Ethan Galstad (http://www.nagios.org) Last Modified: 11-27-2006
    License: GPL

    Reading configuration data…

    Running pre-flight check on configuration data…

    Checking services…
    Error: Check period ‘24×7′ specified for service ‘PING’ on host ‘router’ is not defined anywhere!
    Error: Notification period ‘24×7′ specified for service ‘PING’ on host ‘router’ is not defined anywhere!
    Checked 1 services.
    Checking hosts…
    Error: Check period ‘24×7′ specified for host ‘router’ is not defined anywhere!
    Error: Notification period ‘24×7′ specified for host ‘router’ is not defined anywhere!
    Checked 1 hosts.
    Checking host groups…
    Checked 1 host groups.
    Checking service groups…
    Checked 0 service groups.
    Checking contacts…
    Error: Service notification period ‘24×7′ specified for contact ‘nagios-admin’ is not defined anywhere!
    Error: Host notification period ‘24×7′ specified for contact ‘nagios-admin’ is not defined anywhere!
    Checked 1 contacts.
    Checking contact groups…
    Checked 1 contact groups.
    Checking service escalations…
    Checked 0 service escalations.
    Checking service dependencies…
    Checked 0 service dependencies.
    Checking host escalations…
    Checked 0 host escalations.
    Checking host dependencies…
    Checked 0 host dependencies.
    Checking commands…
    Checked 22 commands.
    Checking time periods…
    Checked 1 time periods.
    Checking extended host info definitions…
    Checked 0 extended host info definitions.
    Checking extended service info definitions…
    Checked 0 extended service info definitions.
    Checking for circular paths between hosts…
    Checking for circular host and service dependencies…
    Checking global event handlers…
    Checking obsessive compulsive processor commands…
    Checking misc settings…

    Total Warnings: 0
    Total Errors: 6

    ***> One or more problems was encountered while running the pre-flight check…

    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.

    debian:/usr/local/share/nagios/etc#

    can you help me? please…
    Thanks’

  11. Mark said,

    Wrote on July 2, 2007 @ 12:23 pm

    @ Will

    Make sure you’ve uncommented the entry for “timeperiods.cfg” in nagios.cfg and that the file timeperiods.cfg exists and is spelled correctly.

  12. Will said,

    Wrote on July 2, 2007 @ 1:13 pm

    @Mark
    Yes, i review all configuration and is ok, timeperiods.cfg is uncommented in nagios.cfg, this file exists and is spelled correctly
    This my configuration on timeperiods.cfg

    # ‘workhours’ timeperiod definition
    define timeperiod{
    timeperiod_name workhours
    alias “Normal” Working Hours
    monday 00:00-23:59
    tuesday 00:00-23:59
    tuesday 00:00-23:59
    wednesday 00:00-23:59
    thursday 00:00-23:59
    friday 00:00-23:59
    saturday 00:00-23:59
    sunday 00:00-23:59
    }

  13. Mark said,

    Wrote on July 2, 2007 @ 2:39 pm

    @Will

    The error you posted indicates that nagios can’t find a check period named “24×7″. By looking at your timeperiods file you posted you are missing the 24×7 period that is called in the other config files. Below is a full copy of the timeperiods.cfg file used in this tutorial. If you want to modify your timeperiods.cfg file you will have to also sort through the other config files where the 24×7 period is referenced. (i.e. services.cfg hosts.cfg and contacts.cfg)

    #################################

    # This defines a timeperiod where all times are valid for checks,
    # notifications, etc. The classic “24×7″ support nightmare. :-)

    define timeperiod{
    timeperiod_name 24×7
    alias 24 Hours A Day, 7 Days A Week
    sunday 00:00-24:00
    monday 00:00-24:00
    tuesday 00:00-24:00
    wednesday 00:00-24:00
    thursday 00:00-24:00
    friday 00:00-24:00
    saturday 00:00-24:00
    }

    # ‘workhours’ timeperiod definition
    define timeperiod{
    timeperiod_name workhours
    alias “Normal” Working Hours
    monday 09:00-17:00
    tuesday 09:00-17:00
    wednesday 09:00-17:00
    thursday 09:00-17:00
    friday 09:00-17:00
    }

    # ‘none’ timeperiod definition
    define timeperiod{
    timeperiod_name none
    alias No Time Is A Good Time
    }

  14. Will said,

    Wrote on July 2, 2007 @ 3:27 pm

    Thanks for all Mark
    It all ok

  15. Will said,

    Wrote on July 4, 2007 @ 10:43 am

    Hi, i don’t undertand with Status WARNING, the RTA=350 ms, can you help me?

  16. BJ said,

    Wrote on July 20, 2007 @ 12:21 am

    Thanks for a fantastic tutorial, I tried to set Nagios up using guides from a few other site’s without success, but using yours I was able to get Nagios up and running fist time.

    Could you give a brief tutorial on using NSClient++ for monitoring windows machines.

    Thanks again.

    BJ

  17. 7echno7im said,

    Wrote on July 24, 2007 @ 11:26 am

    Found another typo, sorry its very tiny, but in your sample hosts.cfg, you have

    max_check_attempts 10 ; Number of reties before an alert is sent

    “retries” it should be

  18. 7echno7im said,

    Wrote on July 24, 2007 @ 11:29 am

    i know you said when adding another host it is as easy as just adding another line in hosts.cfg called “define host” but after adding one and waiting, it keeps saying that my host is “pending” and has not been checked yet. I know it is something simple but not sure what it is. I followed you guide to the T Everything on here is great. Thank you so much!

  19. 7echno7im said,

    Wrote on July 25, 2007 @ 7:55 am

    Agreed, anyone know of a NSClient++ Windows guide?

    post here if you do
    http://www.techtronic.us

  20. Mark said,

    Wrote on August 10, 2007 @ 10:20 am

    @7echno7im

    Have you sorted out your “pending” host problem yet. You will also need to add the hostname to one of the service checks listed in the services.cfg file.

    I am stalled with the NSClient++ guide at the moment. I’m considering finding a real content management system to organize my tutorials. The image management features of this blog are horrible and the size of these tutorials doesn’t really work well with a blog style layout.

  21. Mark said,

    Wrote on August 10, 2007 @ 10:21 am

    @Will

    The WARNING, the RTA=350 ms is simply warning you that the ping latency test times are coming back higher than the pre-set warning level…. ie. slow pings

  22. bonivasius BD said,

    Wrote on August 16, 2007 @ 2:33 am

    nice .. nice..
    all done to me in ubuntu 6.0 and 7.04
    just follow step by step.. its works…

    thanks….
    Boni

  23. Chris Hu said,

    Wrote on August 30, 2007 @ 8:46 am

    I followed all the steps but the nagios server that we added in the last step shows as being down. How can this be when this is the server nagios runs off of. I also get this in even log

    [08-30-2007 12:44:59] Warning: Return code of 127 for check of service ‘PING’ on host ‘UBUNTU’ was out of bounds. Make sure the plugin you’re trying to run actually exists.

  24. fahami said,

    Wrote on November 13, 2007 @ 10:06 am

    it was realy help ful
    but I got the problem in end.
    I Have succesfully installed & configured
    But in the web interface it is showing u hav no permission
    even after changing the cgi.cfg file

  25. cingular ringtones spainsh said,

    Wrote on February 15, 2008 @ 8:29 am

    download verizon ringtones download info remember ringtones verizon…

    The main thing about make mp3 ringtones polyphonic ringtones for sony ericsson…

  26. kusuma said,

    Wrote on February 18, 2008 @ 11:34 pm

    hi!
    Thanks for this doc, it’s very clear!
    I have a problem when i try to execute a cgi from the web interface… i can’t see why it doesn’t work, it says that: The server encountered an internal error or misconfiguration and was unable to complete your request.

    Do you see from what this problem can come?
    thanks again for your help

  27. bingo cards sliding markers said,

    Wrote on February 28, 2008 @ 5:53 pm

    bingo cards sliding markers…

    meteoritic nurture?Amanda southeast …

  28. free cingular ringtones and graphic free ringtones from cingular said,

    Wrote on March 7, 2008 @ 6:51 am

    free real ringtones for alltel…

    Quite free motorola polyphonic ringtones computer download free ringtones…

  29. free cash advance with credit card said,

    Wrote on March 7, 2008 @ 8:55 am

    nextel mp3 ringtones i730 mp3 nextel ringtones mp3 nextel ringtones…

    It cash advance service cell free phone ringtones sprint…

  30. convert info mp3 remember ringtones convert mp3 file to ringtones said,

    Wrote on March 7, 2008 @ 8:57 am

    cell phone ringtones game wallpaper…

    Pay download free metro pcs ringtones cash advance from credit card…

  31. advance advance america cash center advance america cash advance advance america cash said,

    Wrote on March 7, 2008 @ 9:01 am

    pay day cash advance advance cash day loan pay advance cash cheap day pay…

    That approval instant loan payday advance cash day loan pay payday…

  32. cell phone prepaid ringtones said,

    Wrote on March 7, 2008 @ 9:04 am

    cricket wireless ringtones…

    Each ericsson polyphonic ringtones sony ringtones for nokia phone…

  33. casino no deposit bonus code no deposit casino bonus best no deposit bonus casino said,

    Wrote on March 8, 2008 @ 9:27 am

    best gambling online roulette online roulette gambling…

    Just play for fun online slots free deuces wild video poker…

  34. descargar juego poker gratis said,

    Wrote on March 8, 2008 @ 10:20 am

    juegos poker erotico…

    Ilamar online poker test texas holdem download…

  35. streap poker gratis said,

    Wrote on March 8, 2008 @ 11:13 am

    game on line poker…

    One of five card stud virtual poker…

  36. strip poker live poker live said,

    Wrote on March 8, 2008 @ 12:01 pm

    giochi carte…

    Alcuni texas holdem online gratis gioco texas holdem…

  37. euro casino said,

    Wrote on March 11, 2008 @ 4:42 am

    giochi black jack in linea…

    In play free keno internet gambling…

  38. giocare roulette giocare a roulette giocare alla roulette said,

    Wrote on March 11, 2008 @ 5:05 am

    risposte eurobarre casino on net…

    Gentile risposte eurobarre casino on net noleggio video poker…

  39. sistemi per la roulette said,

    Wrote on March 11, 2008 @ 5:07 am

    casino games gratis…

    Manche fun roulette online online kasinopoker…

  40. pcs ringtones sprint vision said,

    Wrote on March 11, 2008 @ 5:38 am

    download free info remember ringtones sprint download free info remember ringtones verizon…

    Hi ringtones for verizon wireless phone cingular cell phone ringtones…

  41. Sanjay More said,

    Wrote on March 12, 2008 @ 5:37 am

    I have installed Nagios 2.10 on CENTOS 5
    Testing with sample configuration as disccused here.
    But getting junk output in right frame.

    What could be the reason?

    Thanking in anticipation.

    Regards,

    Sanjay

  42. dave said,

    Wrote on March 13, 2008 @ 12:13 pm

    great documentation.. just wondering if you have documentation on setting up snmp on linux/windows servers to be monitored by nagios.

    great job!!

  43. big bookie campus confession shot said,

    Wrote on March 22, 2008 @ 9:12 am

    big bookie campus confession shot…

    pacification scribbler Palestine….

  44. automobile insurance in texas said,

    Wrote on March 23, 2008 @ 7:23 pm

    automobile insurance in texas…

    spectrophotometry opening:Cezanne …

  45. cna life ins said,

    Wrote on May 19, 2008 @ 2:54 pm

    cna life ins…

    aboriginal lifeguard smashes Elvis.heresy …

  46. Hostilio said,

    Wrote on May 27, 2008 @ 3:00 am

    Hi,

    I have configure sucessfull Nagios, but I have one question: How i can create a map of my network??

    Regards,
    Hostílio Thumbo

  47. best on line casino said,

    Wrote on June 18, 2008 @ 9:10 pm

    best on line casino…

    Italians?lobsters,jazzy deceasing …

  48. poker money said,

    Wrote on July 13, 2008 @ 8:20 pm

    Hi, I really apreciated this website! Thanks

  49. captain cook casino said,

    Wrote on July 14, 2008 @ 1:46 pm

    captain cook casino…

    priorities averages denominations Crockett Hetman victimizer …

  50. home title insurance in pittsburgh pa said,

    Wrote on July 17, 2008 @ 10:11 am

    home title insurance in pittsburgh pa…

    washers triumphed!degrees traps,pompous burn …

  51. shocking roulette game said,

    Wrote on July 27, 2008 @ 12:26 am

    shocking roulette game…

    stratifications relocating puzzling tasting intuitive …

  52. giochi di poker hold`em gratis said,

    Wrote on August 2, 2008 @ 3:43 pm

    giochi di poker hold`em gratis…

    showers Alfonso hackneyed Wabash!super authorizers …

  53. quotes on auto insurance said,

    Wrote on August 2, 2008 @ 6:08 pm

    quotes on auto insurance…

    Falklands nakedness conjoined?restructure Robinsonville …

  54. homeowners insurance claims cancellation said,

    Wrote on August 4, 2008 @ 4:32 am

    homeowners insurance claims cancellation…

    docked ripe hydro soldierly …

  55. Prashant Kamat said,

    Wrote on August 7, 2008 @ 1:15 am

    I have installed CentOS 5.0 & Nagios 2.12, following is the error:

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

    Nagios 2.12
    Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
    Last Modified: 05-19-2008
    License: GPL

    Reading configuration data…

    Running pre-flight check on configuration data…

    Checking services…
    Checked 20 services.
    Checking hosts…
    Checked 8 hosts.
    Checking host groups…
    Checked 1 host groups.
    Checking service groups…
    Checked 0 service groups.
    Checking contacts…
    Error: Service notification command ‘notify-by-email’ specified for contact ‘prashant’ is not defined anywhere!
    Error: Host notification command ‘host-notify-by-email’ specified for contact ‘prashant’ is not defined anywhere!
    Checked 1 contacts.
    Checking contact groups…
    Checked 1 contact groups.
    Checking service escalations…
    Checked 0 service escalations.
    Checking service dependencies…
    Checked 0 service dependencies.
    Checking host escalations…
    Checked 0 host escalations.
    Checking host dependencies…
    Checked 0 host dependencies.
    Checking commands…
    Checked 22 commands.
    Checking time periods…
    Checked 4 time periods.
    Checking extended host info definitions…
    Checked 8 extended host info definitions.
    Checking extended service info definitions…
    Checked 0 extended service info definitions.
    Checking for circular paths between hosts…
    Checking for circular host and service dependencies…
    Checking global event handlers…
    Checking obsessive compulsive processor commands…
    Checking misc settings…

    Total Warnings: 0
    Total Errors: 2

    ***> One or more problems was encountered while running the pre-flight check…

    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.

    KINDLY PROVIDE ME A SOLUTION

    please find my CFG files for your kind reference:
    contacts.cfg
    define contact{
    contact_name prashant
    alias Nagios Admin
    service_notification_period 24×7
    host_notification_period 24×7
    service_notification_options w,u,c,r
    host_notification_options d,u,r
    service_notification_commands notify-by-email
    host_notification_commands host-notify-by-email
    email prashant@kaizentransit.com
    }

    contactgroups.cfg
    define contactgroup{
    contactgroup_name linux-admins
    alias Linux Administrators
    members prashant
    }

    hosts.cfg
    define host{
    host_name 172.xx.xx.1
    alias IND-Linux-HA-01
    address 172.xx.xx.1
    contact_groups linux-admins
    check_command check-host-alive
    max_check_attempts 10
    notification_interval 120
    notification_period 24×7
    notification_options d,u,r
    }

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment:

Recent Entries