[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4140
  • Last Modified:

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 (nagios@nagios.org)
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]#
0
pdiblasi
Asked:
pdiblasi
  • 3
1 Solution
 
pjedmondCommented:
You haven't set up any services yet.

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

http://nagios.sourceforge.net/docs/1_0/installweb.html

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

HTH:)
0
 
pjedmondCommented:
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 127.0.0.1 (or localhost was the only ip allowed in the default configuration.

HTH:)
0
 
pjedmondCommented:
And...:

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:

contacts.cfg
hostgroups.cfg
services.cfg
contactgroups.cfg

Again - all in the /etc/nagios directory.

Minimal hosts.cfg:

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

        host_name               printer1
        alias                   Printer #1
        address                 192.168.1.100
        check_command           check-host-alive
        max_check_attempts      10
        notification_interval   480
        notification_period     workhours
        }
-------8X------------

Minimal contact.cfg:
-------8X------------
# '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
        }
-------8X------------

Minimal services.cfg:
------8X-------------
# 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!
        }
---------8X-----------------

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

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

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?

HTH:)
0
 
In_Ness_EE01Commented:
Hi Venabili,

I am still getting the same error.
errors:
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 nithish.jgk@gmail.com.

Thanks in advance.
Jayaraj

0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now