CentOS / Nagios - monitoring Windows

Problemy dotyczące innych systemów operacyjnych
env002
Posty: 48
Rejestracja: 24 października 2009, 12:43

CentOS / Nagios - monitoring Windows

Post autor: env002 »

NSClient++ w najnowszej wersji zainstalowany do C:\Program Files\NSClient++
Oto nsclient.ini:

Kod: Zaznacz cały

# If you want to fill this file with all avalible options run the following command:
#   nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
#   nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
port = 5666


; Undocumented section
[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
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll
; NSCA Agent is a new beta module use with care!
;NSCAAgent.dll
; LUA script module used to write your own "check deamon" (sort of) early beta.
;LUAScript.dll
; Script to check external scripts and/or internal aliases, early beta.
;CheckExternalScripts.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)
;NRPEClient.dll


; CheckDisk - CheckDisk can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckDisk = 1


; Event log Checker. - Check for errors and warnings in the event log. This is only supported through NRPE so if you plan to use only NSClient this wont help you at all.
CheckEventLog = 1


; Check External Scripts - A simple wrapper to run external scripts and batch files.
CheckExternalScripts = 1


; Helper function - Various helper function to extend other checks. This is also only supported through NRPE.
CheckHelpers = 1


; Check NSCP - Checkes the state of the agent
CheckNSCP = 1


; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = 1


; CheckWMI - CheckWMI can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckWMI = 1


; NRPE server - A simple server that listens for incoming NRPE connection and handles them.
NRPEServer = 1


; NSCAClient - Passive check support over NSCA.
NSCAClient = 1


; NSClient server - A simple server that listens for incoming NSClient (check_nt) connection and handles them. Although NRPE is the preferred method NSClient is fully supported and can be used for simplicity or for compatibility.
NSClientServer = 1




; Undocumented section
[/settings/default]


; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts=192.168.0.105




; A list of aliases available. An alias is an internal command that has been "wrapped" (to add arguments). Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[/settings/external scripts/alias]


; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = checkCPU warn=80 crit=90 time=5m time=1m time=30s


; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
alias_cpu_ex = checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s


; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED


; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
alias_disk_loose = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED ignore-unreadable


; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
alias_event_log = CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational') AND source != 'SideBySide'" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"


; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
alias_file_age = checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%"


; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
alias_file_size = CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10


; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page


; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
alias_process = checkProcState "$ARG1$=started"


; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
alias_process_count = checkProcState MaxWarnCount=$ARG2$ MaxCritCount=$ARG3$ "$ARG1$=started"


; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
alias_process_hung = checkProcState MaxWarnCount=1 MaxCritCount=1 "$ARG1$=hung"


; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
alias_process_stopped = checkProcState "$ARG1$=stopped"


; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
alias_sched_all = CheckTaskSched "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=>0


; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
alias_sched_long = CheckTaskSched "filter=status = 'running' AND most_recent_run_time < -$ARG1$" "syntax=%title% (%most_recent_run_time%)" warn=>0


; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
alias_sched_task = CheckTaskSched "filter=title eq '$ARG1$' AND exit_code ne 0" "syntax=%title% (%most_recent_run_time%)" warn=>0


; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
alias_service = checkServiceState CheckAll


; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
alias_service_ex = checkServiceState CheckAll "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc


; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
alias_up = checkUpTime MinWarn=1d MinWarn=1h


; alias_updates - Alias for alias_updates. To configure this item add a section called: /settings/external scripts/alias/alias_updates
alias_updates = check_updates -warning 0 -critical 0


; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
alias_volumes = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED


; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
alias_volumes_loose = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED ignore-unreadable 


; default - Alias for default. To configure this item add a section called: /settings/external scripts/alias/default
default = 
Na CentOS Nagios zainstalowany został wg poradnika https://www.digitalocean.com/community/ ... n-centos-6

Wszedłem do /etc/nagios/servers i utworzyłem adamvm.cfg

Kod: Zaznacz cały

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       adamvm       ; The name we're giving to this host
        alias           adamvm       ; A longer name associated with the host
        address         192.168.0.103    ; IP address of the host
        }


define service{
        use                     generic-service
        host_name               adamvm
        service_description     NSClient++ Version
        check_command           check_nt!CLIENTVERSION
        }


Add the following service definition to monitor the uptime of the Windows server.


define service{
        use                     generic-service
        host_name               adamvm
        service_description     Uptime
        check_command           check_nt!UPTIME
        }


Add the following service definition to monitor the CPU utilization on the Windows server and generate a CRITICAL alert if the 5-minute CPU load is 90% or m$


define service{
        use                     generic-service
        host_name               adamvm
        service_description     CPU Load
        check_command           check_nt!CPULOAD!-l 5,80,90
        }


Add the following service definition to monitor memory usage on the Windows server and generate a CRITICAL alert if memory usage is 90% or more or a WARNING$


define service{
        use                     generic-service
        host_name               adamvm
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 80 -c 90
        }


Add the following service definition to monitor usage of the C:\ drive on the Windows server and generate a CRITICAL alert if disk usage is 90% or more or a$


define service{
        use                     generic-service
        host_name               adamvm
        service_description     C:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }


Add the following service definition to monitor the W3SVC service state on the Windows machine and generate a CRITICAL alert if the service is stopped.


define service{
        use                     generic-service
        host_name               adamvm
        service_description     W3SVC
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
        }


Add the following service definition to monitor the Explorer.exe process on the Windows machine and generate a CRITICAL alert if the process is not running.


define service{
        use                     generic-service
        host_name               adamvm
        service_description     Explorer
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
        }
Adres IP CentOS: 192.168.0.105
Adres IP Windows7: 192.168.0.103 (host adamvm)

Próbuję zresetować nagiosa i jest problem:

Kod: Zaznacz cały

[root@centos servers]# service nagios restart
Running configuration check... CONFIG ERROR!  Restart aborted.  Check your Nagios configuration.
Co robię nie tak?
Awatar użytkownika
lessmian2
Member
Posty: 1088
Rejestracja: 30 kwietnia 2008, 19:38
Lokalizacja: Kraków

Post autor: lessmian2 »

Co zwraca

Kod: Zaznacz cały

nagios3 -v /etc/nagios3/nagios.cfg
env002
Posty: 48
Rejestracja: 24 października 2009, 12:43

Post autor: env002 »

login as: root
root@192.168.0.105's password:
Last login: Wed Feb 26 21:59:35 2014
[root@centos ~]# nagios3 -v /etc/nagios3/nagios.cfg
-bash: nagios3: nie znaleziono polecenia
[root@centos ~]# nagios -v /etc/nagios3/nagios.cfg


Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL


Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/etc/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.


[root@centos ~]#
Zamierzam sprawdzić monitoring Windows według poradnika: http://awaseroot.wordpress.com/2012/11/ ... th-nagios/
Awatar użytkownika
lessmian2
Member
Posty: 1088
Rejestracja: 30 kwietnia 2008, 19:38
Lokalizacja: Kraków

Post autor: lessmian2 »

O matko, myślenie nie boli. Jeśli masz konfigurację nagiosa w innym miejscu lub inaczej nazywa się plik, to podaj poprawną ścieżkę. Nie mam pod ręką centosa żeby sprawdzić gdzie leży ten plik.
env002
Posty: 48
Rejestracja: 24 października 2009, 12:43

Post autor: env002 »

Tyle, że ja nie wiem gdzie mam konfigurację nagiosa. To mój 1 nagios w życiu.

Domyślam się, że o to chodzi:
login as: root
root@192.168.0.105's password:
Last login: Wed Feb 26 22:45:52 2014 from 192.168.0.101
[root@centos ~]# nagios -v /etc/nagios/nagios.cfg


Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL


Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config directory '/etc/nagios/conf.d'...
Processing object config directory '/etc/nagios/servers'...
Processing object config file '/etc/nagios/servers/cloudmail.tk.cfg'...
Processing object config file '/etc/nagios/servers/adamvm.cfg'...
Processing object config file '/etc/nagios/servers/www.nfz-bialystok.pl.cfg'...
Processing object config file '/etc/nagios/servers/wp.pl.cfg'...
Read object config files okay...


Running pre-flight check on configuration data...


Checking services...
Checked 9 services.
Checking hosts...
Checked 2 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service 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 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...


Total Warnings: 0
Total Errors: 0


Things look okay - No serious problems were detected during the pre-flight check
[root@centos ~]#

env002
Posty: 48
Rejestracja: 24 października 2009, 12:43

Post autor: env002 »

Hej,
Co jest nie tak?
Config z Windows:
http://wklej.org/id/1285292/txt/

Log z Windows:
http://wklej.org/id/1285291/txt/


192.168.0.107 - serwer nagios/centos
192.168.0.106 - windows7 który ma być monitorowany przez centos

Byłem tutaj https://www.nsclient.org/nscp/wiki/FAQ stąd wpisy w allowed hosts, ale nie działa.
Firewall wyłączony.
W czym problem?

Robione wg poradnika http://awaseroot.wordpress.com/2012/11/ ... th-nagios/
ODPOWIEDZ