Error: There are no services defined!

I install and configured nagios and everything I try to start it I receive this error message.

[root@localhost etc]# nagios -v nagios.cfg

Nagios 1.2
Copyright (c) 1999-2004 Ethan Galstad (
Last Modified: 02-02-2004
License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...
Error: There are no services defined!
        Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
        Checked 0 hosts.
Checking host groups...
Error: There are no host groups defined!
        Checked 0 host groups.
Checking contacts...
Error: There are no contacts defined!
        Checked 0 contacts.
Checking contact groups...
Error: There are no contact groups defined!

        Checked 0 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking host group escalations...
        Checked 0 host group 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 0 commands.
Checking time periods...
        Checked 0 time periods.
Checking for circular paths between hosts...
Checking for circular service execution dependencies...
Checking global event handlers...
Checking obsessive compulsive service processor command...
Checking misc settings...
Warning: Nothing specified for illegal_macro_output_chars variable!

Total Warnings: 1
Total Errors:   5

***> 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 on the main and host config files, as well as the
     'Whats New' section to find out what has changed.

[root@localhost etc]#
Who is Participating?
pjedmondConnect With a Mentor Commented:
You haven't set up any services yet.

The easiest way is to do that through the web interface:

Once that's done, then everything is reasonably intuitive!

Worth noting that the directory for nagios web interface may be /usr/share/nagios rather than /usr/local/nagios

Also it may be that your rpm has automatically installed the nagios web interface - for mine - 1.4:

Other 'tweaks' that I needed to carry out to get the web interface running:

1. chown -R apache.apache /usr/share/nagios to give the web server permission to access a few things.
2. mdified the /etc/httpd/conf.d/nagios.conf to add my ip to the list of ips allowed to access the interface as (or localhost was the only ip allowed in the default configuration.


1. chown -R apache.apache /usr/lib/nagios/cgi to give the web server permission to access a few things.
2. *temporaritly* change the use_authentication setting to 0. This *DISABLES* authentication whilst you are sorting out the configuration.

Once that has been done, you can click on the View Configuration (after selecting the area you want info from) on the left hand side and see what has been selected from a configuration perspective.

In your case your /etc/nagios/hosts.cfg is either empty or does not exist. Same applies for:


Again - all in the /etc/nagios directory.

Minimal hosts.cfg:

# 'printer1' host definition
define host{
        use                     generic-host            ; Name of host template to use

        host_name               printer1
        alias                   Printer #1
        check_command           check-host-alive
        max_check_attempts      10
        notification_interval   480
        notification_period     workhours

Minimal contact.cfg:
# 'nagios' contact definition
define contact{
        contact_name                    nagios
        alias                           Nagios Admin
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_commands   notify-by-email,notify-by-epager
        host_notification_commands      host-notify-by-email,host-notify-by-epager
        email                           nagios-admin@localhost.localdomain
        pager                           pagenagios-admin@localhost.localdomain

Minimal services.cfg:
# Generic service definition template
define service{
        name                            generic-service ; The 'name' of this service template, referenced in other service definitions
        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
        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!

Minimal contactgroups.cfg:
# 'novell-admins' contact group definition
define contactgroup{
        contactgroup_name       novell-admins
        alias                   Novell Administrators
        members                 nagios

Minimal hostgroups.cfg:
# 'novell-servers' host group definition
define hostgroup{
        hostgroup_name  novell-servers
        alias           Novell Servers
        contact_groups  novell-admins
        members         novell1,novell2

You could try creating these files and sticking in the above minimal files in an effort to get nagios to start, but I suspect that you might be better off carrying out a complete reinstall?

Hi Venabili,

I am still getting the same error.
1. There are no services defined
2. there are no hosts defined
3. checked 0 hosts group
4. check 0 service group

all other are fine detecting as 1 contact group checked.

Please help in this early. Please email the solution to

Thanks in advance.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.