Hi ,
Yes we dont have permission for server.log.User is not ready to give access for the same.
[root@dc1uat163 ~]# ls -l /apps/wildfly-11.0.0/standalone/log/server.log
-rw-r--r-- 1 root root 3630135 Jul 4 13:58 /apps/wildfly-11.0.0/standalone/log/server.log
=======================
Also user primary requirement is as below.Could you please suggest if any other way to configure such alerts.
The requirement is to check only one file every day for the ERROR/FATAL messages in the file.
Folder: /apps/wildfly-11.0.0/standalone/log/
File Name: server.log.yyyy-mm-dd (Take day - 1 file)
Eg:
Check server.log.2019-06-29 file on 2019-06-30,
Check server.log.2019-06-30 file on 2019-07-01,
Check server.log.2019-07-01 file on 2019-07-02,
Check server.log.2019-07-02 file on 2019-07-03 and so on
Thanks,
Priyanka
Nagios Core - LogFile Monitoring in Unix server
Re: Nagios Core - LogFile Monitoring in Unix server
Try this:
Code: Select all
./check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log -q "error"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios Core - LogFile Monitoring in Unix server
Hi ,
Thank you for the response @cdienger.
Tried the command you provided from our Nagios server and please find the output below and kindly suggest:
[root@dc2prd325 ~]# cd /usr/local/nagios/libexec
[root@dc2prd325 libexec]# ./check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log -q "error"
./check_log: line 76: ./utils.sh: No such file or directory
Regards,
Priyanka Bachu
Thank you for the response @cdienger.
Tried the command you provided from our Nagios server and please find the output below and kindly suggest:
[root@dc2prd325 ~]# cd /usr/local/nagios/libexec
[root@dc2prd325 libexec]# ./check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log -q "error"
./check_log: line 76: ./utils.sh: No such file or directory
Regards,
Priyanka Bachu
Re: Nagios Core - LogFile Monitoring in Unix server
What is the output of:
?
Make sure file is in there(attached here in case you are missing it), and the permissions look like:
They can be updated with:
Code: Select all
cd /usr/local/nagios/libexec
ll | grep utils.sh
Make sure file is in there(attached here in case you are missing it), and the permissions look like:
Code: Select all
-rwxrwxr-x 1 apache nagios 2791 Jul 3 12:19 utils.sh
Code: Select all
chown apache:nagios /usr/local/nagios/libexec/utils.sh
chmod 775 /usr/local/nagios/libexec/utils.sh
- Attachments
-
- utils.sh
- (2.73 KiB) Downloaded 168 times
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios Core - LogFile Monitoring in Unix server
Thank you @cdienger,
Copied utils.sh in Nagios server and performed the above steps you have provided.
If i am running the command locally on the remote server I am getting output.
Butin Nagios GUI We are getting Unknown error as below.Please suggest.
===================
Log check error: Log file /apps/wildfly-11.0.0/standalone/log/server.log.2019-07-11 does not exist!\n
==========================
Also Please find service and command definition declared in the Nagios server end.
define service{
use generic-service,srv-pnp
host_name dc1uat163
service_description file:/apps/wildfly-11.0.0/standalone/log/
#servicegroups sg_app_upm
#contact_groups cg_app_upm
contacts stummala, ysivasundaram2
check_command check_log_dc1uat163file
}
command definition in commands.cfg in our Nagios server :
define command{
command_name check_log_dc1uat163file
command_line $USER1$/check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log -q "error"
}
===================================
Regards,
Priyanka Bachu
Copied utils.sh in Nagios server and performed the above steps you have provided.
If i am running the command locally on the remote server I am getting output.
Butin Nagios GUI We are getting Unknown error as below.Please suggest.
===================
Log check error: Log file /apps/wildfly-11.0.0/standalone/log/server.log.2019-07-11 does not exist!\n
==========================
Also Please find service and command definition declared in the Nagios server end.
define service{
use generic-service,srv-pnp
host_name dc1uat163
service_description file:/apps/wildfly-11.0.0/standalone/log/
#servicegroups sg_app_upm
#contact_groups cg_app_upm
contacts stummala, ysivasundaram2
check_command check_log_dc1uat163file
}
command definition in commands.cfg in our Nagios server :
define command{
command_name check_log_dc1uat163file
command_line $USER1$/check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log -q "error"
}
===================================
Regards,
Priyanka Bachu
Re: Nagios Core - LogFile Monitoring in Unix server
What is the output of this command?
Code: Select all
ls -l /apps/wildfly-11.0.0/standalone/log/server.log.2019-07-11
Re: Nagios Core - LogFile Monitoring in Unix server
Hi All,
We have a test server and tried there creating a new testfile.log and testfile.log.2019-07-18 as previous day file.
New file:
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
Old file:
[root@dc2drpas008 linux-nrpe-agent]# cat testfile.log.2019-07-18
ERROR
We have used this command and plugin:
Please find the attachment for plugin script.
./check_log -F /root/linux-nrpe-agent/testfile.log.`date --date='yesterday' +"%Y-%m-%d"` -O /root/linux-nrpe-agent/testfile.log -q "ERROR"
Output when we run the command:
[root@dc2drpas008 libexec]# ./check_log -F /root/linux-nrpe-agent/testfile.log.`date --date='yesterday' +"%Y-%m-%d"` -O /root/linux-nrpe-agent/testfile.log -q "ERROR"
Log check ok - 0 pattern matches found|match=0;;;0
The old file data is copied to new file.
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log.2019-07-18
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
Please help how to rectify this problem.
Regards,
Priyanka
We have a test server and tried there creating a new testfile.log and testfile.log.2019-07-18 as previous day file.
New file:
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
Old file:
[root@dc2drpas008 linux-nrpe-agent]# cat testfile.log.2019-07-18
ERROR
We have used this command and plugin:
Please find the attachment for plugin script.
./check_log -F /root/linux-nrpe-agent/testfile.log.`date --date='yesterday' +"%Y-%m-%d"` -O /root/linux-nrpe-agent/testfile.log -q "ERROR"
Output when we run the command:
[root@dc2drpas008 libexec]# ./check_log -F /root/linux-nrpe-agent/testfile.log.`date --date='yesterday' +"%Y-%m-%d"` -O /root/linux-nrpe-agent/testfile.log -q "ERROR"
Log check ok - 0 pattern matches found|match=0;;;0
The old file data is copied to new file.
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
[root@dc2drpas008 linux-nrpe-agent]#cat testfile.log.2019-07-18
nagios
ERROR
unix
storage
WARN
ERROR
ERROR
Please help how to rectify this problem.
Regards,
Priyanka
- Attachments
-
- check_log.txt
- (6.74 KiB) Downloaded 164 times
Re: Nagios Core - LogFile Monitoring in Unix server
Try this instead:
This should create /apps/wildfly-11.0.0/standalone/log/server.log.o instead of overwriting /apps/wildfly-11.0.0/standalone/log/server.log.
Code: Select all
./check_log -F /apps/wildfly-11.0.0/standalone/log/server.log.`date --date='yesterday' +"%Y-%m-%d"` -O /apps/wildfly-11.0.0/standalone/log/server.log.o -q "error"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.