LinuxForum.Fans
Тема

Средство мониторинга Nagios (настройка)

Автор: Bokas 78 сообщений 35154 просмотров
#70002

Bokas
У меня старая версия NSclient++ 0.3.7-win32.msi, но сути не меняет, подпарвьте у себя строки согласно рекомендации, а именно:

text
# ALLOWED HOST ADDRESSES

В этом блоке вообще ничего не раскоментировать! Точнее - закоментировать всё!

text
# USE THIS FILE

А в этом указать нормально IP сервера Nagios, а не набор сетей smile

Кстати, можете модефицировать мой конфиг под свои параметры, указав пароль свой и IP адрес и подсунуть его себе wink

#70003

ОК. Сейчас все сделаю заново, исправлю конфиг, отпишу.

#70005

Bokas
Главное не забывайте после каждого исправления, делать релоад сервисов wink

#70140

Все тоже самое :( , Конфиг брал аналогичный, даже менял версию на 0.3.7, Меня смущает вот что, когда запускаю в тестовом режиме nsclient , то в консоли куча ошибок (я приводил выше вывод логов), причем не зависимо от смены конфига или версии клиента. Вот кусок

text
 \PDHCollector.cpp(140) Failed to open performance counters: \??Y?(_total)\Y?Y?
: PdhAddCounter failed: The specified object is not found on the system.   (C000
0BB8)
d \NRPEListener.cpp(121) Starting NRPE socket...
d \PDHCollector.cpp(176) We aparently failed to load counters trying to use defa
ult (English) counters or those configured in nsc.ini
e \PDHCollector.cpp(185) Failed to open performance counters: \Memory\Commit Lim
it: PdhAddCounter failed: The specified object is not found on the system.   (C0
000BB8)
e \PDHCollector.cpp(219) No performance counters were found we will not wait for
 the end instead...

ЗЫ ... и не забывал перезапускать клиента и сервер :-) (nagios сервер)

#70142

Bokas
Это ошибки того что не получается считать параметры, ну там винт, память- это пока не нужно. Запускайте ваершарк и смотрите, что именно срезает подключение. В данный момент даже сравнить мне не с чем, Нагиос на работе, давайте подождём до понедельника, пока полистайте инструкцию по настройке, вообще странно.
Так что до понедельника:
1. Инструкция по настройки
2. Ваершарк на слежку.
wink

#71046

смотрел пакеты wireshark- ом , немного поэксперементировал, вообщем при стандартном конфиге, если не раскоментировать порт 12489, то пакеты с nagios сервера идут на клиента , но в ответ тишина . как эксперемент раскоментил порт 5666 и закоментил 12489 , ситуация такая как и с 12489, но на этот раз клиент отвечает, но пакеты скорее всего не несут необходимой инфы , на мониторе nagios --Warning! Could not fetch .... ит д , горит желтый. В предыдущем случаи Connection time out

#71052

Bokas
Ну наконец то:

но на этот раз клиент отвечает, но пакеты скорее всего не несут необходимой инфы , на мониторе nagios --Warning! Could not fetch .... ит д , горит желтый.

Вот так и оставьте, у Вас схватились сервер и клиент, просто клиент не передаёт информацию о себе на сервер (Варнинг, это не ошибка, а предупреждение).
Надеюсь Вы плагины под Nagios на сервере ставили и NRPE? Если не доставьте. Теперь далее в клиенте Вам нужно включить поддержку NRPE, для этого лучше переустановить клиент, при установки (по моему на втором шаге) у Вас появится окно, что ставить, пройдитесь по всем вкладкам и сделайте включить всё, ставить абсолютно всё. На данном этапе у Вас клиент из себя представляет только поддержку NSclient сервисов, но для полной работы ему ещё нужно и поддержка NRPE. Такто доставляйте пакеты на сервер и переставляйте клиента на клинат машинах с полной установкой. Потом тестируйте, если что подсунте мой конфиг, он как раз настроен на проверку NRPE. wink

#71054

ОК попробую , вечером отпишусь

#73417

Вообщем перепробовал все что можно, проблема осталось прежней , т е клиент отвечает но не шлет необходимой информации на сервер, вследствии чего сообщение Warning No data was received from host! или could not fetch information from server . Также при запуске debug nsclient++ (т е в тестовом режиме), много ошибок похожих на то что некоторые службы не запущены. Пожалуйста выложите свой дебаг , оч хочу посмотреть .
И самое интерсное что практически рядом стоит машина с WinXP и все работатет как часы

#73548

Что бы не создавать тему.
Nagios поставил, кинулся к шаблону windows.cfg Он должен быть, если верить конфигу, в /etc/nagios3/objects/ Но у меня нет такой папки. Все вроде поставил что надо. Система Debian Squeeze.

Разобрался. Папку самому делать надо, а шаблоны лежат в /usr/share/doc/nagios3-common/example/template-object/

#73554
xlin написал:
в /etc/nagios3/objects/ Но у меня нет такой папки.

В Убунту и я так предполагаю в Дебиан, путь иной к папкам, воспользуйтесь поиском. У меня знакомый то же на Убунту поставил, долго искал, там система по какой то неизвестной причине, располагает файлы Nagios по другим путям. На вскидку могу сказать, вроде в /usr она прячет, более точный путь смогу сказать только когда попаду на работу.

#73576

step_slim, Спасибо, я уже нашел. Теперь пробую как добавить виндузовую тачку и снять с нее все что возможно. :D

З.Ы. Все как то запутано, не ужели нельзя все было сделать проще. Завтра припрусь после работы и дальше тестить буду. Хочу на сервак поставить.

З.Ы. А машины с win98 можно будет подключать? У меня много таких.

#73583

xlin

Теперь пробую как добавить виндузовую тачку и снять с нее все что возможно. big_smile

Посмотрите выше по теме, есть ссылки на инструкцию.

З.Ы. Все как то запутано, не ужели нельзя все было сделать проще.

На самом деле всё просто, один раз вникнуть, потом вообще всё просто и даже сверх удобно, я сейчас zabbix тестирую, вот там всё запутанно. Но всё же, всё изучаемо smile

Хочу на сервак поставить.

Хорошая мысль, очень удобно, проверено. Кстати, а почему на Дебиан? Религия?? :P

З.Ы. А машины с win98 можно будет подключать? У меня много таких.

Хоть Вынь95, а так же принтеры, свичи, маршрутизаторы- но у каждого есть свой нюанс, нужно читать в документации.

#73818
step_slim написал:
Хорошая мысль, очень удобно, проверено. Кстати, а почему на Дебиан? Религия??

Да нет, просто лично мной используется каждый день archlinux. На сервер его как то не кошерно ставить, хотя и справится без проблем. Debian - хз, это скорее мой второй по любимости дистр. Если подумать, то мне без разницы какой.. На любом заведу. Хоть OpenSUSE... Правда там с инетом напряг пока smile

step_slim написал:
Хоть Вынь95, а так же принтеры, свичи, маршрутизаторы- но у каждого есть свой нюанс, нужно читать в документации.

А есть хорошие доки? Хотелось бы мониторить компы, принтеры. А как свитчи не управляемые мониторить? Чет не лезет в голову ничего... у меня почти все на D-link DES-1008D
Да.... а можно ли руссифицировать это дело?

И вообще, у меня тут такой беспорядок что мандец ЦЕНЗУРА!!.... Конь не валялся. Работую вторую неделю, и бегаю от здания к зданию. Досталась же организация ))

#73858

xlin

А есть хорошие доки?

Самые лучшие с которыми сталкивался на сайте разработчика : http://library.nagios.com/

А как свитчи не управляемые мониторить? Чет не лезет в голову ничего... у меня почти все на D-link DES-1008D

Свичи и принтеры мониторятся по snmp при использовании MIB этих устройств.

Да.... а можно ли руссифицировать это дело?

Честно не вижу смысла в этом, если всё настроить, то потом он Вам шлёт сообщения, которые Вы самите можете создать, хоть на китайском, а в графиках вообще не вижу смысла в этом. smile

#73866

Bokas

Вообщем перепробовал все что можно, проблема осталось прежней , т е клиент отвечает но не шлет необходимой информации на сервер,

Смотрите совпадают ли у Вас конфиги шаблона и конфиг клиента, в частности пути. Показывайте созданный Вами шаблон для Win2003. Помоему у Вас просто неверный шаблон на 2003.

Пожалуйста выложите свой дебаг , оч хочу посмотреть .

Сейчас увы не могу, не до него сейчас, просто немного другим занят.

#73886

step_slim, Чет я намудрил с настройками. Nagios ругается на конфиги. Что я сделал. Поставил Nagiosql и импортировал все файлы по порядку. Так нужно делать?

#73889

xlin

Поставил Nagiosql и импортировал все файлы по порядку. Так нужно делать?

Я не связывался с этим приложениям, я использую Нагиос в качестве мониторинга не более, в качестве средства управления не было такой задачи, ибо там можно очень сильно уронить по незнанки или эксперементам управляемый хост.

#87566

Доброго времени суток.

У меня вот такая вот проблема. Имеется сервер на Win2003(RUS) я на него ставлю nsclient, последней версии. Задача снимать значения счетчиков производительности с винды. Если я работаю через консоль на линухе, то:

[console]./check_nrpe -H 172.16.4.3 -p 5666 -c checkCounter -a "Counter:PC=\\Сервер\\Ошибок входа" ShowAll
OK: PC: 11468[/console]

Еслиже я в NSC.ini пишу что-то типа:
[NRPE Client Handlers]

check_counters=inject CheckCounter "Counter:proc=\\Сервер\\Ошибок входа" ShowAll

и тогда:
[console]./check_nrpe -H 172.16.4.3 -c check_counters
I (0.3.8.75 2010-05-27) seem to be doing fine...
[/console]

а в логе на винде(nsclient.log)

text
2010-10-13 13:02:09: debug:NSClient++.cpp:1106: Injecting: check_counters: 
2010-10-13 13:02:09: debug:modules\NRPEClient\NRPEClient.cpp:129: Rewrote command arguments: inject!CheckCounter!Counter:proc=\\Сервер\\Ошибок входа!ShowAll
2010-10-13 13:02:10: debug:modules\NRPEClient\NRPEClient.cpp:245: >>>length: 1036
2010-10-13 13:02:10: debug:modules\NRPEClient\NRPEClient.cpp:249: <<<length: 1036
2010-10-13 13:02:10: debug:NSClient++.cpp:1142: Injected Result: OK 'I (0.3.8.75 2010-05-27) seem to be doing fine...'
2010-10-13 13:02:10: debug:NSClient++.cpp:1143: Injected Performance Result: ''
2010-10-13 13:02:42: debug:modules\NSCAAgent\NSCAThread.cpp:229: Nothing to report, thus not reporting anything...

Почему такая фигня? Почему он дает версию клиента? А не число счетчика, помогите плиз(((((


конфиг NSC.ini

text
[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;  You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; *                                                               *
; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *
; *                                                               *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckWMI.dll
;
; Script to check external scripts and/or internal aliases.
CheckExternalScripts.dll
;
; NSCA Agent if you enable this NSClient++ will talk to NSCA hosts repeatedly (so dont enable unless you want to use NSCA)
NSCAAgent.dll
;
; LUA script module used to write your own "check deamon".
LUAScript.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
RemoteConfiguration.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)
NRPEClient.dll
; Extreamly early beta of a task-schedule checker
CheckTaskSched.dll
text
[Settings]
performance_data=1

;# OBFUSCATED PASSWORD ; This is the same as the password option but here you can store the password in an obfuscated manner. ; *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the ; password. Its just a bit harder to do it at first glance. ;obfuscated_password=Jw0KAUUdXlAAUwASDAAB ; ;# PASSWORD ; This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly. ; password= ; ;# ALLOWED HOST ADDRESSES ; This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons. ; If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password). ; The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that subnet access ;allowed_hosts=172.16.4.6 ; ;# USE THIS FILE ; Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1 ; the registry will be used instead. use_file=1 allowed_hosts=172.16.4.6 password=12489 ; ; # USE SHARED MEMORY CHANNELS ; This is the "new" way for using the system tray based on an IPC framework on top shared memmory channels and events. ; It is brand new and (probably has bugs) so dont enable this unless for testing! ; If set to 1 shared channels will be created and system tray icons created and such and such... ;shared_session=0

text
[log]
;# LOG DEBUG
;  Set to 1 if you want debug message printed in the log file (debug messages are always printed to stdout when run with -test)
debug=1
;
;# LOG FILE
;  The file to print log statements to
file=nsclient.log
;
;# LOG DATE MASK
;  The format to for the date/time part of the log entry written to file.
;date_mask=%Y-%m-%d %H:%M:%S
;
;# LOG ROOT FOLDER
;  The root folder to use for logging.
;  exe = the folder where the executable is located
;  local-app-data = local application data (probably a better choice then the old default)
;root_folder=exe
text
[NSClient]
;# ALLOWED HOST ADDRESSES
;  This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.
;  If you leave this blank the global version will be used instead.
allowed_hosts=172.16.4.3
;
;# NSCLIENT PORT NUMBER
;  This is the port the NSClientListener.dll will listen to.
port=12489
;
;# BIND TO ADDRESS
;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
;  Leaving this blank will bind to all avalible IP adresses.
;bind_to_address=
;
;# SOCKET TIMEOUT
;  Timeout when reading packets on incoming sockets. If the data has not arrived withint this time we will bail out.
socket_timeout=30

[NRPE] ;# NRPE PORT NUMBER ; This is the port the NRPEListener.dll will listen to. port=5666 ; ;# COMMAND TIMEOUT ; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off. command_timeout=60 ; ;# COMMAND ARGUMENT PROCESSING ; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed. allow_arguments=1 ; ;# COMMAND ALLOW NASTY META CHARS ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. allow_nasty_meta_chars=1 ; ;# USE SSL SOCKET ; This option controls if SSL should be used on the socket. use_ssl=1 ; ;# BIND TO ADDRESS ; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname. ; Leaving this blank will bind to all avalible IP adresses. ; bind_to_address= ; ;# ALLOWED HOST ADDRESSES ; This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon. ; If you leave this blank the global version will be used instead. allowed_hosts=127.0.0.1,172.16.4.3,172.16.4.6 ; ;# SCRIPT DIRECTORY ; All files in this directory will become check commands. ; *WARNING* This is undoubtedly dangerous so use with care! ;script_dir=scripts\ ; ;# SOCKET TIMEOUT ; Timeout when reading packets on incoming sockets. If the data has not arrived withint this time we will bail out. ;socket_timeout=30

[Check System] ;# CPU BUFFER SIZE ; Can be anything ranging from 1s (for 1 second) to 10w for 10 weeks. Notice that a larger buffer will waste memory ; so don't use a larger buffer then you need (ie. the longest check you do +1). CPUBufferSize=1h ; ;# CHECK RESOLUTION ; The resolution to check values (currently only CPU). ; The value is entered in 1/10:th of a second and the default is 10 (which means ones every second) ;CheckResolution=10 ; ;# CHECK ALL SERVICES ; Configure how to check services when a CheckAll is performed. ; ...=started means services in that class *has* to be running. ; ...=stopped means services in that class has to be stopped. ; ...=ignored means services in this class will be ignored. ;check_all_services[SERVICE_BOOT_START]=ignored ;check_all_services[SERVICE_SYSTEM_START]=ignored ;check_all_services[SERVICE_AUTO_START]=started ;check_all_services[SERVICE_DEMAND_START]=ignored ;check_all_services[SERVICE_DISABLED]=stopped

[External Script] ;# COMMAND TIMEOUT ; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off. command_timeout=60 ; ;# COMMAND ARGUMENT PROCESSING ; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed. allow_arguments=1 ; ;# COMMAND ALLOW NASTY META CHARS ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. allow_nasty_meta_chars=1 ; ;# SCRIPT DIRECTORY ; All files in this directory will become check commands. ; *WARNING* This is undoubtedly dangerous so use with care! ;script_dir=c:\my\script\dir

[Script Wrappings] vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS% ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command - bat=scripts\%SCRIPT% %ARGS%

[External Scripts] ;check_es_long=scripts\long.bat ;check_es_ok=scripts\ok.bat ;check_es_nok=scripts\nok.bat ;check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs ;check_powershell_warn=cmd /c echo scripts\powershell.ps1 | powershell.exe -command -

[External Alias] alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s alias_cpu_ex=checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED alias_service=checkServiceState CheckAll alias_process=checkProcState $ARG1$=started alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical alias_up=checkUpTime MinWarn=1d MinWarn=1h alias_file_age=checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%" alias_file_size=checkFile2 filter=out "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" alias_file_size_in_dir=checkFile2 filter=out pattern=*.txt "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" alias_event_log_old=CheckEventLog file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d filter-severity==success filter-severity==informational truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" alias_event_log_new=CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational')" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" alias_event_log=alias_event_log_new

check_ok=CheckOK Everything is fine!

[Wrapped Scripts] ;check_test_vbs=check_test.vbs /arg1:1 /arg2:1 /variable:1 ;check_test_ps1=check_test.ps1 arg1 arg2 ;check_test_bat=check_test.bat arg1 arg2 ;check_battery=check_battery.vbs ;check_printer=check_printer.vbs

; [includes] ;# The order when used is "reversed" thus the last included file will be "first" ;# Included files can include other files (be carefull only do basic recursive checking) ; ; myotherfile.ini ; real.ini

text
[NSCA Agent]
;# CHECK INTERVALL (in seconds)
;   How often we should run the checks and submit the results.
;interval=5
;
;# ENCRYPTION METHOD
;   This option determines the method by which the send_nsca client will encrypt the packets it sends 
;   to the nsca daemon. The encryption method you choose will be a balance between security and 
;   performance, as strong encryption methods consume more processor resources.
;   You should evaluate your security needs when choosing an encryption method.
;
; Note: The encryption method you specify here must match the decryption method the nsca daemon uses 
;       (as specified in the nsca.cfg file)!!
; Values:
;    0 = None    (Do NOT use this option)
;    1 = Simple XOR  (No security, just obfuscation, but very fast)
;   2 = DES
;   3 = 3DES (Triple DES)
;    4 = CAST-128
;    6 = xTEA
;    8 = BLOWFISH
;    9 = TWOFISH
;    11 = RC2
;    14 = RIJNDAEL-128 (AES)
;    20 = SERPENT
;encryption_method=14
;
;# ENCRYPTION PASSWORD
;  This is the password/passphrase that should be used to encrypt the sent packets. 
;password=
;
;# BIND TO ADDRESS
;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
;  Leaving this blank will bind to "one" local interface.
; -- not supported as of now -- 
;bind_to_address=
;
;# LOCAL HOST NAME
;  The name of this host (if empty "computername" will be used.
;hostname=
;
;# NAGIOS SERVER ADDRESS
;  The address to the nagios server to submit results to.
;nsca_host=192.168.0.1
;
;# NAGIOS SERVER PORT
;  The port to the nagios server to submit results to.
;nsca_port=5667
;

;# CHECK COMMAND LIST ; The checks to run everytime we submit results back to nagios ; Any command(alias/key) starting with a host_ is sent as HOST_COMMAND others are sent as SERVICE_COMMANDS ; where the alias/key is used as service name. ; [NSCA Commands] ;my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4 ;my_mem_check=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=page ;my_svc_check=checkServiceState CheckAll exclude=wampmysqld exclude=MpfService ;host_check=check_ok

;# REMOTE NRPE PROXY COMMANDS ; A list of commands that check other hosts. ; Used by the NRPECLient module [NRPE Client Handlers]

check_counters=inject CheckCounter "Counter:proc=\\Сервер\\Ошибок входа" ShowAll

;# LUA SCRIPT SECTION ; A list of all Lua scripts to load. ;[LUA Scripts] ;scripts\test.lua

По счетчикам в винде все ок:
[console]C:\Documents and Settings\Daniel>typeperf "\Сервер\Ошибок входа"

"(PDH-CSV 4.0)","\\DOC\Сервер\Ошибок входа"
"10/13/2010 13:11:27.523","11540.000000"
"10/13/2010 13:11:28.523","11540.000000"
"10/13/2010 13:11:29.523","11540.000000"
"10/13/2010 13:11:30.523","11540.000000"
"10/13/2010 13:11:31.523","11540.000000"
"10/13/2010 13:11:32.523","11540.000000"
"10/13/2010 13:11:33.523","11540.000000"
"10/13/2010 13:11:34.523","11540.000000"

Команда выполнена успешно.[/console]

#87714

byshido
Для начала определитесь, через что Вы снимаете эти данные, через nsclient клиента, либо через NRPE Client, у Вас оба действия запущены. И как обстоят дела с фаерволом?

Войдите или зарегистрируйтесь, чтобы ответить.