Monitor production services (tomcat, MSQL and apac

2019-06-22 13:49发布

问题:

Currently I have a server - Amazon EC2 instance type. Through AWS console, we can monitor our instances (server) CPU utilization, disk read etc..

Is there any way through which I can monitor my application services - like tomcat, mysql, apache etc.. Basically, whenever the tomcat or mysql is stopped, I need an email alert from Amazon. For CPU utilization, I was able to that successfully. However, how to monitor my application services state through AWS.

Any suggestions please? If we can't able to do through AWS, is there any other way to monitor them?

Thank you.

回答1:

Amazon itself only provides the basic platform where you can run your services on. Therefore there is no existing pre-built solution from Amazon available to monitor services.

However there are some alternatives to consider:

  • You can use Amazon Cloudwatch custom metrics to monitor your services
  • ...or you use monit to watch and (optionally) automatically restart your services
  • ...or you use nagios alerting and/or munin for monitoring

All of these solutions will require installation or programming from your side.



回答2:

I think you need to be very careful to think through your requirements before implementing a solution. Even if the solution you pick is open source and "free" you will invest a lot of time in making it work, and you will continue to invest time keeping it working as your applications and your environment changes.

Right now you have stated a requirement which seems simple at first blush which is to know if some key services are up and running. But what does running mean? Does running mean that it is not stopped or crashed? Or does running mean the normal amount of data is flowing in and out of the service? That is something that you cannot ascertain with a commodity or free tool.

Go one step further. Does running mean that the service is performing as well as it should? What definition of performance do you want to use? That the service is using the normal amount of resources (easy to measure) or that the transactions flowing into the service are being processes with a response time that is acceptable (again beyond the scope of a commodity or free tool).

The bottom line is that as it is with all things you get what you pay for. If you want to really know that it is working and working includes transaction response time then you are going to need a commercial grade APM tool. Those fall into two categories:

1) Ones that monitor your application from inside of the application container (New Relic, AppDynamics, etc.)

2) Ones that monitor your application from inside of the operating system (AppEnsure, BlueStripe, Correlsense, etc.)

If your application is running on premise and you can attach an appliance to your switches you have a third option is which to use deep packet inspection of the network from a vendor like ExtraHop.