Форум русскоязычного сообщества Ubuntu


Считаете, что Ubuntu недостаточно дружелюбна к новичкам?
Помогите создать новое Руководство для новичков!

Автор Тема: Nagios 3 установка\настройка  (Прочитано 51399 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #120 : 17 Октября 2011, 16:22:11 »
Если честно, то лазил по nagios.cfg, и не нашел кода, который по умолчанию подключает файлы из нужной директории (или искал плохо).
Вероятно, дело в этом. Должна быть строка типа cfg_dir=/etc/nagios3/conf.d.
Сделай nagios3 -v /etc/nagios3/nagios.cfg, серьёзных ошибок там нет (раз запустился), но может выдать предупреждения, заодно покажет количество найденных им в конфиге хостов, сервисов, пользователей, хостгрупп и пр.

Документация: http://nagios.sourceforge.net/docs/nagioscore/3/en/toc.html
Справка по главному конфигу: http://nagios.sourceforge.net/docs/nagioscore/3/en/configmain.html

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #121 : 18 Октября 2011, 09:05:52 »
Цитировать
Цитата: 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 там не отображаются. Вот и возникает мысль, может я где-то не прописал или не зарегистрировал эти группы?  :-\ Подскажите пожалуйста,  как это можно проверить и исправить.
« Последнее редактирование: 18 Октября 2011, 10:55:50 от Phantom.s »

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #122 : 18 Октября 2011, 10:50:26 »
Посмотри права на файл /etc/nagios3/resource.cfg, пользователь nagios должен иметь право на чтение.
Если что, то chmod +r /etc/nagios3/resource.cfg

И вообще, нагиос-то работает? Сейчас показывает какие-нибудь хосты, или там только "Whoops!"?

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #123 : 18 Октября 2011, 11:07:38 »
права на чтение и запись юзеру нагиос дал.

Нагиос работает. показывает только localhost и gateway. Прописал заодно в файл hostgroups_nagios2.cfg нужные группы. перезапустил. без изменений.

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #124 : 18 Октября 2011, 11:15:13 »
выхлоп nagios3 -v /etc/nagios3/nagios.cfg не изменился? или права и были?

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #125 : 18 Октября 2011, 11:24:16 »
прав не было. добавил. но результат тот же:
phantom@VMUbuntu:~$ nagios3 -v /etc/nagios3/nagios.cfd

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 main configuration file '/etc/nagios3/nagios.cfd' for reading!
   Error processing main config file!



***> The name of the main configuration file looks suspicious...

     Make sure you are specifying the name of the MAIN configuration file on
     the command line and not the name of another configuration file.  The
     main configuration file is typically '/usr/local/nagios/etc/nagios.cfg'

***> 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.



Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #126 : 18 Октября 2011, 13:08:33 »
Внимательнее.
Результат совсем не тот же.
nagios3 -v /etc/nagios3/nagios.cfd

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #127 : 18 Октября 2011, 14:51:21 »
Извиняюсь.
Вот тут для  nagios3 -v /ect/nagios3/nagios.cfg
phantom@VMUbuntu:~$ nagios3 -v /ect/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 main configuration file '/ect/nagios3/nagios.cfg' for reading!
   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.

nagios3 -v /ect/nagios3/nagios.cfd
phantom@VMUbuntu:~$ nagios3 -v /ect/nagios3/nagios.cfd

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 main configuration file '/ect/nagios3/nagios.cfd' for reading!
   Error processing main config file!



***> The name of the main configuration file looks suspicious...

     Make sure you are specifying the name of the MAIN configuration file on
     the command line and not the name of another configuration file.  The
     main configuration file is typically '/usr/local/nagios/etc/nagios.cfg'

***> 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.
« Последнее редактирование: 18 Октября 2011, 15:37:17 от Phantom.s »

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #128 : 18 Октября 2011, 14:58:07 »
Час от часу не легче. Ты мою внимательность тренируешь?..
nagios3 -v /ect/nagios3/nagios.cfg

Чтобы не ошибаться — пользуйся автодополнением, жми в терминале Tab.
« Последнее редактирование: 18 Октября 2011, 15:01:46 от Дмитрий Бо »

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #129 : 18 Октября 2011, 15:40:13 »
исправил предыдущий пост. там 2 варианта и для cfd и cfg. Разница в них лишь та, что один не находит файл (и оно логично), а второй находит ошибки

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #130 : 18 Октября 2011, 16:24:26 »
Я вижу два варианта:
/ect/nagios3/nagios.cfg
/ect/nagios3/nagios.cfd
А должно быть:
/etc/nagios3/nagios.cfg

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #131 : 18 Октября 2011, 16:39:40 »
спасибо. совсем мозг кипит. элементарных вещей не замечаю. вот результат nagios3 -v /etc/nagios3/nagios.cfg
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 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.

вот проблемный участок кода конфига, 469 линия - check_result_path=/var/lib/nagios3/spool/checkresults
# MAX CHECK RESULT REAPER TIME
# This is the max amount of time (in seconds) that  a single
# check result reaper event will be allowed to run before
# returning control back to Nagios so it can perform other
# duties.

max_check_result_reaper_time=30




# CHECK RESULT PATH
# This is directory where Nagios stores the results of host and
# service checks that have not yet been processed.
#
# Note: Make sure that only one instance of Nagios has access
# to this directory! 

check_result_path=/var/lib/nagios3/spool/checkresults




# MAX CHECK RESULT FILE AGE
# This option determines the maximum age (in seconds) which check
# result files are considered to be valid.  Files older than this
# threshold will be mercilessly deleted without further processing.

max_check_result_file_age=3600
« Последнее редактирование: 18 Октября 2011, 16:52:14 от Phantom.s »

Оффлайн Дмитрий Бо

  • Погонщик серверов
  • Модератор раздела
  • Старожил
  • *
  • Сообщений: 3549
  • Я не техподдержка, я за порядком слежу
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #132 : 18 Октября 2011, 17:18:14 »
Цитировать
вот проблемный участок кода конфига, 469 линия - check_result_path=/var/lib/nagios3/spool/checkresults
Иии?.. Есть такая директория? Есть права записи в неё у пользователя nagios?

Оффлайн Phantom.s

  • Новичок
  • *
  • Сообщений: 25
    • Просмотр профиля
Re: Nagios 3 установка\настройка
« Ответ #133 : 18 Октября 2011, 17:30:58 »
да. директория имеется. данная папка пуста. Создатель nagios. Естественно, что у него полный доступ к созданию и редактированию файлов.
Продолжаю склоняться к тому, что вся проблема в незарегистрированных группах хостов и свичей. Как можно это проверить и, возможно, исправить?
« Последнее редактирование: 19 Октября 2011, 15:41:45 от Phantom.s »

Оффлайн Frank

  • Старожил
  • *
  • Сообщений: 1799
  • Профессиональный любитель
    • Просмотр профиля
    • Народный форум Николаева
Re: Nagios 3 установка\настройка
« Ответ #134 : 20 Октября 2011, 13:35:55 »
Показывайте ls -ld /var/lib/nagios3/spool/checkresults

 

Страница сгенерирована за 0.019 секунд. Запросов: 22.