Configuring Notifications in Nagios Core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

Code: Select all

root@nagios:~# service npcd status
npcd: unrecognized service
root@nagios:~# service npcd start
npcd: unrecognized service

slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Configuring Notifications in Nagios Core

Post by slansing »

This guide should do the trick:

http://nagios.sourceforge.net/download/ ... _Setup.pdf

On the windows end, you should be able to use a agent such as NSClient++ which will have it mostly configured for you, all you would need to do is set up authentication, and make sure it is enabled, this is covered on the NSClient++ site as well.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

I did steps from:

Code: Select all

http://hyper-choi.blogspot.com/2012/07/nagios-configuring-passive-check-for.html
At Windows host (NSClient 0.4.X) nsclient.ini looks:

Code: Select all

# 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


; Undocumented section
[/modules]

; 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

; 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.
CheckLogFile = 0

; 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

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

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

; 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

; DotnetPlugin - Plugin to load and manage plugins written in dot net.
DotnetPlugins = 0

; GraphiteClient - Graphite client
GraphiteClient = 0

; LUAScript - LUAScript...
LUAScript = 0

; NRDPClient - Passive check support over NRDP
NRDPClient = 0

; NRPE client - NRPE client 
NRPEClient = 0

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

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

; NSCA server (no encryption) - A simple server that listens for incoming NSCA connection and handles them.
NSCAServer = 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

; SMTPClient - Passive check support via SMTP
SMTPClient = 0

; Scheduler - A scheduler which schedules checks at regular intervals
Scheduler = 1

; SimpleCache module - Caches results for later checking.
SimpleCache = 0

; SimpleFileWriter module - FileWriters results for later checking.
SimpleFileWriter = 0

; SyslogClient - Passive check support via Syslog
SyslogClient = 0


; Undocumented section
[/settings/default]

; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH

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

; BIND TO ADDRESS - Allows you to bind server to a specific local address. This has to be a dotted ip address not a host name. Leaving this blank will bind to all available IP addresses.
bind to = 

; CACHE ALLOWED HOSTS - If hostnames should be cached, improves speed and security somewhat but wont allow you to have dynamic IPs for your nagios server.
cache allowed hosts = true

; SSL CERTIFICATE - 
certificate = 

; INBOX - The default channel to post incoming messages on
inbox = inbox

; PASSWORD - Password used to authenticate againast server
password = passwd

; TIMEOUT - Timeout when reading packets on incoming sockets. If the data has not arrived within this time we will bail out.
timeout = 30

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true

; VERIFY MODE - 
verify mode = none


; 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 = 


; List all dot net modules loaded by the DotNetplugins module here
[/modules/dotnet]


; Section for SMTP passive check module.
[/settings/NRDP/client]

; CHANNEL - The channel to listen to.
channel = NRDP

; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = auto


; Target definition for: default
[/settings/NRDP/client/targets/default]

; TARGET ADDRESS - Target host address
address = 

; RECIPIENT - Recipient of email message
recipient = nscp@localhost

; SENDER - Sender of email message
sender = nscp@localhost

; TEMPLATE - Template for message data
template = Hello, this is %source% reporting %message%!

; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 30


; Section for NRPE active/passive check module.
[/settings/NRPE/client]

; CHANNEL - The channel to listen to.
channel = NRPE


; Target definition for: default
[/settings/NRPE/client/targets/default]

; TARGET ADDRESS - Target host address
address = 

; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH

; SSL CERTIFICATE - 
certificate = 

; PAYLOAD LENGTH - Length of payload to/from the NRPE agent. This is a hard specific value so you have to "configure" (read recompile) your NRPE agent to use the same value for it to work.
payload length = 1024

; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 30

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true

; VERIFY MODE - 
verify mode = none


; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = false

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = false

; PORT NUMBER - Port to use for NRPE.
port = 5666


; Section for NSCA passive check module.
[/settings/NSCA/client]
delay=0

; CHANNEL - The channel to listen to.
channel = NSCA

; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
;hostname = auto
hostname =  WA-MKOT2

; Target definition for: default
[/settings/NSCA/client/targets/default]

; TARGET ADDRESS - Target host address
;address = 172.17.24.182
address = 192.168.20.120

; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
;allowed ciphers = ADH

; SSL CERTIFICATE - 
;certificate = 

; ENCRYPTION METHOD - Number corresponding to the various encryption algorithms (see the wiki). Has to be the same as the server or it wont work at all.
encryption = aes
;encryption = xor

; PASSWORD - The password to use. Again has to be the same as the server or it wont work at all.
password = passwd

; Target server port
port=5667

; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 30

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = false

; VERIFY MODE - 
verify mode = none


; Section for NSCA (NSCAServer) (check_nsca) protocol options.
[/settings/NSCA/server]

; ENCRYPTION - Encryption to use
encryption = aes
;encryption = xor

; PASSWORD - Password to use
password = passwd

; PAYLOAD LENGTH - Length of payload to/from the NSCA agent. This is a hard specific value so you have to "configure" (read recompile) your NSCA agent to use the same value for it to work.
payload length = 512

; PERFORMANCE DATA - Send performance data back to nagios (set this to 0 to remove all performance data).
performance data = true

; PORT NUMBER - Port to use for NSCA.
port = 5667

; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = false


; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]

; PERFORMANCE DATA - Send performance data back to nagios (set this to 0 to remove all performance data).
performance data = true

; PORT NUMBER - Port to use for check_nt.
port = 12489


; Section for SMTP passive check module.
[/settings/SMTP/client]

; CHANNEL - The channel to listen to.
channel = SMTP


; Target definition for: default
[/settings/SMTP/client/targets/default]

; TARGET ADDRESS - Target host address
address = 

; RECIPIENT - Recipient of email message
recipient = nscp@localhost

; SENDER - Sender of email message
sender = nscp@localhost

; TEMPLATE - Template for message data
template = Hello, this is %source% reporting %message%!

; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 30


; Section for simple cache module (SimpleCache.dll).
[/settings/cache]

; CHANNEL - The channel to listen to.
channel = CACHE

; PRIMARY CACHE INDEX - Set this to the value you want to use as unique key for the cache (host, command, result,...).
primary index = ${alias-or-command}


; Section for system checks and system settings
[/settings/check/task schedule]

; SYNTAX - Set this to use a specific syntax string for all commands (that don't specify one)
default buffer length = %title% last run: %most-recent-run-time% (%exit-code%)


; Configure crash handling properties.
[/settings/crash]

; ARCHIVE CRASHREPORTS - Archive crash reports in the archive folder
archive = true

; folder - The archive folder for crash dunpes.
archive folder = ${shared-path}/crash-dumps

; RESTART - Submit crash reports to nsclient.org (or your configured submission server)
restart = true

; RESTART SERVICE NAME - The url to submit crash reports to
restart target = NSClientpp

; SUBMIT CRASHREPORTS - Submit crash reports to nsclient.org (or your configured submission server)
submit = false

; SUBMISSION URL - The url to submit crash reports to
submit url = http://crash.nsclient.org/submit


; Section for the EventLog Checker (CheckEventLog.dll).
[/settings/eventlog]

; BUFFER_SIZE - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
buffer size = 131072

; DEBUG - Log more information when filtering (usefull to detect issues with filters) not usefull in production as it is a bit of a resource hog.
debug = false

; LOOKUP NAMES - Lookup the names of eventlog files
lookup names = true

; SYNTAX - Set this to use a specific syntax string for all commands (that don't specify one).
syntax = 


; A set of options to configure the real time checks
[/settings/eventlog/real-time]

; DEBUG - Log missed records (usefull to detect issues with filters) not usefull in production as it is a bit of a resource hog.
debug = false

; REAL TIME CHECKING - Spawns a backgrounnd thread which detects issues and reports them back instantly.
enabled = false

; LOGS TO CHECK - Comma separated list of logs to check
log = application,system

; STARTUP AGE - The initial age to scan when starting NSClient++
startup age = 30m


; A set of filters to use in real-time mode
[/settings/eventlog/real-time/filters]


; Section for external scripts configuration options (CheckExternalScripts).
[/settings/external scripts]

; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = false

; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = false

; SCRIPT DIRECTORY - Load all scripts in a directory and use them as commands. Probably dangerous but useful if you have loads of scripts :)
script path = 

; COMMAND TIMEOUT - The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
timeout = 60


; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]


; A list of wrappped scripts (ie. using the template mechanism)
[/settings/external scripts/wrapped scripts]


; A list of templates for wrapped scripts
[/settings/external scripts/wrappings]

; BATCH FILE WRAPPING - 
bat = scripts\\%SCRIPT% %ARGS%

; POWERSHELL WRAPPING - 
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

; VISUAL BASIC WRAPPING - 
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%


; Section for graphite passive check module.
[/settings/graphite/client]

; CHANNEL - The channel to listen to.
channel = GRAPHITE

; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = auto


; Target definition for: default
[/settings/graphite/client/targets/default]

; TARGET ADDRESS - Target host address
address = 

; PATH FOR VALUES - 
path = system.${hostname}.${check_alias}.${perf_alias}


; Section for configuring the log handling.
[/settings/log]

; 2014-03-04
debug=1

; DATEMASK - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
date format = %Y-%m-%d %H:%M:%S

; FILENAME - The file to write log data to. Set this to none to disable log to file.
file name = ${exe-path}/nsclient.log


; Configure log file properties.
[/settings/log/file]

; MAXIMUM FILE SIZE - When file size reaches this it will be truncated to 50% if set to 0 (default) truncation will be disabled
max size = 0

; Path to log file - 2014-03-04
file=C:\NSC.log


; Section for log file checker
[/settings/logfile]

; DEBUG - Log more information to help diagnose errors and configuration problems.
debug = false

; SYNTAX - Set the default syntax to use
syntax = 


; A set of options to configure the real time checks
[/settings/logfile/real-time]

; REAL TIME CHECKING - Spawns a backgrounnd thread which waits for file changes.
enabled = false


; A set of filters to use in real-time mode
[/settings/logfile/real-time/checks]


; Section for the LUAScripts module.
[/settings/lua]


; A list of scripts available to run from the LuaSCript module.
[/settings/lua/scripts]


; Section for the Scheduler module.
[/settings/scheduler]

; THREAD COUNT - Number of threads to use.
threads = 5


; Section for the Scheduler module.

[/settings/scheduler/schedules/default]
;interval=5m
channel=NSCA
interval=30s
report=all

; dodane 20140228

[/settings/scheduler/schedules]
cpu=alias_cpu
mem=alias_mem
disk=alias_disk
;service=alias_service

; Section for configuring the shared session.
[/settings/shared session]

; LOG LEVEL - Log level to use
enabled = false


; Section for SYSLOG passive check module.
[/settings/syslog/client]

; CHANNEL - The channel to listen to.
channel = syslog

; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = WA-MKOT2


; Target definition for: default
[/settings/syslog/client/targets/default]

; TARGET ADDRESS - Target host address
address = 

; TODO - 
critical severity = critical

; TODO - 
facility = kernel

; TODO - 
message_syntax = %message%

; TODO - 
ok severity = informational

; TODO - 
severity = error

; TODO - 
tag_syntax = NSCA

; TODO - 
unknown severity = emergency

; TODO - 
warning severity = warning


; Section for system checks and system settings
[/settings/system/windows]

; DEFAULT LENGTH - Used to define the default intervall for range buffer checks (ie. CPU).
default buffer length = 1h


; Confiure which services has to be in which state
[/settings/system/windows/service mapping]


; A list of avalible remote target systems
[/settings/targets]


; Section for simple file writer module (SimpleFileWriter.dll).
[/settings/writers/file]

; CHANNEL - The channel to listen to.
channel = FILE

; FILE TO WRITE TO - The filename to write output to.
file = output.txt

; PRIMARY CACHE INDEX - Set this to the value you want to use as unique key for the cache (host, command, result,...).
syntax = ${alias-or-command} ${result} ${message}



At Testing Nagios Server (Ubuntu 12.04.4 LTS) I've got:

/etc/nsca.cfg

Code: Select all

####################################################
# Sample NSCA Daemon Config File 
# Written by: Ethan Galstad ([email protected])
# 
# Last Modified: 04-03-2006
####################################################


# PID FILE
# The name of the file in which the NSCA daemon should write it's process ID
# number.  The file is only written if the NSCA daemon is started by the root
# user as a single- or multi-process daemon.

pid_file=/var/run/nsca.pid



# PORT NUMBER
# Port number we should wait for connections on.
# This must be a non-priveledged port (i.e. > 1024).

server_port=5667



# SERVER ADDRESS
# Address that NSCA has to bind to in case there are
# more as one interface and we do not want NSCA to bind
# (thus listen) on all interfaces.

#server_address=192.168.1.1



# NSCA USER
# This determines the effective user that the NSCA daemon should run as.  
# You can either supply a username or a UID.
# 
# NOTE: This option is ignored if NSCA is running under either inetd or xinetd

nsca_user=nagios



# NSCA GROUP
# This determines the effective group that the NSCA daemon should run as.  
# You can either supply a group name or a GID.
# 
# NOTE: This option is ignored if NSCA is running under either inetd or xinetd

#nsca_group=nogroup
nsca_group=nagios



# NSCA CHROOT
# If specified, determines a directory into which the nsca daemon
# will perform a chroot(2) operation before dropping its privileges.
# for the security conscious this can add a layer of protection in
# the event that the nagios daemon is compromised.  
# 
# NOTE: if you specify this option, the command file will be opened
#       relative to this directory.

#nsca_chroot=/var/run/nagios/rw



# DEBUGGING OPTION
# This option determines whether or not debugging
# messages are logged to the syslog facility. 
# Values: 0 = debugging off, 1 = debugging on

debug=1



# COMMAND FILE
# This is the location of the Nagios command file that the daemon
# should write all service check results that it receives.
# Note to debian users: nagios 1.x and nagios 2.x have
# different default locations for this file.  this is the
# default location for nagios 1.x:
#command_file=/var/run/nagios/nagios.cmd
# and this is the default location for nagios2:
#command_file=/var/lib/nagios2/rw/nagios.cmd
# and this is the default location for nagios3:
#command_file=/var/lib/nagios3/rw/nagios.cmd
command_file=/usr/local/nagios/var/rw/nagios.cmd

# ALTERNATE DUMP FILE
# This is used to specify an alternate file the daemon should
# write service check results to in the event the command file
# does not exist.  It is important to note that the command file
# is implemented as a named pipe and only exists when Nagios is
# running.  You may want to modify the startup script for Nagios
# to dump the contents of this file into the command file after
# it starts Nagios.  Or you may simply choose to ignore any
# check results received while Nagios was not running...

alternate_dump_file=/var/run/nagios/nsca.dump


# AGGREGATED WRITES OPTION
# This option determines whether or not the nsca daemon will
# aggregate writes to the external command file for client
# connections that contain multiple check results.  If you
# are queueing service check results on remote hosts and
# sending them to the nsca daemon in bulk, you will probably
# want to enable bulk writes, as this will be a bit more
# efficient.
# Values: 0 = do not aggregate writes, 1 = aggregate writes

aggregate_writes=0



# APPEND TO FILE OPTION
# This option determines whether or not the nsca daemon will
# will open the external command file for writing or appending.
# This option should almost *always* be set to 0!
# Values: 0 = open file for writing, 1 = open file for appending

append_to_file=0



# MAX PACKET AGE OPTION
# This option is used by the nsca daemon to determine when client
# data is too old to be valid.  Keeping this value as small as
# possible is recommended, as it helps prevent the possibility of
# "replay" attacks.  This value needs to be at least as long as
# the time it takes your clients to send their data to the server.
# Values are in seconds.  The max packet age cannot exceed 15
# minutes (900 seconds).  If this variable is set to zero (0), no
# packets will be rejected based on their age.

max_packet_age=30



# DECRYPTION PASSWORD
# This is the password/passphrase that should be used to descrypt the
# incoming packets.  Note that all clients must encrypt the packets
# they send using the same password!
# IMPORTANT: You don't want all the users on this system to be able
# to read the password you specify here, so make sure to set
# restrictive permissions on this config file!

password=passwd



# DECRYPTION METHOD
# This option determines the method by which the nsca daemon will
# decrypt the packets it receives from the clients.  The decryption
# 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 a decryption
# method.
#
# Note: The decryption method you specify here must match the
#       encryption method the nsca clients use (as specified in
#       the send_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
#	5 = CAST-256
#	6 = xTEA
#	7 = 3WAY
#	8 = BLOWFISH
#	9 = TWOFISH
#	10 = LOKI97
#	11 = RC2
#	12 = ARCFOUR
#
#	14 = RIJNDAEL-128 (AES)
#	15 = RIJNDAEL-192
#	16 = RIJNDAEL-256
#
#	19 = WAKE
#	20 = SERPENT
#
#	22 = ENIGMA (Unix crypt)
#	23 = GOST
#	24 = SAFER64
#	25 = SAFER128
#	26 = SAFER+
#

decryption_method=14
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

/usr/local/nagios/etc/nagios.cfg

Code: Select all

##############################################################################
#
# NAGIOS.CFG - Sample Main Config File for Nagios 4.0.3
#
# Read the documentation for more information on this configuration
# file.  I've provided some comments here, but things may not be so
# clear without further explanation.
#
#
##############################################################################


# 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=/usr/local/nagios/var/nagios.log



# 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=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg

# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg

# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/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=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/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=/usr/local/nagios/var/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=/usr/local/nagios/var/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=/usr/local/nagios/etc/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=/usr/local/nagios/var/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



# NAGIOS USER
# This determines the effective user that Nagios should run as.  
# You can either supply a username or a UID.

nagios_user=nagios



# NAGIOS GROUP
# This determines the effective group that Nagios should run as.  
# You can either supply a group name or a GID.

nagios_group=nagios



# EXTERNAL COMMAND OPTION
# This option allows you to specify whether or not Nagios should check
# for external commands (in the command file defined below).  By default
# Nagios will *not* check for external commands, just to be on the
# cautious side.  If you want to be able to use the CGI command interface
# you will have to enable this.
# Values: 0 = disable commands, 1 = enable commands

check_external_commands=1



# EXTERNAL COMMAND FILE
# This is the file that Nagios checks for external command requests.
# It is also where the command CGI will write commands that are submitted
# by users, so it must be writeable by the user that the web server
# is running as (usually 'nobody').  Permissions should be set at the 
# directory level instead of on the file, as the file is deleted every
# time its contents are processed.

command_file=/usr/local/nagios/var/rw/nagios.cmd



# QUERY HANDLER INTERFACE
# This is the socket that is created for the Query Handler interface

#query_socket=/usr/local/nagios/var/rw/nagios.qh



# LOCK FILE
# This is the lockfile that Nagios will use to store its PID number
# in when it is running in daemon mode.

lock_file=/usr/local/nagios/var/nagios.lock



# TEMP FILE
# This is a temporary file that is used as scratch space when Nagios
# updates the status log, cleans the comment file, etc.  This file
# is created, used, and deleted throughout the time that Nagios is
# running.

temp_file=/usr/local/nagios/var/nagios.tmp



# TEMP PATH
# This is path where Nagios can create temp files for service and
# host check results, etc.

temp_path=/tmp



# EVENT BROKER OPTIONS
# Controls what (if any) data gets sent to the event broker.
# Values:  0      = Broker nothing
#         -1      = Broker everything
#         <other> = See documentation

event_broker_options=-1



# EVENT BROKER MODULE(S)
# This directive is used to specify an event broker module that should
# by loaded by Nagios at startup.  Use multiple directives if you want
# to load more than one module.  Arguments that should be passed to
# the module at startup are seperated from the module path by a space.
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Do NOT overwrite modules while they are being used by Nagios or Nagios
# will crash in a fiery display of SEGFAULT glory.  This is a bug/limitation
# either in dlopen(), the kernel, and/or the filesystem.  And maybe Nagios...
#
# The correct/safe way of updating a module is by using one of these methods:
#    1. Shutdown Nagios, replace the module file, restart Nagios
#    2. Delete the original module file, move the new module file into place, restart Nagios
#
# Example:
#
#   broker_module=<modulepath> [moduleargs]

#broker_module=/somewhere/module1.o
#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0



# LOG ROTATION METHOD
# This is the log rotation method that Nagios should use to rotate
# the main log file. Values are as follows..
#	n	= None - don't rotate the log
#	h	= Hourly rotation (top of the hour)
#	d	= Daily rotation (midnight every day)
#	w	= Weekly rotation (midnight on Saturday evening)
#	m	= Monthly rotation (midnight last day of month)

log_rotation_method=d



# LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be 
# placed (assuming you've chosen to do log rotation).

log_archive_path=/usr/local/nagios/var/archives



# LOGGING OPTIONS
# If you want messages logged to the syslog facility, as well as the
# Nagios log file set this option to 1.  If not, set it to 0.

use_syslog=1



# NOTIFICATION LOGGING OPTION
# If you don't want notifications to be logged, set this value to 0.
# If notifications should be logged, set the value to 1.

log_notifications=1



# SERVICE RETRY LOGGING OPTION
# If you don't want service check retries to be logged, set this value
# to 0.  If retries should be logged, set the value to 1.

log_service_retries=1



# HOST RETRY LOGGING OPTION
# If you don't want host check retries to be logged, set this value to
# 0.  If retries should be logged, set the value to 1.

log_host_retries=1



# EVENT HANDLER LOGGING OPTION
# If you don't want host and service event handlers to be logged, set
# this value to 0.  If event handlers should be logged, set the value
# to 1.

log_event_handlers=1



# INITIAL STATES LOGGING OPTION
# If you want Nagios to log all initial host and service states to
# the main log file (the first time the service or host is checked)
# you can enable this option by setting this value to 1.  If you
# are not using an external application that does long term state
# statistics reporting, you do not need to enable this option.  In
# this case, set the value to 0.

log_initial_states=0



# CURRENT STATES LOGGING OPTION
# If you don't want Nagios to log all current host and service states
# after log has been rotated to the main log file, you can disable this
# option by setting this value to 0. Default value is 1.

log_current_states=1



# EXTERNAL COMMANDS LOGGING OPTION
# If you don't want Nagios to log external commands, set this value
# to 0.  If external commands should be logged, set this value to 1.
# Note: This option does not include logging of passive service
# checks - see the option below for controlling whether or not
# passive checks are logged.

log_external_commands=1



# PASSIVE CHECKS LOGGING OPTION
# If you don't want Nagios to log passive host and service checks, set
# this value to 0.  If passive checks should be logged, set
# this value to 1.

log_passive_checks=1



# GLOBAL HOST AND SERVICE EVENT HANDLERS
# These options allow you to specify a host and service event handler
# command that is to be run for every host or service state change.
# The global event handler is executed immediately prior to the event
# handler that you have optionally specified in each host or
# service definition. The command argument is the short name of a
# command definition that you define in your host configuration file.
# Read the HTML docs for more information.

#global_host_event_handler=somecommand
#global_service_event_handler=somecommand



# SERVICE INTER-CHECK DELAY METHOD
# This is the method that Nagios should use when initially
# "spreading out" service checks when it starts monitoring.  The
# default is to use smart delay calculation, which will try to
# space all service checks out evenly to minimize CPU load.
# Using the dumb setting will cause all checks to be scheduled
# at the same time (with no delay between them)!  This is not a
# good thing for production, but is useful when testing the
# parallelization functionality.
#	n	= None - don't use any delay between checks
#	d	= Use a "dumb" delay of 1 second between checks
#	s	= Use "smart" inter-check delay calculation
#       x.xx    = Use an inter-check delay of x.xx seconds

service_inter_check_delay_method=s



# MAXIMUM SERVICE CHECK SPREAD
# This variable determines the timeframe (in minutes) from the
# program start time that an initial check of all services should
# be completed.  Default is 30 minutes.

max_service_check_spread=30



# SERVICE CHECK INTERLEAVE FACTOR
# This variable determines how service checks are interleaved.
# Interleaving the service checks allows for a more even
# distribution of service checks and reduced load on remote
# hosts.  Setting this value to 1 is equivalent to how versions
# of Nagios previous to 0.0.5 did service checks.  Set this
# value to s (smart) for automatic calculation of the interleave
# factor unless you have a specific reason to change it.
#       s       = Use "smart" interleave factor calculation
#       x       = Use an interleave factor of x, where x is a
#                 number greater than or equal to 1.

service_interleave_factor=s



# HOST INTER-CHECK DELAY METHOD
# This is the method that Nagios should use when initially
# "spreading out" host checks when it starts monitoring.  The
# default is to use smart delay calculation, which will try to
# space all host checks out evenly to minimize CPU load.
# Using the dumb setting will cause all checks to be scheduled
# at the same time (with no delay between them)!
#	n	= None - don't use any delay between checks
#	d	= Use a "dumb" delay of 1 second between checks
#	s	= Use "smart" inter-check delay calculation
#       x.xx    = Use an inter-check delay of x.xx seconds

host_inter_check_delay_method=s



# MAXIMUM HOST CHECK SPREAD
# This variable determines the timeframe (in minutes) from the
# program start time that an initial check of all hosts should
# be completed.  Default is 30 minutes.

max_host_check_spread=30



# MAXIMUM CONCURRENT SERVICE CHECKS
# This option allows you to specify the maximum number of 
# service checks that can be run in parallel at any given time.
# Specifying a value of 1 for this variable essentially prevents
# any service checks from being parallelized.  A value of 0
# will not restrict the number of concurrent checks that are
# being executed.

max_concurrent_checks=0



# HOST AND SERVICE CHECK REAPER FREQUENCY
# This is the frequency (in seconds!) that Nagios will process
# the results of host and service checks.

check_result_reaper_frequency=10




# 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=/usr/local/nagios/var/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




# CACHED HOST CHECK HORIZON
# This option determines the maximum amount of time (in seconds)
# that the state of a previous host check is considered current.
# Cached host states (from host checks that were performed more
# recently that the timeframe specified by this value) can immensely
# improve performance in regards to the host check logic.
# Too high of a value for this option may result in inaccurate host
# states being used by Nagios, while a lower value may result in a
# performance hit for host checks.  Use a value of 0 to disable host
# check caching.

cached_host_check_horizon=15



# CACHED SERVICE CHECK HORIZON
# This option determines the maximum amount of time (in seconds)
# that the state of a previous service check is considered current.
# Cached service states (from service checks that were performed more
# recently that the timeframe specified by this value) can immensely
# improve performance in regards to predictive dependency checks.
# Use a value of 0 to disable service check caching.

cached_service_check_horizon=15



# ENABLE PREDICTIVE HOST DEPENDENCY CHECKS
# This option determines whether or not Nagios will attempt to execute
# checks of hosts when it predicts that future dependency logic test
# may be needed.  These predictive checks can help ensure that your
# host dependency logic works well.
# Values:
#  0 = Disable predictive checks
#  1 = Enable predictive checks (default)

enable_predictive_host_dependency_checks=1



# ENABLE PREDICTIVE SERVICE DEPENDENCY CHECKS
# This option determines whether or not Nagios will attempt to execute
# checks of service when it predicts that future dependency logic test
# may be needed.  These predictive checks can help ensure that your
# service dependency logic works well.
# Values:
#  0 = Disable predictive checks
#  1 = Enable predictive checks (default)

enable_predictive_service_dependency_checks=1



# SOFT STATE DEPENDENCIES
# This option determines whether or not Nagios will use soft state 
# information when checking host and service dependencies. Normally 
# Nagios will only use the latest hard host or service state when 
# checking dependencies. If you want it to use the latest state (regardless
# of whether its a soft or hard state type), enable this option. 
# Values:
#  0 = Don't use soft state dependencies (default) 
#  1 = Use soft state dependencies 

soft_state_dependencies=0



# TIME CHANGE ADJUSTMENT THRESHOLDS
# These options determine when Nagios will react to detected changes
# in system time (either forward or backwards).

#time_change_threshold=900



# AUTO-RESCHEDULING OPTION
# This option determines whether or not Nagios will attempt to
# automatically reschedule active host and service checks to
# "smooth" them out over time.  This can help balance the load on
# the monitoring server.  
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY

auto_reschedule_checks=0



# AUTO-RESCHEDULING INTERVAL
# This option determines how often (in seconds) Nagios will
# attempt to automatically reschedule checks.  This option only
# has an effect if the auto_reschedule_checks option is enabled.
# Default is 30 seconds.
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY

auto_rescheduling_interval=30



# AUTO-RESCHEDULING WINDOW
# This option determines the "window" of time (in seconds) that
# Nagios will look at when automatically rescheduling checks.
# Only host and service checks that occur in the next X seconds
# (determined by this variable) will be rescheduled. This option
# only has an effect if the auto_reschedule_checks option is
# enabled.  Default is 180 seconds (3 minutes).
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY

auto_rescheduling_window=180



# TIMEOUT VALUES
# These options control how much time Nagios will allow various
# types of commands to execute before killing them off.  Options
# are available for controlling maximum time allotted for
# service checks, host checks, event handlers, notifications, the
# ocsp command, and performance data commands.  All values are in
# seconds.

service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5



# RETAIN STATE INFORMATION
# This setting determines whether or not Nagios will save state
# information for services and hosts before it shuts down.  Upon
# startup Nagios will reload all saved service and host state
# information before starting to monitor.  This is useful for 
# maintaining long-term data on state statistics, etc, but will
# slow Nagios down a bit when it (re)starts.  Since its only
# a one-time penalty, I think its well worth the additional
# startup delay.

retain_state_information=1



# STATE RETENTION FILE
# This is the file that Nagios should use to store host and
# service state information before it shuts down.  The state 
# information in this file is also read immediately prior to
# starting to monitor the network when Nagios is restarted.
# This file is used only if the retain_state_information
# variable is set to 1.

state_retention_file=/usr/local/nagios/var/retention.dat



# RETENTION DATA UPDATE INTERVAL
# This setting determines how often (in minutes) that Nagios
# will automatically save retention data during normal operation.
# If you set this value to 0, Nagios will not save retention
# data at regular interval, but it will still save retention
# data before shutting down or restarting.  If you have disabled
# state retention, this option has no effect.

retention_update_interval=60



# USE RETAINED PROGRAM STATE
# This setting determines whether or not Nagios will set 
# program status variables based on the values saved in the
# retention file.  If you want to use retained program status
# information, set this value to 1.  If not, set this value
# to 0.

use_retained_program_state=1



# USE RETAINED SCHEDULING INFO
# This setting determines whether or not Nagios will retain
# the scheduling info (next check time) for hosts and services
# based on the values saved in the retention file.  If you
# If you want to use retained scheduling info, set this
# value to 1.  If not, set this value to 0.

use_retained_scheduling_info=1



# RETAINED ATTRIBUTE MASKS (ADVANCED FEATURE)
# The following variables are used to specify specific host and
# service attributes that should *not* be retained by Nagios during
# program restarts.
#
# The values of the masks are bitwise ANDs of values specified
# by the "MODATTR_" definitions found in include/common.h.  
# For example, if you do not want the current enabled/disabled state
# of flap detection and event handlers for hosts to be retained, you
# would use a value of 24 for the host attribute mask...
# MODATTR_EVENT_HANDLER_ENABLED (8) + MODATTR_FLAP_DETECTION_ENABLED (16) = 24

# This mask determines what host attributes are not retained
retained_host_attribute_mask=0

# This mask determines what service attributes are not retained
retained_service_attribute_mask=0

# These two masks determine what process attributes are not retained.
# There are two masks, because some process attributes have host and service
# options.  For example, you can disable active host checks, but leave active
# service checks enabled.
retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0

# These two masks determine what contact attributes are not retained.
# There are two masks, because some contact attributes have host and
# service options.  For example, you can disable host notifications for
# a contact, but leave service notifications enabled for them.
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0



# INTERVAL LENGTH
# This is the seconds per unit interval as used in the
# host/contact/service configuration files.  Setting this to 60 means
# that each interval is one minute long (60 seconds).  Other settings
# have not been tested much, so your mileage is likely to vary...

interval_length=60



# CHECK FOR UPDATES
# This option determines whether Nagios will automatically check to
# see if new updates (releases) are available.  It is recommend that you
# enable this option to ensure that you stay on top of the latest critical
# patches to Nagios.  Nagios is critical to you - make sure you keep it in
# good shape.  Nagios will check once a day for new updates. Data collected
# by Nagios Enterprises from the update check is processed in accordance 
# with our privacy policy - see http://api.nagios.org for details.

check_for_updates=1



# BARE UPDATE CHECK
# This option deterines what data Nagios will send to api.nagios.org when
# it checks for updates.  By default, Nagios will send information on the 
# current version of Nagios you have installed, as well as an indicator as
# to whether this was a new installation or not.  Nagios Enterprises uses
# this data to determine the number of users running specific version of 
# Nagios.  Enable this option if you do not want this information to be sent.

bare_update_check=0



# AGGRESSIVE HOST CHECKING OPTION
# If you don't want to turn on aggressive host checking features, set
# this value to 0 (the default).  Otherwise set this value to 1 to
# enable the aggressive check option.  Read the docs for more info
# on what aggressive host check is or check out the source code in
# base/checks.c

use_aggressive_host_checking=0



# SERVICE CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# service checks when it initially starts.  If this option is 
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of service checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks

execute_service_checks=1



# PASSIVE SERVICE CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# service checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks

accept_passive_service_checks=1



# HOST CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute
# host checks when it initially starts.  If this option is 
# disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in.  Unless
# you're implementing redundant hosts or have a special need for
# disabling the execution of host checks, leave this enabled!
# Values: 1 = enable checks, 0 = disable checks

execute_host_checks=1



# PASSIVE HOST CHECK ACCEPTANCE OPTION
# This determines whether or not Nagios will accept passive
# host checks results when it initially (re)starts.
# Values: 1 = accept passive checks, 0 = reject passive checks

accept_passive_host_checks=1



# NOTIFICATIONS OPTION
# This determines whether or not Nagios will sent out any host or
# service notifications when it is initially (re)started.
# Values: 1 = enable notifications, 0 = disable notifications

enable_notifications=1



# EVENT HANDLER USE OPTION
# This determines whether or not Nagios will run any host or
# service event handlers when it is initially (re)started.  Unless
# you're implementing redundant hosts, leave this option enabled.
# Values: 1 = enable event handlers, 0 = disable event handlers

enable_event_handlers=1



# PROCESS PERFORMANCE DATA OPTION
# This determines whether or not Nagios will process performance
# data returned from service and host checks.  If this option is
# enabled, host performance data will be processed using the
# host_perfdata_command (defined below) and service performance
# data will be processed using the service_perfdata_command (also
# defined below).  Read the HTML docs for more information on
# performance data.
# Values: 1 = process performance data, 0 = do not process performance data

process_performance_data=0



# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
# These commands are run after every host and service check is
# performed.  These commands are executed only if the
# enable_performance_data option (above) is set to 1.  The command
# argument is the short name of a command definition that you 
# define in your host configuration file.  Read the HTML docs for
# more information on performance data.

#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata



# HOST AND SERVICE PERFORMANCE DATA FILES
# These files are used to store host and service performance data.
# Performance data is only written to these files if the
# enable_performance_data option (above) is set to 1.

#host_perfdata_file=/usr/local/nagios/var/host-perfdata
#service_perfdata_file=/usr/local/nagios/var/service-perfdata



# HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES
# These options determine what data is written (and how) to the
# performance data files.  The templates may contain macros, special
# characters (\t for tab, \r for carriage return, \n for newline)
# and plain text.  A newline is automatically added after each write
# to the performance data file.  Some examples of what you can do are
# shown below.

#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$



# HOST AND SERVICE PERFORMANCE DATA FILE MODES
# This option determines whether or not the host and service
# performance data files are opened in write ("w") or append ("a")
# mode. If you want to use named pipes, you should use the special
# pipe ("p") mode which avoid blocking at startup, otherwise you will
# likely want the defult append ("a") mode.

#host_perfdata_file_mode=a
#service_perfdata_file_mode=a



# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL
# These options determine how often (in seconds) the host and service
# performance data files are processed using the commands defined
# below.  A value of 0 indicates the files should not be periodically
# processed.

#host_perfdata_file_processing_interval=0
#service_perfdata_file_processing_interval=0



# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS
# These commands are used to periodically process the host and
# service performance data files.  The interval at which the
# processing occurs is determined by the options above.

#host_perfdata_file_processing_command=process-host-perfdata-file
#service_perfdata_file_processing_command=process-service-perfdata-file



# HOST AND SERVICE PERFORMANCE DATA PROCESS EMPTY RESULTS
# These options determine wether the core will process empty perfdata
# results or not. This is needed for distributed monitoring, and intentionally
# turned on by default.
# If you don't require empty perfdata - saving some cpu cycles
# on unwanted macro calculation - you can turn that off. Be careful!
# Values: 1 = enable, 0 = disable

#host_perfdata_process_empty_results=1
#service_perfdata_process_empty_results=1


# OBSESS OVER SERVICE CHECKS OPTION
# This determines whether or not Nagios will obsess over service
# checks and run the ocsp_command defined below.  Unless you're
# planning on implementing distributed monitoring, do not enable
# this option.  Read the HTML docs for more information on
# implementing distributed monitoring.
# Values: 1 = obsess over services, 0 = do not obsess (default)

obsess_over_services=0



# OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND
# This is the command that is run for every service check that is
# processed by Nagios.  This command is executed only if the
# obsess_over_services option (above) is set to 1.  The command 
# argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring.

#ocsp_command=somecommand



# OBSESS OVER HOST CHECKS OPTION
# This determines whether or not Nagios will obsess over host
# checks and run the ochp_command defined below.  Unless you're
# planning on implementing distributed monitoring, do not enable
# this option.  Read the HTML docs for more information on
# implementing distributed monitoring.
# Values: 1 = obsess over hosts, 0 = do not obsess (default)

obsess_over_hosts=0



# OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND
# This is the command that is run for every host check that is
# processed by Nagios.  This command is executed only if the
# obsess_over_hosts option (above) is set to 1.  The command 
# argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring.

#ochp_command=somecommand



# TRANSLATE PASSIVE HOST CHECKS OPTION
# This determines whether or not Nagios will translate
# DOWN/UNREACHABLE passive host check results into their proper
# state for this instance of Nagios.  This option is useful
# if you have distributed or failover monitoring setup.  In
# these cases your other Nagios servers probably have a different
# "view" of the network, with regards to the parent/child relationship
# of hosts.  If a distributed monitoring server thinks a host
# is DOWN, it may actually be UNREACHABLE from the point of
# this Nagios instance.  Enabling this option will tell Nagios
# to translate any DOWN or UNREACHABLE host states it receives
# passively into the correct state from the view of this server.
# Values: 1 = perform translation, 0 = do not translate (default)

translate_passive_host_checks=0



# PASSIVE HOST CHECKS ARE SOFT OPTION
# This determines whether or not Nagios will treat passive host
# checks as being HARD or SOFT.  By default, a passive host check
# result will put a host into a HARD state type.  This can be changed
# by enabling this option.
# Values: 0 = passive checks are HARD, 1 = passive checks are SOFT

passive_host_checks_are_soft=0



# ORPHANED HOST/SERVICE CHECK OPTIONS
# These options determine whether or not Nagios will periodically 
# check for orphaned host service checks.  Since service checks are
# not rescheduled until the results of their previous execution 
# instance are processed, there exists a possibility that some
# checks may never get rescheduled.  A similar situation exists for
# host checks, although the exact scheduling details differ a bit
# from service checks.  Orphaned checks seem to be a rare
# problem and should not happen under normal circumstances.
# If you have problems with service checks never getting
# rescheduled, make sure you have orphaned service checks enabled.
# Values: 1 = enable checks, 0 = disable checks

check_for_orphaned_services=1
check_for_orphaned_hosts=1



# SERVICE FRESHNESS CHECK OPTION
# This option determines whether or not Nagios will periodically
# check the "freshness" of service results.  Enabling this option
# is useful for ensuring passive checks are received in a timely
# manner.
# Values: 1 = enabled freshness checking, 0 = disable freshness checking

check_service_freshness=1



# SERVICE FRESHNESS CHECK INTERVAL
# This setting determines how often (in seconds) Nagios will
# check the "freshness" of service check results.  If you have
# disabled service freshness checking, this option has no effect.

service_freshness_check_interval=60



# SERVICE CHECK TIMEOUT STATE
# This setting determines the state Nagios will report when a
# service check times out - that is does not respond within
# service_check_timeout seconds.  This can be useful if a
# machine is running at too high a load and you do not want
# to consider a failed service check to be critical (the default).
# Valid settings are:
# c - Critical (default)
# u - Unknown
# w - Warning
# o - OK

service_check_timeout_state=c



# HOST FRESHNESS CHECK OPTION
# This option determines whether or not Nagios will periodically
# check the "freshness" of host results.  Enabling this option
# is useful for ensuring passive checks are received in a timely
# manner.
# Values: 1 = enabled freshness checking, 0 = disable freshness checking

check_host_freshness=0



# HOST FRESHNESS CHECK INTERVAL
# This setting determines how often (in seconds) Nagios will
# check the "freshness" of host check results.  If you have
# disabled host freshness checking, this option has no effect.

host_freshness_check_interval=60




# ADDITIONAL FRESHNESS THRESHOLD LATENCY
# This setting determines the number of seconds that Nagios
# will add to any host and service freshness thresholds that
# it calculates (those not explicitly specified by the user).

additional_freshness_latency=15




# FLAP DETECTION OPTION
# This option determines whether or not Nagios will try
# and detect hosts and services that are "flapping".  
# Flapping occurs when a host or service changes between
# states too frequently.  When Nagios detects that a 
# host or service is flapping, it will temporarily suppress
# notifications for that host/service until it stops
# flapping.  Flap detection is very experimental, so read
# the HTML documentation before enabling this feature!
# Values: 1 = enable flap detection
#         0 = disable flap detection (default)

enable_flap_detection=1



# FLAP DETECTION THRESHOLDS FOR HOSTS AND SERVICES
# Read the HTML documentation on flap detection for
# an explanation of what this option does.  This option
# has no effect if flap detection is disabled.

low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0



# DATE FORMAT OPTION
# This option determines how short dates are displayed. Valid options
# include:
#	us		(MM-DD-YYYY HH:MM:SS)
#	euro    	(DD-MM-YYYY HH:MM:SS)
#	iso8601		(YYYY-MM-DD HH:MM:SS)
#	strict-iso8601	(YYYY-MM-DDTHH:MM:SS)
#

date_format=us




# TIMEZONE OFFSET
# This option is used to override the default timezone that this
# instance of Nagios runs in.  If not specified, Nagios will use
# the system configured timezone.
#
# NOTE: In order to display the correct timezone in the CGIs, you
# will also need to alter the Apache directives for the CGI path 
# to include your timezone.  Example:
#
#   <Directory "/usr/local/nagios/sbin/">
#      SetEnv TZ "Australia/Brisbane"
#      ...
#   </Directory>

#use_timezone=US/Mountain
#use_timezone=Australia/Brisbane



# ILLEGAL OBJECT NAME CHARACTERS
# This option allows you to specify illegal characters that cannot
# be used in host names, service descriptions, or names of other
# object types.

illegal_object_name_chars=`~!$%^&*|'"<>?,()=



# ILLEGAL MACRO OUTPUT CHARACTERS
# This option allows you to specify illegal characters that are
# stripped from macros before being used in notifications, event
# handlers, etc.  This DOES NOT affect macros used in service or
# host check commands.
# The following macros are stripped of the characters you specify:
#	$HOSTOUTPUT$
#	$HOSTPERFDATA$
#	$HOSTACKAUTHOR$
#	$HOSTACKCOMMENT$
#	$SERVICEOUTPUT$
#	$SERVICEPERFDATA$
#	$SERVICEACKAUTHOR$
#	$SERVICEACKCOMMENT$

illegal_macro_output_chars=`~$&|'"<>



# REGULAR EXPRESSION MATCHING
# This option controls whether or not regular expression matching
# takes place in the object config files.  Regular expression
# matching is used to match host, hostgroup, service, and service
# group names/descriptions in some fields of various object types.
# Values: 1 = enable regexp matching, 0 = disable regexp matching

use_regexp_matching=0



# "TRUE" REGULAR EXPRESSION MATCHING
# This option controls whether or not "true" regular expression 
# matching takes place in the object config files.  This option
# only has an effect if regular expression matching is enabled
# (see above).  If this option is DISABLED, regular expression
# matching only occurs if a string contains wildcard characters
# (* and ?).  If the option is ENABLED, regexp matching occurs
# all the time (which can be annoying).
# Values: 1 = enable true matching, 0 = disable true matching

use_true_regexp_matching=0



# ADMINISTRATOR EMAIL/PAGER ADDRESSES
# The email and pager address of a global administrator (likely you).
# Nagios never uses these values itself, but you can access them by
# using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification
# commands.

admin_email=nagios@localhost
admin_pager=pagenagios@localhost



# DAEMON CORE DUMP OPTION
# This option determines whether or not Nagios is allowed to create
# a core dump when it runs as a daemon.  Note that it is generally
# considered bad form to allow this, but it may be useful for
# debugging purposes.  Enabling this option doesn't guarantee that
# a core file will be produced, but that's just life...
# Values: 1 - Allow core dumps
#         0 - Do not allow core dumps (default)

daemon_dumps_core=0



# LARGE INSTALLATION TWEAKS OPTION
# This option determines whether or not Nagios will take some shortcuts
# which can save on memory and CPU usage in large Nagios installations.
# Read the documentation for more information on the benefits/tradeoffs
# of enabling this option.
# Values: 1 - Enabled tweaks
#         0 - Disable tweaks (default)

use_large_installation_tweaks=0



# ENABLE ENVIRONMENT MACROS
# This option determines whether or not Nagios will make all standard
# macros available as environment variables when host/service checks
# and system commands (event handlers, notifications, etc.) are
# executed.
# Enabling this is a very bad idea for anything but very small setups,
# as it means plugins, notification scripts and eventhandlers may run
# out of environment space. It will also cause a significant increase
# in CPU- and memory usage and drastically reduce the number of checks
# you can run.
# Values: 1 - Enable environment variable macros
#         0 - Disable environment variable macros (default)

enable_environment_macros=0



# CHILD PROCESS MEMORY OPTION
# This option determines whether or not Nagios will free memory in
# child processes (processed used to execute system commands and host/
# service checks).  If you specify a value here, it will override
# program defaults.
# Value: 1 - Free memory in child processes
#        0 - Do not free memory in child processes

#free_child_process_memory=1



# CHILD PROCESS FORKING BEHAVIOR
# This option determines how Nagios will fork child processes
# (used to execute system commands and host/service checks).  Normally
# child processes are fork()ed twice, which provides a very high level
# of isolation from problems.  Fork()ing once is probably enough and will
# save a great deal on CPU usage (in large installs), so you might
# want to consider using this.  If you specify a value here, it will
# program defaults.
# Value: 1 - Child processes fork() twice
#        0 - Child processes fork() just once

#child_processes_fork_twice=1



# DEBUG LEVEL
# This option determines how much (if any) debugging information will
# be written to the debug file.  OR values together to log multiple
# types of information.
# Values: 
#          -1 = Everything
#          0 = Nothing
#	   1 = Functions
#          2 = Configuration
#          4 = Process information
#	   8 = Scheduled events
#          16 = Host/service checks
#          32 = Notifications
#          64 = Event broker
#          128 = External commands
#          256 = Commands
#          512 = Scheduled downtime
#          1024 = Comments
#          2048 = Macros

debug_level=0



# DEBUG VERBOSITY
# This option determines how verbose the debug log out will be.
# Values: 0 = Brief output
#         1 = More detailed
#         2 = Very detailed

debug_verbosity=1



# DEBUG FILE
# This option determines where Nagios should write debugging information.

debug_file=/usr/local/nagios/var/nagios.debug



# MAX DEBUG FILE SIZE
# This option determines the maximum size (in bytes) of the debug file.  If
# the file grows larger than this size, it will be renamed with a .old
# extension.  If a file already exists with a .old extension it will
# automatically be deleted.  This helps ensure your disk space usage doesn't
# get out of control when debugging Nagios.

max_debug_file_size=1000000



# Should we allow hostgroups to have no hosts, we default this to off since
# that was the old behavior

allow_empty_hostgroup_assignment=0



# Normally worker count is dynamically allocated based on 1.5 * number of cpu's
# with a minimum of 4 workers.  This value will override the defaults

#check_workers=3



# EXPERIMENTAL load controlling options
# To get current defaults based on your system issue a command to
# the query handler. Please note that this is an experimental feature
# and not meant for production use. Used incorrectly it can induce
# enormous latency.
# #core loadctl
#   jobs_max - The maximum amount of jobs to run at one time
#   jobs_min - The minimum amount of jobs to run at one time
#   jobs_limit - The maximum amount of jobs the current load lets us run
#   backoff_limit - The minimum backoff_change
#   backoff_change - # of jobs to remove from jobs_limit when backing off
#   rampup_limit - Minimum rampup_change
#   rampup_change - # of jobs to add to jobs_limit when ramping up
# NOTE: The backoff_limit and rampup_limit are NOT used by anything currently,
#       so if your system is under load nothing will actively modify the jobs
#       even if you have these options enabled, they are for external
#       connector information only.  However, if you change the jobs_max or
#       jobs_min manually here or through the query handler interface that
#       WILL affect your system
#loadctl_options=jobs_max=100;backoff_limit=10;rampup_change=5
/usr/local/nagios/etc/objects/windows.cfg

Code: Select all

###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
#	 files that get installed with the Nagios quickstart guide.
#
###############################################################################




###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################

# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
	name	tpl
	use	generic-host
	check_period	24x7
	check_interval	5
	retry_interval	1
	max_check_attempts	10
	check_command	check-host-alive
	notification_period	24x7
	notification_interval	30
	notification_options	d,r
	contact_groups	admins
	register	0
	}


define host{
	#use		windows-server	; Inherit default values from a template
	use	tpl
	host_name	WA-MKOT2	; The name we're giving to this host
	alias		WA-MKOT2	; A longer name associated with the host
	address		192.168.20.103	; IP address of the host
	passive_checks_enabled	1
	active_checks_enabled	0
	}

define host{
	#use		windows-server	; Inherit default values from a template
	use 	tpl
	host_name	kot	; The name we're giving to this host
	alias		WinXP	; A longer name associated with the host
	address		192.168.20.105	; IP address of the host
	passive_checks_enabled	1
	active_checks_enabled	0
	}



###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################


# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group

define hostgroup{
	hostgroup_name	windows-servers	; The name of the hostgroup
	alias		Windows Servers	; Long name of the group
	}




###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################


# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above

#define service{
#	use			generic-service
	#host_name		winserver
#	host_name		WA-MKOT2, WinXP
#	service_description	NSClient++ Version
#	check_command		check_nt!CLIENTVERSION
#	}



# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above

#define service{
#	use			generic-service
	#host_name		winserver
#	host_name		WA-MKOT2, kot
#	service_description	Uptime
#	check_command		check_nt!UPTIME
#	}



# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above

define service{
	use			generic-service
	#host_name		winserver
	service_description	CPU Load
	#check_command		check_nt!CPULOAD!-l 5,80,90
	host_name		WA-MKOT2, kot
	passive_checks_enabled	1
	active_checks_enabled	0
	check_command		check_nrpe!alias_cpu
	}



# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above

define service{
	use			generic-service
	#host_name		winserver
	host_name		WA-MKOT2, kot
	service_description	Memory Usage
	#check_command		check_nt!MEMUSE!-w 80 -c 90
	check_command		check_nrpe!alias_mem
	passive_checks_enabled	1
	active_checks_enabled	0
	}



# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
	use			generic-service
	#host_name		winserver
	host_name		WA-MKOT2, kot
	service_description	C:\ Drive Space
	#check_command		check_nt!USEDDISKSPACE!-l c -w 80 -c 90
	check_command		check_nrpe!alias_disk
	passive_checks_enabled	1
	active_checks_enabled	0
	}



# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above

#define service{
#	use			generic-service
	#host_name		winserver
#	host_name		WA-MKOT2
#	service_description	W3SVC
#	check_command		check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
#	}



# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above

#define service{
#	use			generic-service
	#host_name		winserver
#	host_name		WA-MKOT2
#	service_description	Explorer
#	check_command		check_nt!PROCSTATE!-d SHOWALL -l explorer.exe
#	}

/usr/local/nagios/etc/objects/commands.cfg

Code: Select all

###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.0.3
#
#
# NOTES: This config file provides you with some example command definitions
#        that you can reference in host, service, and contact definitions.
#       
#        You don't need to keep commands in a separate file from your other
#        object definitions.  This has been done just to make things easier to
#        understand.
#
###############################################################################


################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require 
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################


# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
	}

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
	}





################################################################################
#
# SAMPLE HOST CHECK COMMANDS
#
################################################################################


# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip 
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)

# 'check-host-alive' command definition
define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }




################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands.  They may or may not work on
# your system, as they must be modified for your plugins.  See the HTML 
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE:  The following 'check_local_...' functions are designed to monitor
#        various metrics on the host that Nagios is running on (i.e. this one).
################################################################################

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }


# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }


# 'check_local_swap' command definition
define command{
	command_name	check_local_swap
	command_line	$USER1$/check_swap -w $ARG1$ -c $ARG2$
	}


# 'check_local_mrtgtraf' command definition
define command{
	command_name	check_local_mrtgtraf
	command_line	$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
	}


################################################################################
# NOTE:  The following 'check_...' commands are used to monitor services on
#        both local and remote hosts.
################################################################################

# 'check_ftp' command definition
define command{
        command_name    check_ftp
        command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_hpjd' command definition
define command{
        command_name    check_hpjd
        command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
        }


# 'check_snmp' command definition
define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }


# 'check_ssh' command definition
define command{
	command_name	check_ssh
	command_line	$USER1$/check_ssh $ARG1$ $HOSTADDRESS$
	}


# 'check_dhcp' command definition
define command{
	command_name	check_dhcp
	command_line	$USER1$/check_dhcp $ARG1$
	}


# 'check_ping' command definition
define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }


# 'check_pop' command definition
define command{
        command_name    check_pop
        command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
        }


# 'check_imap' command definition
define command{
        command_name    check_imap
        command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
        }


# 'check_smtp' command definition
define command{
        command_name    check_smtp
        command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_tcp' command definition
define command{
	command_name	check_tcp
	command_line	$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
	}


# 'check_udp' command definition
define command{
	command_name	check_udp
	command_line	$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
	}


# 'check_nt' command definition
define command{
	command_name	check_nt
	command_line	$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
	}

# 'check_nrpe' command definition - passive checks
define command{
	command_name	check_nrpe
	command_line	$USER1$/check_nrpe -H $HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
	}

define command{
	command_name	cpu_check
	command_line	$USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
	}

################################################################################
#
# SAMPLE PERFORMANCE DATA COMMANDS
#
# These are sample performance data commands that can be used to send performance
# data output to two text files (one for hosts, another for services).  If you
# plan on simply writing performance data out to a file, consider using the 
# host_perfdata_file and service_perfdata_file options in the main config file.
#
################################################################################


# 'process-host-perfdata' command definition
define command{
	command_name	process-host-perfdata
	command_line	/usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
	}


# 'process-service-perfdata' command definition
define command{
	command_name	process-service-perfdata
	command_line	/usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
	}
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

And some of my /var/log/syslog

Code: Select all

Mar  5 21:12:59 nagios nsca[17097]: Connection from 192.168.20.103 port 14813
Mar  5 21:12:59 nagios nsca[17097]: Handling the connection...
Mar  5 21:13:00 nagios nsca[17097]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'disk', Return Code: '0', Output: 'OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78'
Mar  5 21:13:00 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:13:00 nagios nagios: Warning:  Passive check result was received for service 'disk' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:00 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:13:00 nagios nagios: External command error: Command failed
Mar  5 21:13:00 nagios nsca[17097]: End of connection...
Mar  5 21:13:16 nagios nsca[17098]: Connection from 192.168.20.103 port 16605
Mar  5 21:13:16 nagios nsca[17098]: Handling the connection...
Mar  5 21:13:17 nagios nsca[17098]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'mem', Return Code: '0', Output: 'OK: physical memory: Total: 7.91G - Used: 3.64G (46%) - Free: 4.27G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page'
Mar  5 21:13:17 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.64G (46%) - Free: 4.27G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page
Mar  5 21:13:17 nagios nagios: Warning:  Passive check result was received for service 'mem' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:17 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.64G (46%) - Free: 4.27G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.75G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page
Mar  5 21:13:17 nagios nagios: External command error: Command failed
Mar  5 21:13:17 nagios nsca[17098]: End of connection...
Mar  5 21:13:23 nagios nsca[17099]: Connection from 192.168.20.103 port 17885
Mar  5 21:13:23 nagios nsca[17099]: Handling the connection...
Mar  5 21:13:24 nagios nsca[17099]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'cpu', Return Code: '0', Output: 'OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90'
Mar  5 21:13:24 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90
Mar  5 21:13:24 nagios nagios: Warning:  Passive check result was received for service 'cpu' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:24 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90
Mar  5 21:13:24 nagios nagios: External command error: Command failed
Mar  5 21:13:24 nagios nsca[17099]: End of connection...
Mar  5 21:13:29 nagios nsca[17101]: Connection from 192.168.20.103 port 18141
Mar  5 21:13:29 nagios nsca[17101]: Handling the connection...
Mar  5 21:13:30 nagios nsca[17101]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'disk', Return Code: '0', Output: 'OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78'
Mar  5 21:13:30 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:13:30 nagios nagios: Warning:  Passive check result was received for service 'disk' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:30 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:13:30 nagios nagios: External command error: Command failed
Mar  5 21:13:30 nagios nsca[17101]: End of connection...
Mar  5 21:13:46 nagios nsca[17102]: Connection from 192.168.20.103 port 20445
Mar  5 21:13:46 nagios nsca[17102]: Handling the connection...
Mar  5 21:13:47 nagios nsca[17102]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'mem', Return Code: '0', Output: 'OK: physical memory: Total: 7.91G - Used: 3.65G (46%) - Free: 4.26G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page'
Mar  5 21:13:47 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.65G (46%) - Free: 4.26G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page
Mar  5 21:13:47 nagios nagios: Warning:  Passive check result was received for service 'mem' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:47 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.65G (46%) - Free: 4.26G (54%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%), page file: Total: 10.9G - Used: 5.76G (52%) - Free: 5.15G (48%)|'physical memory %'=46%;80;90 'physical memory'=3.64G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.75G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'page
Mar  5 21:13:47 nagios nagios: External command error: Command failed
Mar  5 21:13:47 nagios nsca[17102]: End of connection...
Mar  5 21:13:53 nagios nsca[17103]: Connection from 192.168.20.103 port 20701
Mar  5 21:13:53 nagios nsca[17103]: Handling the connection...
Mar  5 21:13:54 nagios nsca[17103]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'cpu', Return Code: '0', Output: 'OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90'
Mar  5 21:13:54 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90
Mar  5 21:13:54 nagios nagios: Warning:  Passive check result was received for service 'cpu' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:13:54 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=19%;80;90 '30s'=19%;80;90
Mar  5 21:13:54 nagios nagios: External command error: Command failed
Mar  5 21:13:54 nagios nsca[17103]: End of connection...
Mar  5 21:13:59 nagios nsca[17104]: Connection from 192.168.20.103 port 21981
Mar  5 21:13:59 nagios nsca[17104]: Handling the connection...
Mar  5 21:14:00 nagios nsca[17104]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'disk', Return Code: '0', Output: 'OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78'
Mar  5 21:14:00 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:14:00 nagios nagios: Warning:  Passive check result was received for service 'disk' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:14:00 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:14:00 nagios nagios: External command error: Command failed
Mar  5 21:14:00 nagios nsca[17104]: End of connection...
Mar  5 21:14:16 nagios nsca[17106]: Connection from 192.168.20.103 port 25309
Mar  5 21:14:16 nagios nsca[17106]: Handling the connection...
Mar  5 21:14:17 nagios nsca[17106]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'mem', Return Code: '0', Output: 'OK: physical memory: Total: 7.91G - Used: 3.64G (45%) - Free: 4.27G (55%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%), page file: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%)|'physical memory %'=45%;80;90 'physical memory'=3.62999G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.7G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'pa'
Mar  5 21:14:17 nagios nsca[17106]: End of connection...
Mar  5 21:14:17 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.64G (45%) - Free: 4.27G (55%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%), page file: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%)|'physical memory %'=45%;80;90 'physical memory'=3.62999G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.7G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'pa
Mar  5 21:14:17 nagios nagios: Warning:  Passive check result was received for service 'mem' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:14:17 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;mem;0;OK: physical memory: Total: 7.91G - Used: 3.64G (45%) - Free: 4.27G (55%), virtual memory: Total: 2G - Used: 533M (26%) - Free: 1.48G (74%), paged bytes: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%), page file: Total: 10.9G - Used: 5.74G (52%) - Free: 5.17G (48%)|'physical memory %'=45%;80;90 'physical memory'=3.62999G;6.32;7.11;0;7.9 'virtual memory %'=26%;80;90 'virtual memory'=532.69M;1638;1843.08;0;2047.87 'paged bytes %'=52%;80;90 'paged bytes'=5.7G;8.72;9.81;0;10.9 'page file %'=52%;80;90 'pa
Mar  5 21:14:17 nagios nagios: External command error: Command failed
Mar  5 21:14:23 nagios nsca[17109]: Connection from 192.168.20.103 port 28125
Mar  5 21:14:23 nagios nsca[17109]: Handling the connection...
Mar  5 21:14:24 nagios nsca[17109]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'cpu', Return Code: '0', Output: 'OK CPU Load ok.|'5m'=19%;80;90 '1m'=20%;80;90 '30s'=20%;80;90'
Mar  5 21:14:24 nagios nsca[17109]: End of connection...
Mar  5 21:14:24 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=20%;80;90 '30s'=20%;80;90
Mar  5 21:14:24 nagios nagios: Warning:  Passive check result was received for service 'cpu' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:14:24 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;cpu;0;OK CPU Load ok.|'5m'=19%;80;90 '1m'=20%;80;90 '30s'=20%;80;90
Mar  5 21:14:24 nagios nagios: External command error: Command failed
Mar  5 21:14:29 nagios nsca[17110]: Connection from 192.168.20.103 port 28893
Mar  5 21:14:29 nagios nsca[17110]: Handling the connection...
Mar  5 21:14:30 nagios nsca[17110]: SERVICE CHECK -> Host Name: 'WA-MKOT2', Service Description: 'disk', Return Code: '0', Output: 'OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78'
Mar  5 21:14:30 nagios nsca[17110]: End of connection...
Mar  5 21:14:31 nagios nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:14:31 nagios nagios: Warning:  Passive check result was received for service 'disk' on host 'WA-MKOT2', but the service could not be found!
Mar  5 21:14:31 nagios nagios: Error: External command failed -> PROCESS_SERVICE_CHECK_RESULT;WA-MKOT2;disk;0;OK: All drives within bounds.|'C:\ %'=35%;10;5 'C:\'=106.79G;16.32;8.09999;0;163.2 'D:\ %'=25%;10;5 'D:\'=101.66G;13.47;6.73;0;134.78
Mar  5 21:14:31 nagios nagios: External command error: Command failed


What should I do next to make it running properly? I'm close to give it up :evil:
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Configuring Notifications in Nagios Core

Post by sreinhardt »

You are getting passive results, however it appears the host/service name is incorrect. Take a look at this log message:
5 21:13:00 nagios nagios: Warning: Passive check result was received for service 'disk' on host 'WA-MKOT2', but the service could not be found!
Do you have a service named "disk" on host "WA-MKOT2"? Note that case is respected, and they must match.

Looking at your configs and logs, it seems that your cpu load service(as defined in your config) is coming in as just cpu, and your C:\ Drive Space service is the disk passive result. You can alter this on your nsclient or nagios configs, it depends on what you would like to do.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

nsclient.ini

Code: Select all

...
[/settings/scheduler/schedules]
cpu=alias_cpu
mem=alias_mem
disk=alias_disk
;service=alias_service

...
So if I want it to work, I need to add in commands.cfg file sth like that:

Code: Select all

# 'check_nrpe' command definition - passive checks
define command{
   command_name   check_nrpe
   command_line   $USER1$/check_nrpe -H $HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }

define command{
   command_name   cpu_check
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }
   
   define command{
   command_name   disk_check
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }
   
   define command{
   command_name   mem_check
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }

or

Code: Select all

# 'check_nrpe' command definition - passive checks
define command{
   command_name   check_nrpe
   command_line   $USER1$/check_nrpe -H $HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }

define command{
   command_name   cpu
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }
   
   define command{
   command_name   disk
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }
   
   define command{
   command_name   mem
   command_line   $USER1$/check_nrpe -$HOSTADDRESS$ -s passwd -p 5667 -c $ARG1$
   }

???

I need to monitor hosts CPU/MEMORY/HDD usage, and if usage is to high (>80% Warning, >90% Error) I need to get notification. I can't use default NRPE from Nagios Server, because I get notifications always when for example User finish his job and turn off hic computer - I'll get notification that host is unreachable. I need notofications only when usage of CPU/MEM/HDD is to high.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

Ok, I solved this problem. I would never think that (nsclient.ini)

Code: Select all

CPU Load=alias_cpu
MEM Load=alias_mem
DISK Load=alias_disk
MUST be the same as (windows.cfg)

Code: Select all

#CPU Usage
...
service_description    CPU Load
...

#MEM Usage
...
service_description    MEM Load
...

etc
Does anyone have NSC.ini file from NSClient 0.3.x? NSCLient++ 0.4.X doesn;t working at WinXP hosts (it gets crasched few hours after I install it on XP host). How should NSC.ini file looks for NSCA configuration?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Configuring Notifications in Nagios Core

Post by abrist »

The standard 3.9 config is attached below:
Attachments
NSC.ini
Default 0.3.9 NSClient config
(12.89 KiB) Downloaded 166 times
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mkot
Posts: 68
Joined: Tue Feb 25, 2014 1:47 am
Location: Poland

Re: Configuring Notifications in Nagios Core

Post by mkot »

Ok, I think I did it :) I configured passive checks at Windows XP/Vista/7 machines and it's working :)

I think that I'll try with Nagios Graph, it may be good stuff for reading informations about CPU/MEM/DISK Usage.

Thank you all for your help :)
Locked