August 16, 2018 / Eternal Team
AWS provides lots of services and data. But it is also true that some metrics are not available in aws default metrics. That’s why we have to setup custom metrics like Memory, Disk and Swap uses etc. which are very necessary to monitor and maintain the servers.
We can push custom metrics by two methods:
Monitoring By CloudWatch Agent:
We can setup custom metrics data pushing setup in ec2 instance by above methods. CloudWatch Agent Method is much reliable and effective with compare to Monscripts setup. In Cloudwatch Agent method, we don’t need to setup any cron job to send custom metrics data to cloudwatch. The CloudWatch Agent manage all these automatically as predefined. It works simultaneously with AWS cloudWatch service.
CloudWatch agent enables you to do Collect more system-level metrics from Amazon EC2 instances, including in-guest metrics, in addition to the metrics listed in Amazon EC2 Metrics and Dimensions. The additional metrics are listed in Metrics Collected by the CloudWatch Agent.
Here are some simple steps to setup Custom Metrics in Amazon linux Ec2 instance using CloudWatch Agent –
$ mkdir cloudwatch-agent
$ cd cloudwatch-agent/
$ wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip
$ unzip AmazonCloudWatchAgent.zip
$ sudo ./install.sh
Whether you are installing the CloudWatch agent on an Amazon EC2 instance or an on-premises server, you must create the CloudWatch agent configuration file before starting the agent. The agent configuration file is a JSON file that specifies the metrics and logs that the agent is to collect. You can create it by using the wizard, or by creating it yourself from scratch. You could also use the wizard to initially create the configuration file, and then modify it manually.
So now here we will use wizard to create cloudwatch agent configuration file. It will create file automatically as our answer.
The agent configuration file wizard, amazon-cloudwatch-agent-config-wizard, asks a series of questions, including the following:
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
To know CloudWatch Agent Predefined Metric Sets click the link below-
$ mkdir /tmp/ssm
$ cd /tmp/ssm
$ sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c ssm:SSM-PARAMETER_NAME -s
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -s
Now Check your CloudWatch Service. In metrics section you would be seeing the data collected by CloudWatch Agent metrics. Explore these metrics and set dashboard and create necessary alarms as you want for seamless experience of AWS infrastructure.
If you are having any trouble in setting up a AWS infrastructure, you can contact us and we will design the AWS architecture as per your requirements and help you to set-up the whole AWS infrastructure.
July 16, 2019
EXTRACT We are going to share the steps that should be performed to host your first
July 16, 2019
EXTRACT We are going to share the steps to be performed to sort of compile and Install MySQL