Cabot is an open-source, self-hosted monitoring platform written in Python that provides you with some of the best features of PagerDuty, Server Density, Pingdom and Nagios.
It provides a web interface that allows you to monitor services and send telephone, sms or hipchat/email alerts to your support in case of any service failures- all without writing a single line of code. And the best part is, you can even use these monitoring data that you're already pushing to Graphite to generate alerts, rather than implementing and maintaining a whole new system of data collectors.
In this article, I'll explain on how to install this Cabot - monitoring system on a CentOS 7 server using docker-compose.
Before proceeding with the installation, we need to make sure the following software is pre-installed on the server.
- Install Docker/Docker-compose
- Install Git
1. Install Docker/Docker-compose
You can install docker by running this command
yum install docker -y. Once installed make sure to start and enable the service.
# systemctl start docker # systemctl status docker # systemctl enable docker
Docker-compose is a command line tool to define and configure multi-container docker applications. In other words, it is used to link multiple containers and deploy application from a single command. You can use these steps to install
#yum install epel-release -y #yum install python-pip -y #pip install docker-compose
Note: pip version 6.0 or higher is recommended for docker-compose to work smoothly.
# docker -v Docker version 1.12.6, build 85d7426/1.12.6 # docker-compose -v docker-compose version 1.17.1, build 6d101fb
2. Install Git
We can install Git packages from their repositories by just running this command.
#yum install git
Deploying Cabot container using Docker-compose tool
To deploy our Cabot docker container with docker-compose command , first we need to have a directory with that name which includes the docker compose file namely
docker-compose.yml which defines the services for your applications and container images. Let's download the Cabot repository from Github for building our container.
# git clone https://github.com/arachnys/cabot.git Cloning into 'cabot'... remote: Counting objects: 4040, done. remote: Compressing objects: 100% (12/12), done. remote: Total 4040 (delta 4), reused 6 (delta 3), pack-reused 4025 Receiving objects: 100% (4040/4040), 2.84 MiB | 0 bytes/s, done. Resolving deltas: 100% (2676/2676), done.
This will create our Cabot folder with all required files to create our container. Now we can move to our cabot folder created and add your keys for external services to the configuration files using production.env.example & development.env.example as a template:
#cp conf/production.env.example conf/production.env #cp conf/development.env.example conf/development.env
And finally, you can run the docker-compose command to build your container.
#docker-compose up -d Removing intermediate container 67da3290e064 Step 15 : ENTRYPOINT ./docker-entrypoint.sh ---> Running in 098f4b6332e0 ---> 9b02bb2c601b Removing intermediate container 098f4b6332e0 Successfully built 9b02bb2c601b WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating cabot_redis_1 ... Creating cabot_db_1 ... Creating cabot_redis_1 Creating cabot_db_1 ... done Creating cabot_beat_1 ... Creating cabot_worker_1 ... Creating cabot_web_1 ... Creating cabot_beat_1 Creating cabot_web_1 Creating cabot_web_1 ... done
Once, it's done make sure you've Cabot container and its services are up and running.
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c1d83ff277d8 9b02bb2c601b "./docker-entrypoint." 48 minutes ago Up 47 minutes 0.0.0.0:5001->5001/tcp cabot_web_1 c0bbf796a735 9b02bb2c601b "./docker-entrypoint." 48 minutes ago Up 47 minutes cabot_worker_1 4986889dfbd6 9b02bb2c601b "./docker-entrypoint." 48 minutes ago Up 48 minutes cabot_beat_1 b9ebdd42d78b postgres:alpine "docker-entrypoint.sh" 48 minutes ago Up 48 minutes 5432/tcp cabot_db_1 4b0f69c6babc redis:alpine "docker-entrypoint.sh" 48 minutes ago Up 48 minutes 6379/tcp cabot_redis_1
That’s it! We've our Cabot monitoring tool up and running now. You can access it from the web interface using the web URL >>
http://Server IP or Hostname:5001.
You can create your admin credentials and login using that.
All configuration takes place through environment variables managed by Foreman. It has a production configuration file and a development configuration file. Production configuration lies in conf/production.env. Cabot repository provides us with a template configuration file at conf/production.env.example which you can copy and modify as our purpose. Similarly, the template for development configuration file lies here at conf/development.env.example.
Adding a host
The Cabot interface consist mainly of four sections: Instances, Services, Checks and New tab on the left corner. And we have Alert Subscriptions, Rota and User tab on the right corner. We can add new nodes to this system for monitoring using this Instance tab. Each host added to your system is termed as an instance. We can add any new instances to the monitoring system by clicking the '+' icon on the right corner.
You can enter the details of the new Instance which you want to add to our monitoring system in the
New instance window as shown above. It's self-explanatory with the description for each column. You can provide the hostname/IP address. A user who should be alerted about the warnings. When creating a new instance a default ICMP check (ping) is created automatically to immediately start checking your host uptime.
Additionally, you can also connect some of your Services which you've created in the
Services tab with the newly created instance by using Service set field.
Adding new users
You can add new users to the monitoring system via Djando Administration. First of all, you need to login as Django Admin and click + Add to add a new user.
Once a user is added, if you want them to receive telephone and/or SMS alerts you should add a mobile number via the Alert subscriptions page. You can refer this Cabot documentation for more information about this.
Cabot is a free, reasonably reliable monitoring solution which has some of the best features of other monitoring tools without their cost and complexity. Using this we can even get alerts based on the metrics from Graphite, status code and response content of web endpoints and Jenkins build statuses.