Nagios® Core™ Version 4.0.8

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.
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Nagios® Core™ Version 4.0.8

Post by Ulas »

I have installed Nagios® Core™ Version 4.0.8 on Ubuntu 14.04. When i installed Nagios on this machine, i faced problem with adding linux client.
my linux client version same as server Nagios.
on client side /etc/nagios/nrpe.cfg output

allowed_hosts=192.168.169.121,127.0.0.1

command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

also
root@dosya-paylasim:/usr/lib/nagios/plugins# lsof -i:5666
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nrpe 8659 nagios 4u IPv4 154828 0t0 TCP *:nrpe (LISTEN)
nrpe 8659 nagios 5u IPv6 154829 0t0 TCP *:nrpe (LISTEN)
****************************************************************************************************************************************************************************
at server side my command.cfg
# '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$
}

my remote machine cfg file is ubuntu.cfg and services identified as,
###############################################################################
###############################################################################
#
# HOST DEFINITION
#
###############################################################################
###############################################################################

# Define a host for the local machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name domates.karel.com.tr
alias dosya_paylasim1
address 192.168.169.120
}






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


# Define a service to "ping" the local machine

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}


# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Root Partition
check_command check_local_disk!20%!10%!/
}



# Define a service to check the number of currently logged in
# users on the local machine. Warning if > 20 users, critical
# if > 50 users.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Current Users
check_command check_local_users!20!50
}


# Define a service to check the number of currently running procs
# on the local machine. Warning if > 250 processes, critical if
# > 400 users.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Total Processes
check_command check_local_procs!250!400!RSZDT
}



# Define a service to check the load on the local machine.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}



# Define a service to check the swap usage the local machine.
# Critical if less than 10% of swap is free, warning if less than 20% is free

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Swap Usage
check_command check_local_swap!20!10
}



# Define a service to check SSH on the local machine.
# Disable notifications for this service by default, as not all users may have SSH enabled.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description SSH
check_command check_ssh
notifications_enabled 0
}



# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description HTTP
check_command check_http
notifications_enabled 0
}

bu i have trouble at some of the services which are attached to mail
i checked my root partition shows wrong.i assume that others would be too.
Attachments
services
services
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios® Core™ Version 4.0.8

Post by ssax »

Open the /usr/local/nagios/etc/resource.cfg file in your preferred text editor.

Edit the $USER1$ macro (typically the second line of the file) to be as follows:

Code: Select all

$USER1$=LC_ALL=C /usr/local/nagios/libexec
Save and close the file, then restart Nagios with the following command:

Code: Select all

service nagios restart
Let us know if that works for you.
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Re: Nagios® Core™ Version 4.0.8

Post by Ulas »

Unfortunately it doesn't work. because it is defined formerly.
actually the issue is, client defination about the root partition same as the local nagios server.
what i am doing wrong.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios® Core™ Version 4.0.8

Post by scottwilkerson »

Code: Select all

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
The check command for "Root Partition" service on domates.karel.com.tr is defined as check_local_disk

So it is not performing a nrpe check on the other server.

You need to define an NRPE command on the nagios server like so

Code: Select all

define command {
       command_name                             check_nrpe
       command_line                             $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
Then change the root partition command to something like

Code: Select all

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Root Partition
check_command check_nrpe!check_disk!-a ' 20% 10% /'
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Re: Nagios® Core™ Version 4.0.8

Post by Ulas »

First of all thanks for your information scottwilkerson,
my client ip is 192.168.169.120
i try nrpe_check at client side but i got
root@dosya-paylasim:/etc/nagios# /usr/lib/nagios/plugins/check_nrpe -H localhost
CHECK_NRPE: Error - Could not complete SSL handshake.
after that i installed xinetd, but same error it does
root@dosya-paylasim:/usr/local/nagios/libexec# /usr/lib/nagios/plugins/check_nrpe -H 192.168.169.120
CHECK_NRPE: Error - Could not complete SSL handshake.

@ nagios server (192.168.169.121)
root@dosya:/usr/local/nagios/etc/servers# /usr/lib/nagios/plugins/check_nrpe -H 192.168.169.120
NRPE v2.15
You have new mail in /var/mail/root


my nagios server ip 192.168.169.121



my nrpe.cfg file
root@dosya-paylasim:/etc/nagios# egrep -v '^#|^$' nrpe.cfg
log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=192.168.169.121,127.0.0.1

dont_blame_nrpe=0
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_all_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10%
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10
include=/etc/nagios/nrpe_local.cfg


also my

root@dosya-paylasim:/usr/local/nagios/libexec# ls -ltr
total 0
lrwxrwxrwx 1 root root 34 Mar 18 23:13 check_nrpe -> /usr/lib/nagios/plugins/check_nrpe
lrwxrwxrwx 1 root root 35 Mar 19 09:50 check_users -> /usr/lib/nagios/plugins/check_users
lrwxrwxrwx 1 root root 34 Mar 19 09:50 check_load -> /usr/lib/nagios/plugins/check_load
lrwxrwxrwx 1 root root 34 Mar 19 09:50 check_disk -> /usr/lib/nagios/plugins/check_disk
lrwxrwxrwx 1 root root 35 Mar 19 09:51 check_procs -> /usr/lib/nagios/plugins/check_procs

root@dosya-paylasim:/usr/lib/nagios/plugins# ls -ltr
total 2256
-rwxr-xr-x 1 root root 22992 Jan 13 2014 check_nrpe
-rwxr-xr-x 1 root root 2917 Mar 12 2014 utils.sh
-rw-r--r-- 1 root root 1936 Mar 12 2014 utils.pm
-rwxr-xr-x 1 root root 2930 Mar 12 2014 check_wave
-rwxr-xr-x 1 root root 1453 Mar 12 2014 check_sensors
-rwxr-xr-x 1 root root 9575 Mar 12 2014 check_rpc
-rwxr-xr-x 1 root root 8781 Mar 12 2014 check_oracle
-rwxr-xr-x 1 root root 20278 Mar 12 2014 check_mailq
-rwxr-xr-x 1 root root 6023 Mar 12 2014 check_log
-rwxr-xr-x 1 root root 6881 Mar 12 2014 check_ircd
-rwxr-xr-x 1 root root 12589 Mar 12 2014 check_ifstatus
-rwxr-xr-x 1 root root 15128 Mar 12 2014 check_ifoperstatus
-rwxr-xr-x 1 root root 6309 Mar 12 2014 check_flexlm
-rwxr-xr-x 1 root root 3047 Mar 12 2014 check_file_age
-rwxr-xr-x 1 root root 9283 Mar 12 2014 check_disk_smb
-rwxr-xr-x 1 root root 2236 Mar 12 2014 check_breeze
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_udp -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_ssmtp -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_spop -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_simap -> check_tcp
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_rta_multi -> check_icmp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_pop -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_nntps -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_nntp -> check_tcp
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_ldaps -> check_ldap
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_jabber -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_imap -> check_tcp
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_host -> check_icmp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_ftp -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_clamd -> check_tcp
-rwxr-xr-x 1 root root 39048 Mar 12 2014 urlize
-rwxr-xr-x 1 root root 43336 Mar 12 2014 negate
-rwxr-xr-x 1 root root 39080 Mar 12 2014 check_users
-rwxr-xr-x 1 root root 51576 Mar 12 2014 check_ups
-rwxr-xr-x 1 root root 47480 Mar 12 2014 check_time
-rwxr-xr-x 1 root root 60248 Mar 12 2014 check_tcp
-rwxr-xr-x 1 root root 43240 Mar 12 2014 check_swap
-rwxr-xr-x 1 root root 43384 Mar 12 2014 check_ssh
-rwxr-xr-x 1 root root 72936 Mar 12 2014 check_snmp
-rwxr-xr-x 1 root root 64216 Mar 12 2014 check_smtp
-rwxr-xr-x 1 root root 47512 Mar 12 2014 check_real
-rwxr-xr-x 1 root root 55992 Mar 12 2014 check_procs
-rwxr-xr-x 1 root root 55768 Mar 12 2014 check_ping
-rwxr-xr-x 1 root root 51896 Mar 12 2014 check_pgsql
-rwxr-xr-x 1 root root 47416 Mar 12 2014 check_overcr
-rwxr-xr-x 1 root root 67928 Mar 12 2014 check_nwstat
-rwxr-xr-x 1 root root 51632 Mar 12 2014 check_ntp_time
-rwxr-xr-x 1 root root 55960 Mar 12 2014 check_ntp_peer
-rwxr-xr-x 1 root root 55736 Mar 12 2014 check_ntp
-rwxr-xr-x 1 root root 55736 Mar 12 2014 check_nt
-rwxr-xr-x 1 root root 47376 Mar 12 2014 check_nagios
-rwxr-xr-x 1 root root 47552 Mar 12 2014 check_mysql_query
-rwxr-xr-x 1 root root 51968 Mar 12 2014 check_mysql
-rwxr-xr-x 1 root root 43280 Mar 12 2014 check_mrtgtraf
-rwxr-xr-x 1 root root 43400 Mar 12 2014 check_mrtg
-rwxr-xr-x 1 root root 43208 Mar 12 2014 check_load
-rwxr-xr-x 1 root root 47784 Mar 12 2014 check_ldap
-rwxr-xr-x 1 root root 43472 Mar 12 2014 check_ide_smart
-rwxr-xr-x 1 root root 59440 Mar 12 2014 check_icmp
-rwxr-xr-x 1 root root 93528 Mar 12 2014 check_http
-rwxr-xr-x 1 root root 51392 Mar 12 2014 check_hpjd
-rwxr-xr-x 1 root root 34808 Mar 12 2014 check_dummy
-rwxr-xr-x 1 root root 51608 Mar 12 2014 check_dns
-rwxr-xr-x 1 root root 60568 Mar 12 2014 check_disk
-rwxr-xr-x 1 root root 51728 Mar 12 2014 check_dig
-rwxr-xr-x 1 root root 55672 Mar 12 2014 check_dhcp
-rwxr-xr-x 1 root root 59928 Mar 12 2014 check_dbi
-rwxr-xr-x 1 root root 39248 Mar 12 2014 check_cluster
-rwxr-xr-x 1 root root 56120 Mar 12 2014 check_by_ssh
-rwxr-xr-x 1 root root 51624 Mar 12 2014 check_apt
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios® Core™ Version 4.0.8

Post by jdalrymple »

NRPE is run from the Nagios server side, you would rarely have a need to run `check_nrpe -H localhost`

nrpe.cfg defines what is done at the client side when the check_nrpe command runs at the server side reaching out to the client side. The roles get flip flopped as the nrpe server is running on the client and the nrpe client is on the server.

Adjust your nrpe command definition to look like scottwilkerson indicated above.

Adjust your services definitions (services.cfg) to look like this:

Code: Select all

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Root Partition
check_command	check_nrpe!check_disk
}

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Current Users
check_command	check_nrpe!check_users
}

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Total Processes
check_command	check_nrpe!check_procs
check_command	check_procs!250!400!RSZDT
}

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Current Load
check_command	check_nrpe!check_load
!5.0,4.0,3.0!10.0,6.0,4.0
}

define service{
use generic-service ; Name of service template to use
host_name domates.karel.com.tr
service_description Swap Usage
check_command	check_nrpe!check_swap
!20!10
}
Adjust the appropriate lines in your nrpe.cfg on the remote machine to look like this:

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_users]=/usr/local/nagios/libexec/check_users -w 20 -c 50
command[check_load]=/usr/local/nagios/libexec/check_load -w 5.0,4.0,3.0 -c 10.0,6.0,4.0
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 250 -c 400 -s RSZDT
commnad[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
Does this make sense?
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Re: Nagios® Core™ Version 4.0.8

Post by Ulas »

thanks for your reply jdalrymple

now i got this error;
root@dosya:/usr/local/nagios/etc/objects# sudo service nagios restart
Running configuration check...

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'Current Users' on host 'domates.karel.com.tr' (config file '/usr/local/nagios/etc/objects/ubuntu.cfg', starting on line 53)
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Error: Service check command 'check_procs!250!400!RSZDT' specified in service 'Total Processes' for host 'domates.karel.com.tr' not defined anywhere!
Warning: Service 'Current Load' on host 'localhost' has no check time period defined!
Warning: Service 'Current Users' on host 'localhost' has no check time period defined!
Warning: Service 'HTTP' on host 'localhost' has no check time period defined!
Warning: Service 'PING' on host 'localhost' has no check time period defined!
Warning: Service 'Root Partition' on host 'localhost' has no check time period defined!
Warning: Service 'SSH' on host 'localhost' has no check time period defined!
Warning: Service 'Swap Usage' on host 'localhost' has no check time period defined!
Warning: Service 'Total Processes' on host 'localhost' has no check time period defined!
Checked 47 services.
Checked 7 hosts.
Checked 2 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 26 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 7 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 8
Total Errors: 1

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

root@dosya:/usr/local/nagios/etc/objects#
root@dosya:/usr/local/nagios/etc/objects# sudo service nagios restart
Running configuration check...

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'Current Users' on host 'domates.karel.com.tr' (config file '/usr/local/nagios/etc/objects/ubuntu.cfg', starting on line 53)
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Error: Service check command 'check_procs!250!400!RSZDT' specified in service 'Total Processes' for host 'domates.karel.com.tr' not defined anywhere!
Warning: Service 'Current Load' on host 'localhost' has no check time period defined!
Warning: Service 'Current Users' on host 'localhost' has no check time period defined!
Warning: Service 'HTTP' on host 'localhost' has no check time period defined!
Warning: Service 'PING' on host 'localhost' has no check time period defined!
Warning: Service 'Root Partition' on host 'localhost' has no check time period defined!
Warning: Service 'SSH' on host 'localhost' has no check time period defined!
Warning: Service 'Swap Usage' on host 'localhost' has no check time period defined!
Warning: Service 'Total Processes' on host 'localhost' has no check time period defined!
Checked 47 services.
Checked 7 hosts.
Checked 2 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 26 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 7 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 8
Total Errors: 1

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

also my configuration files under /usr/local/nagios/etc/ is
please find at attachment
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Re: Nagios® Core™ Version 4.0.8

Post by Ulas »

attachment is forgotten
it is added.
Attachments
resource.cfg
(1.28 KiB) Downloaded 459 times
nagios.cfg
(43.57 KiB) Downloaded 461 times
objects.rar
(14.86 KiB) Downloaded 305 times
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios® Core™ Version 4.0.8

Post by jdalrymple »

The service definitions I gave you were intended to replace the ones you already defined. You cannot have multiple services with the same name for the same host.

Please adjust accordingly and post the results.
Ulas
Posts: 11
Joined: Thu Mar 19, 2015 4:34 am

Re: Nagios® Core™ Version 4.0.8

Post by Ulas »

Thanks for your reply
Could u send me as a example of your object folder and nagios.cfg file?
regards
Locked