Page 3 of 5

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:04 pm
by gdolidze
[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 67.111.179.155 -c check_log_3 -n
CHECK_NRPE: Error receiving data from daemon.
[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 67.111.179.155 -c check_log_3
OK: Found 0 lines (limit=1/1): No matches found.|lines=0

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:14 pm
by jolson

Code: Select all

[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 67.111.179.155 -c check_log_3
OK: Found 0 lines (limit=1/1): No matches found.|lines=0
Good stuff - so it's working!

Feel free to change the client machines nrpe.cfg as you see fit - currently it's scanning for the string "someline". You can change this to whatever you'd like.

You could also add several different ones, and issue multiple calls to them. For example:

Client NRPE.cfg:

Code: Select all

command[check_log_3]=/usr/local/nagios/libexec/check_log3.pl -l /var/log/messages -p error -c 1
command[check_log_4]=/usr/local/nagios/libexec/check_log3.pl -l /var/log/httpd/error_log -p 502 -c 1
command[check_log_5]=/usr/local/nagios/libexec/check_log3.pl -l /var/log/cron -p 'cron failure' -c 1
From XI:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_log_3
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_log_4
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_log_5

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:23 pm
by gdolidze
Ok we know that its working now but how come i get this on the XI web

(No output on stdout) stderr: sudo: no tty present and no askpass program specified

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:28 pm
by jolson
Try removing sudo from the XI web interface command - it doesn't appear to be necessary from the command line. After removing the sudo command, report your results back.

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:31 pm
by gdolidze
Unable to open '/var/log/messages': Permission denied

even with giving other rw still get same issue.

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:36 pm
by jolson
Can you post a screenshot of what you have configured on the XI GUI please? I would like to see what we're working with so that I can better assist you. Thanks!

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:38 pm
by gdolidze
you mean all the service or just the log one?

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:49 pm
by jolson
Forget about that command definition - you can delete it if you want. It would only be useful for checking the contents of your local (XI) machine, not running remote NRPE checks.

What we need to do is define a service that runs a command exactly as we typed it. So, that command being:
/usr/local/nagios/libexec/check_nrpe -H 67.111.179.155 -c check_log_3

Our new service might look something like:
2015-05-14 13_48_26-Nagios XI - Nagios Core Config Manager.png
Finish filling out all of the appropriate 'service' definitions, and you should be good to go.

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:54 pm
by gdolidze
OK: Found 0 lines (limit=1/1): No matches found.

Great it works. The issue was I was using the wrong command.


Thank you for you help I appreciate.


I can going to try this on the other server now.

Re: Log Server Mointoring

Posted: Thu May 14, 2015 1:58 pm
by jolson
No problem - glad I could help out. My apologies for the confusion. Let me know if you have any further questions. Thanks!