Page 1 of 2
How to monitor Apache Tomcat in Nagios Core
Posted: Thu Aug 06, 2015 5:56 am
by neworderfac33
Good morning,
Once again encouraged by the expertise within this forum, I have another question.
My two test Windows clients use Apache Tomcat 7 to run the Jenkins continuous integration application.
I would like to be able to send email alerts if Apache is down, but I'm not certain if I can do this using a define service command within windows.cfg or if I need to install a plugin in order to do this?
Thanks in advance
Pete
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Thu Aug 06, 2015 12:41 pm
by tgriep
If you want to check that system to see if you can access the WEB interface, you cound use the check_http command from the Nagios system. That will let you know that the web server is up and that it is serving web pages.
If you need to check it to see if a certain port is open on that system, you could use the check_tcp command to do that.
Both of those commands should be already installed on your system.
If this isn't what you are looking for, post back with the details on how you need to monitor those systems and we can better help you.
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Fri Aug 07, 2015 4:04 am
by neworderfac33
Thank you very much!
Can I utilise this from within my Windows.cfg file?
Pete
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Fri Aug 07, 2015 11:49 am
by tgriep
Yes, you can add the service to your windows.cfg file.
Here is an example that you will have to edit for your system you want to monitor.
Code: Select all
define service {
host_name www.google.com
service_description HTTP
check_command check_http! -f ok -I 74.125.228.212 -u "/" -p 80
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
register 1
}
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Tue Aug 11, 2015 4:01 am
by neworderfac33
The application that I actually want to check for is Jenkins, which is installed on both the servers I want to monitor - it runs via a .WAR file, located within C:\program Files\Apache Software Foundation\Tomcat 7.0\WebApps\
So, I can either check that Jenkins is running, or that Apache is running as a service - if the latter isn't running, then the former won't be running either - whichever option is easier.
Also, please could you run through the syntax of the check_http command for me?
Regards
Pete
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Tue Aug 11, 2015 9:28 am
by hsmith
peterooney wrote:The application that I actually want to check for is Jenkins, which is installed on both the servers I want to monitor - it runs via a .WAR file, located within C:\program Files\Apache Software Foundation\Tomcat 7.0\WebApps\
So, I can either check that Jenkins is running, or that Apache is running as a service - if the latter isn't running, then the former won't be running either - whichever option is easier.
Also, please could you run through the syntax of the check_http command for me?
Regards
Pete
If you're looking for all of the details of check_http you can get them by issuing this command:
Code: Select all
/usr/local/nagios/libexec/check_http -h
If this is not what you're looking for, please correct me.
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Wed Aug 12, 2015 9:10 am
by neworderfac33
Still struggling, I'm afraid - the latest define service I have is:
Code: Select all
define service {
use generic-service
host_name MYSERVERID
#hostgroup_name windows-servers
service_description Apache
check_command check_http! -p 443 -ssl
}
but this returns:
HTTP CRITICAL - No data received from host
It isn't a "real" https in that the certificates are only internal ones, so the address bar shows the https part of the URL crossed out
Not sure where to go from here...
Cheers
Pete
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Wed Aug 12, 2015 5:05 pm
by jdalrymple
peterooney wrote:Code: Select all
check_command check_http! -p 443 -ssl
The -p isn't necessary and the -ssl should just be -S:
Code: Select all
[root@localhost etc]# ../libexec/check_http -I google.com -S
HTTP OK: HTTP/1.0 200 OK - 19432 bytes in 5.239 second response time |time=5.239068s;;;0.000000 size=19432B;;;0
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Thu Aug 13, 2015 4:49 am
by neworderfac33
Thanks for your reply.
I'm running my Nagios on Redhat enterprise 6.6 and when I try to run your command, I get:
bash: ../libexec/check_http: No such file or directory
I have made the changes you suggested
Code: Select all
define service {
use generic-service
host_name MYSERVERNAME
#hostgroup_name windows-servers
service_description Apache
check_command check_http! 443
}
and the web interface returns
HTTP WARNING: HTTP/1.1 403 Forbidden - 1491 bytes in 0.002 second response time
If I add the -S parameter
Code: Select all
define service {
use generic-service
host_name MYSERVERNAME
#hostgroup_name windows-servers
service_description Apache
check_command check_http! 443 -S
}
the web interface returns
check_http: Invalid option - SSL is not available
HELP!
Pete
Re: How to monitor Apache Tomcat in Nagios Core
Posted: Thu Aug 13, 2015 9:23 am
by neworderfac33
Don't worry too much about this - I found another way to get around it, by monitoring the Apache Tomcat7 process instead.
Code: Select all
define service{
use generic-service
#host_name MYFIRSTSERVER, MYSECONDSERVER
hostgroup_name windows-servers
service_description Service - Tomcat7
check_command check_nt!SERVICESTATE!-d SHOWALL -l Tomcat7
}
Cheers
Pete