Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Continuous Monitoring With TICK Stack

DZone's Guide to

Continuous Monitoring With TICK Stack

Learn how to set up TICK stack, a resilient monitoring solution using only open source projects, to detect issues before they affect your users.

· DevOps Zone ·
Free Resource

Learn how integrating security into DevOps to deliver "DevSecOps" requires changing mindsets, processes and technology.

Monitoring your system is required. It helps you detect any issues before they cause any major downtime that affect your customers and damage your business reputation. It also helps you to plan growth based on the real usage of your system. But collecting metrics from different data sources isn’t enough- you need to personalize your monitoring to meet your own business needs and define the right alerts so that any abnormal changes in the system will be reported.

In this post, I will show you how to set up a resilient continuous monitoring platform with only open source projects and how to define an event alert to report changes in the system.

Clone the following GitHub repository:

git clone https://github.com/mlabouardy/terraform-aws-labs.git

1 – Terraform & AWS

In the tick-stack/terraform directory, update the variables.tfvars file with your own AWS credentials (make sure you have the right IAM policies) :

region = "AWS REGION"
access_key = "YOUR AWS ACCESS KEY ID"
secret_key = "YOUR AWS SECRET KEY"
key_name = "YOUR SSH KEY PAIR"

Issue the following command to download the AWS provider plugin:

terraform init

Issue the following command to provision the infrastructure:

terraform apply --var-file=variables.tfvars

2 — Ansible & Docker

Update the inventory file with your instance DNS name:

[servers]
ec2–52–206–156–244.compute-1.amazonaws.com

Then, install the Ansible custom role:

ansible-galaxy install mlabouardy.tick

Execute the Ansible Playbook:

ansible-playbook — private-key=aws.pem -i inventory playbook.yml

Point your browser to http://DNS_NAME:8083. You should see the InfluxDB Admin Dashboard:

Now, create an InfluxDB Data Source in Chronograf (http://DNS_NAME:8888):

Create a new Dashboard as follows:

You can create multiple graphs to visualize different types of metrics:

Note: For in-depth details on how to create interactive and dynamic dashboards in Chronograf, check my previous tutorial.

You need to elaborate on the data collected to do something like alerting, so make sure to enable Kapacitor:

Define a new alert to send a Slack notification if the CPU utilization is higher than 70%.

To test it out, we need to generate some workload. For this case, I used stress:

apt-get install stress

Stressing the CPU:

stress — cpu 4 — timeout 20s

After few seconds, you should receive a Slack notification.

Learn how enterprises are using tools to automate security in their DevOps toolchain with these DevSecOps Reference Architectures.

Topics:
monitoring ,devops ,performance ,tick stack ,open source

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}