Page 2 of 3
Re: Grep Logfile on RHEL Server
Posted: Thu Apr 26, 2018 4:05 pm
by stonkers
Thanks!!!
Re: Grep Logfile on RHEL Server
Posted: Thu Apr 26, 2018 4:41 pm
by npolovenko
@stonkers, You're welcome! Let me know if it's ok to lock the thread.
Re: Grep Logfile on RHEL Server
Posted: Fri Apr 27, 2018 9:05 am
by stonkers
Ooops, sorry, a few more questions.
Re: Grep Logfile on RHEL Server
Posted: Fri Apr 27, 2018 9:21 am
by stonkers
I'm sorry, I do have questions about your values in the setup.
1) Are we able to use variables in the command setup or do we have to set up commands for each file we're going to monitor? We have a lot of these same files but they're in different directories, such as: /var/log/applogs/<serverName>/SystemOut.log
2) We won't be grepping logs on any localhost files, do we set "Manage Hosts" to IP address of the host we want to look at?
Sorry, I don't have the screens available so that I can play around and want to give explicit instructions or my nagios admin may go away and never come back...

Re: Grep Logfile on RHEL Server
Posted: Fri Apr 27, 2018 1:37 pm
by npolovenko
@stonkers, Sure, you can split the command and use arguments:
Untitled.png
Untitled1.png
However, the "old log" file needs to be different for each serivce, so don't forget to change it($ARG3$).
2. You'd need some kind of agent to run the plugin on the remote host. For example, nrpe:
https://assets.nagios.com/downloads/nag ... _Agent.pdf
Have you configured the nrpe agent before?
Re: Grep Logfile on RHEL Server
Posted: Fri Apr 27, 2018 1:48 pm
by stonkers
Yes, we have NRPE set up on all of our hosts. Just from my vantage point, I'm unable to see how to instruct him to point to the correct servers. Thanks!
Re: Grep Logfile on RHEL Server
Posted: Fri Apr 27, 2018 3:46 pm
by kyang
Great, since you have NRPE installed on all servers.
You would have to make sure that you have the
check_log plugin on the other remote server.
Along with that, you need to add your XI ip address into the remote server's nrpe.cfg
After that, you have to make sure the correct command is inside the nrpe.cfg.
# most importantly, make sure you can execute the plugin using NRPE. Or at least test the connection from XI to the "correct servers"
# change ipAddress to your "correct server"
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H ipAddress
Make sure the above steps work before we go onto the next step.
Re: Grep Logfile on RHEL Server
Posted: Wed May 02, 2018 11:32 am
by stonkers
Yep, those all work.
Re: Grep Logfile on RHEL Server
Posted: Wed May 02, 2018 4:53 pm
by kyang
Okay,
You mentioned this before.
Just from my vantage point, I'm unable to see how to instruct him to point to the correct server
Since you have the plugin available on your remote host. Make sure you have the check_log command definitions defined on your remote host as well.
Something like this. Or you can hard code it.
Code: Select all
command[check_log]=/usr/local/nagios/libexec/check_log $ARG1$
Try using check_nrpe from the XI side to your remote host. Something like this.
Make sure to replace the values for -F, -O and -q
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H remotehost -c check_log -a '-F /the/path -O /tmp/oldLog -q error'
Re: Grep Logfile on RHEL Server
Posted: Tue May 08, 2018 7:41 am
by stonkers
Yep, that works on all the servers I want to run the test on.