Ok, I managed to set up monitoring Windows hosts via nsca, sample code:
commands.cfg
Code: Select all
# Dodane 2014-03-26 - mkot
# 'check_nsca' command definition for passive hosts checking
define command{
command_name check_nsca
command_line $USER1$/check_nsca -H $HOSTADDRESS$ -c $ARG1$ -t 20
}
# KONIEC - 2014-03-26 - mkot
TAIWA.cfg (one of hosts' definition cfg file)
Code: Select all
# 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,nagiosgraph
hostgroup_name TAIWA
service_description CPU Load
check_command check_nsca!CPU Load
notification_options w,c
flap_detection_enabled 0
active_checks_enabled 0
passive_checks_enabled 1
}
# 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,nagiosgraph
hostgroup_name TAIWA
service_description MEM Load
check_command check_nsca!MEM Load
notification_options w,c
flap_detection_enabled 0
active_checks_enabled 0
passive_checks_enabled 1
}
# 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,nagiosgraph
hostgroup_name TAIWA
service_description DISK Load C
check_command check_nsca!DISK Load C
notification_options w,c
flap_detection_enabled 0
active_checks_enabled 0
passive_checks_enabled 1
}
NSC.ini and
nsclient.ini
Code: Select all
NSC.ini
CPU Load=checkCPU warn=50 crit=80 time=20m time=10s time=4
MEM Load=checkMem MaxWarn=85% MaxCrit=90% ShowAll type=physical
DISK Load C=CheckDriveSize MinWarn=2% MinCrit=1% Drive=C FilterType=FIXED
nsclient.ini
; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = checkCPU warn=50 crit=80 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_c = CheckDriveSize MinWarn=2% MinCrit=1% Drive=C FilterType=FIXED
; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = checkMem MaxWarn=85% MaxCrit=90% ShowAll=long type=physical
CPU Load=alias_cpu
MEM Load=alias_mem
DISK Load C=alias_disk_c
Now I want make Active checking for Linux servers (Ubuntu, CentOS, FreeBSD, IPCop (firewall -
http://www.ipcop.org/)). I added command for checking nrpe in
commands.cfg file:
Code: Select all
# Dodane 2014-03-06 - mkot
# 'check_nrpe' command definition for active hosts checking
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20
}
and added some piece of code to
linux.cfg file:
Code: Select all
# Użycie dysków twardych #
# główna partycja - /
define service{
use local-service
host_name domena-wa, router-wa-vectra
service_description /
check_command check_nrpe!check_/
notifications_enabled 1
flap_detection_enabled 0
active_checks_enabled 1
passive_checks_enabled 0
}
At Linux host I installed nrpe addon with xinetd, the configuration is:
- added:
user/group
-
/etc/xinet.d/nrpe
Code: Select all
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = <IP_Nagios_Server>
}
-
/usr/local/nagios/etc/nrpe.cfg
Code: Select all
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=<IP_Nagios_Server>
dont_blame_nrpe=0
allow_bash_command_substitution=0
debug=1
command_timeout=60
connection_timeout=300
command[check_/]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei1
#command[check_/mnt/backup]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/sda1
#command[check_/home]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei6
#command[check_/home/domena/raporty]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_jifggjdg6
#command[check_/home/domena/wymiana_miedzyoddzial]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_jifggjdg5
#command[check_raid]=/usr/local/nagios/libexec/check_raid
#command[check_mem]=/usr/local/nagios/libexec/check_mem.pl -w 98 -c 99
#command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 98 -c 99
-
/etc/services
Code: Select all
root@domena-wa:~# netstat -an |grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
Code: Select all
root@domena-wa:~# ps aux |grep nrpe
root 6295 0.0 0.0 5708 768 pts/0 S+ 21:16 0:00 grep --color=auto nrpe
And this is not working correctly, I get status
OK with status information:
Code: Select all
(Return code of 255 is out of bounds)
EDIT:
Code from
/var/log/syslog from Nagios Server
Code: Select all
Mar 26 22:11:18 nagios nagios: Warning: Return code of 255 for check of service '/' on host 'domena-wa' was out of bounds.
Code from
/var/log/syslog from monitored Linux Ubuntu Server:
Code: Select all
Mar 26 20:49:47 domena-wa nrpe[5778]: Added command[check_/]=/usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei1
When I run /usr/local/nagios/libexec/check_disk -w 1% -c 0% -p /dev/mapper/pdc_dfagcaei1 at LUS I get:
Code: Select all
DISK OK - free space: / 32982 MB (74% inode=96%);| /=11567MB;46463;46933;0;46933