Grep Logfile on RHEL Server
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Grep Logfile on RHEL Server
@stonkers, You're welcome! Let me know if it's ok to lock the thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Grep Logfile on RHEL Server
Ooops, sorry, a few more questions.
Last edited by stonkers on Fri Apr 27, 2018 9:22 am, edited 1 time in total.
Re: Grep Logfile on RHEL Server
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...
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...
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Grep Logfile on RHEL Server
@stonkers, Sure, you can split the command and use arguments:
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?
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?
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Grep Logfile on RHEL Server
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!
-
kyang
Re: Grep Logfile on RHEL Server
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"
Make sure the above steps work before we go onto the next step.
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 ipAddressRe: Grep Logfile on RHEL Server
Yep, those all work.
-
kyang
Re: Grep Logfile on RHEL Server
Okay,
You mentioned this before.
Something like this. Or you can hard code it.
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
You mentioned this before.
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.Just from my vantage point, I'm unable to see how to instruct him to point to the correct server
Something like this. Or you can hard code it.
Code: Select all
command[check_log]=/usr/local/nagios/libexec/check_log $ARG1$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
Yep, that works on all the servers I want to run the test on.