Amazon CloudWatch is the monitoring tool for all the Amazon Cloud services. It offers both White Box and Black Box monitoring for services managed by Amazon and can be extended to work with user-generated monitoring data.
This text covers the integration of a simple MySQL monitoring script with Amazon CloudWatch.
MySQL Monitoring
Let’s assume that we want to monitor the number of active connections to the MySQL server and have an indication on when this figure becomes close to the maximal value defined in the configuration file (max_connections). In order to be portable, we may want to also report this value to the monitoring engine, even if it’s unlikely that a change may occur without explicit human intervention.
MySQL provides 3 numeric figures we may be interested in:
AWS provides a complete monitoring engine called CloudWatch. This works with metrics, including custom, user-provided metrics and it’s able to raise alarms when any such metric crosses a certain threshold. This is the only tool used for perfomance monitoring tasks within AWS.
This text will cover a monitoring scenario regarding deploying an arbitrary application to the “Cloud” and then being able to determine what causes performance limiting, be it in the application code itself or coming from limits enforced by Amazon.
Scenario
Let’s assume that you have just started using Amazon Web Services and are deploying applications on this free tier or by using general purpose (T2) instances. You quickly learn that the general purpose instances work with “credits” that allow dealing with short load spikes through performance bursting, but when these credits are exhausted, instance performance is reverted to some baseline. These particular details do not make a lot of sense, but you need to know if the application can meet the desired service targets while sticking to this setup.
The big data repository known as Chef Server is manipulated with a tool called knife. The general (simplified) syntax for this tool is:
$ knife category command item
The category can be one of: environment, client, node, data bag, cookbook, … The full list can be found here.
The command (usually) is one of create, list, show, edit or delete. There are more commands, though, depending on what is being requested through knife.
On the cheat sheat itself, let’s start with some classics: