Цитата: Phantom.s от 17 Октябрь 2011, 15:42:41
Если честно, то лазил по nagios.cfg, и не нашел кода, который по умолчанию подключает файлы из нужной директории (или искал плохо).
Вероятно, дело в этом. Должна быть строка типа cfg_dir=/etc/nagios3/conf.d.
Добавил строки. Выглядит теперь таким образом:
##############################################################################
#
# NAGIOS.CFG - Sample Main Config File for Nagios
#
#
##############################################################################
# LOG FILE
# This is the main log file where service and host events are logged
# for historical purposes. This should be the first option specified
# in the config file!!!
log_file=/var/log/nagios3/nagios.log
# Commands definitions
cfg_file=/etc/nagios3/commands.cfg
# Debian also defaults to using the check commands defined by the debian
# nagios-plugins package
cfg_dir=/etc/nagios-plugins/config
# Debian uses by default a configuration directory where nagios3-common,
# other packages and the local admin can dump or link configuration
# files into.
cfg_dir=/etc/nagios3/conf.d
# OBJECT CONFIGURATION FILE(S)
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.
# You can specify individual object config files as shown below:
#cfg_file=/etc/nagios3/objects/commands.cfg
#cfg_file=/etc/nagios3/objects/contacts.cfg
#cfg_file=/etc/nagios3/objects/timeperiods.cfg
#cfg_file=/etc/nagios3/objects/templates.cfg
# Definitions for monitoring a Windows machine
#cfg_file=/etc/nagios3/objects/windows.cfg
# Definitions for monitoring a router/switch
cfg_file=/etc/nagios3/objects/switch.cfg
# Definitions for monitoring a network printer
#cfg_file=/etc/nagios3/objects/printer.cfg
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
#cfg_dir=/etc/nagios3/servers
#cfg_dir=/etc/nagios3/printers
cfg_dir=/etc/nagios3/switches
cfg_dir=/etc/nagios3/routers
# OBJECT CACHE FILE
# This option determines where object definitions are cached when
# Nagios starts/restarts. The CGIs read object definitions from
# this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts.
object_cache_file=/var/cache/nagios3/objects.cache
# PRE-CACHED OBJECT FILE
# This options determines the location of the precached object file.
# If you run Nagios with the -p command line option, it will preprocess
# your object configuration file(s) and write the cached config to this
# file. You can then start Nagios with the -u option to have it read
# object definitions from this precached file, rather than the standard
# object configuration files (see the cfg_file and cfg_dir options above).
# Using a precached object file can speed up the time needed to (re)start
# the Nagios process if you've got a large and/or complex configuration.
# Read the documentation section on optimizing Nagios to find our more
# about how this feature works.
precached_object_file=/var/lib/nagios3/objects.precache
# RESOURCE FILE
# This is an optional resource file that contains $USERx$ macro
# definitions. Multiple resource files can be specified by using
# multiple resource_file definitions. The CGIs will not attempt to
# read the contents of resource files, so information that is
# considered to be sensitive (usernames, passwords, etc) can be
# defined as macros in this file and restrictive permissions (600)
# can be placed on this file.
resource_file=/etc/nagios3/resource.cfg
# STATUS FILE
# This is where the current status of all monitored services and
# hosts is stored. Its contents are read and processed by the CGIs.
# The contents of the status file are deleted every time Nagios
# restarts.
status_file=/var/cache/nagios3/status.dat
# STATUS FILE UPDATE INTERVAL
# This option determines the frequency (in seconds) that
# Nagios will periodically dump program, host, and
# service status data.
status_update_interval=10
Сделай nagios3 -v /etc/nagios3/nagios.cfg, серьёзных ошибок там нет (раз запустился), но может выдать предупреждения, заодно покажет количество найденных им в конфиге хостов, сервисов, пользователей, хостгрупп и пр.
Сделал, вот что выдало
phantom@VMUbuntu:~$ nagios3 -v /etc/nagios3/nagios.cfg
Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open resource file '/etc/nagios3/resource.cfg' for reading!
Error in configuration file '/etc/nagios3/nagios.cfg' - Line 469 (Check result path is not a valid directory)
Error processing main config file!
***> 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.
Файл '/ etc/nagios3/resource.cfg открывается но только под root, в противном случае, ругается, что неизвестный формат файла. Вот содержимое конфига:
RESOURCE.CFG - Resource File for Nagios
#
# You can define $USERx$ macros in this file, which can in turn be used
# in command definitions in your host config file(s). $USERx$ macros are
# useful for storing sensitive information such as usernames, passwords,
# etc. They are also handy for specifying the path to plugins and
# event handlers - if you decide to move the plugins or event handlers to
# a different directory in the future, you can just update one or two
# $USERx$ macros, instead of modifying a lot of command definitions.
#
# The CGIs will not attempt to read the contents of resource files, so
# you can set restrictive permissions (600 or 660) on them.
#
# Nagios supports up to 32 $USERx$ macros ($USER1$ through $USER32$)
#
# Resource files may also be used to store configuration directives for
# external data sources like MySQL...
#
###########################################################################
# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/lib/nagios/plugins
# Sets $USER2$ to be the path to event handlers
#$USER2$=/usr/lib/nagios/plugins/eventhandlers
# Store some usernames and passwords (hidden from the CGIs)
#$USER3$=someuser
#$USER4$=somepassword
Через веб-интерфейс когда в нагиос просматриваю группы, то ни группа switches, ни группа my-work-mashine там не отображаются. Вот и возникает мысль, может я где-то не прописал или не зарегистрировал эти группы?

Подскажите пожалуйста, как это можно проверить и исправить.