Page 1 of 1
check_log3.pl - Log monitoring script
Posted: Thu Dec 10, 2015 5:19 am
by Sunnyb
Hello Team,
I have uploaded log monitoring script into my Fully Automated Nagios server.
Now when i add into commands.cfg like this :
define command{
command_name check_log3
command_line $USER1$/check_log3.pl $ARG1$ $HOSTADDRESS$ -l $ARG2$ -p $ARG3$ $ARG4$
}
and then i defined it's service in localhost.cfg :
define service{
use local-service
host_name HELP-SERVER
service_description LogFile
check_command check_log3!/home/dcofront/mod_jk.log!Error! -i
It will not read /home/dcofront/mod_jk.log file from the remote server.
Please help me in this, as i have tried many things but it's not work.
Regards,
Sunny
Re: check_log3.pl - Log monitoring script
Posted: Thu Dec 10, 2015 10:31 am
by hsmith
Can you try to run the command from the command line and post the output? That's the easiest way to test and get this working.
Re: check_log3.pl - Log monitoring script
Posted: Fri Dec 11, 2015 4:51 am
by Sunnyb
Hi,
Yes i tried, but it's not working.
My nrpe service is in stopped status.
I run this manual command :
# /usr/lib/nagios/plugins/check_nrpe -H hostaddress -c check_log3.pl -l /home/dcofront/mod_jk.log -p Error
But this command is not working, i found this error : check_log3 command is not defined, even i described this command in nrpe.cfg file like these and restarted nrpe service :
#command[check_log3]=/usr/lib/nagios/plugins/check_log3.pl -l /home/dcofront/mod_jk.log -p "Error"
after restarted the nrpe service, still got the command not defined error.
I stuck in this process because when i run check_log3.pl command to find a pattern in the server it's working, but when i do in remote server, it's not working also i installed nrpe in remote server and allowed host entry filled with server IP.
Right now my nrpe service is stopped in server, and my nagios is Fully Automated Nagios(FAN)
Can you help me in these ?
Regards,
Sunny
Re: check_log3.pl - Log monitoring script
Posted: Fri Dec 11, 2015 10:20 am
by rkennedy
Can you post your whole nrpe configuration file?
Re: check_log3.pl - Log monitoring script
Posted: Mon Dec 14, 2015 4:34 am
by Sunnyb
Yes, here is my nrpe.cfg file , but let you know once again my nrpe service in server is in stopped status.
--------------------------------------------------------------------------------------------------------------------------------------------
# LOG FACILITY
# The syslog facility that should be used for logging purposes.
log_facility=daemon
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number. The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
pid_file=/var/run/nrpe.pid
# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#server_port=5666
server_port=12489
# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#server_address=127.0.0.1
# NRPE USER
# This determines the effective user that the NRPE daemon should run as.
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_user=nagios
# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_group=nagios
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address. I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
allowed_hosts=127.0.0.1
# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed. This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=0
debug=0
# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
command_timeout=60
# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.
connection_timeout=300
#allow_weak_random_seed=1
command[check_users]=/usr/libexec/check_users -w 5 -c 10
command[check_load]=/usr/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/libexec/check_procs -w 150 -c 200
command[check_diskio]=/usr/lib/nagios/plugins/check_nrpe -H 103.29.28.2 -c check_diskio
------------------------------------------------------------------# END#---------------------------------------------------------------------------------------------------
Regards,
Sunny
Re: check_log3.pl - Log monitoring script
Posted: Mon Dec 14, 2015 10:24 am
by hsmith
How did you install the NRPE agent? Could it be running under xinetd instead of as a service?
What's the output of a netstat -antp command? command?