Use cAdvisor + InfluxDB + Grafana to configure Docker monitoring and cadvisorinfluxdb

Source: Internet
Author: User
Tags docker ps docker compose grafana docker run influxdb cadvisor

Use cAdvisor + InfluxDB + Grafana to configure Docker monitoring and cadvisorinfluxdb

Configure the Docker monitoring system, collect data (cAdvisor)-> store data (InfluxDB)-> display data (Grafana)

InfluxDB

A series of InfluxDB learning articles. You can view articles related to English blogs and Linux universities.

1. docker pull Image
docker pull tutum/influxdb:0.9

The version can be defined as needed. The default value is 0.9.

Ii. Start running
docker run -d -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 --name influxsrv tutum/influxdb

Parameter description

-D: The container runs in the background-p: maps the port in the container to the host port in the format of host port: port in the container; 8083 is the web management tool port of influxdb, 8086 is the influxdb http api port -- expose: allows the container to accept external incoming data -- name: The container name is finally the image name: tag, the image is tutum/influxdb, if the default tag value is latest, you can also specify a version such as tutum/influxdb: 0.8.8.

You can use docker ps-a to view the running influxsrv.
Container

You can open a browser and enter http: // localhost: 8083 for access.

Iii. logon Management

Enter the username root and password root. You can set the default localhost here and click Save.

Iv. command line operations

You can use the command line to manage containers and start containers.

docker run -i -t tutum/influxdb bin/bash

Log on to the container to operate influxdb. You can perform a series of operations. For more information, see the tutorial InfluxDB to learn the basic operations of InfluxDB.

CAdvisor 5. web Operations

After logging on to the influxdb background database management platform, create a cAdvisor database to store the real-time monitoring data obtained by the cAdvisor application. Create a database and a user in the Queriy input box on the influxDB management interface. The Query Templates in the lower-right corner of the interface can quickly use related operation statements.

1. Create a cadvisor Database

create database 'cadvisor'

View the status of this database

2. Install the cAdvisor container and link it to the InfluxDB container

sudo docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080 --detach=true --link influxsrv:influxsrv --name=cadvisor google/cadvisor:latest -storage_driver_db=influxdb -storage_driver_host=influxsrv:8086


After the installation is successful, enter http: // localhost: 8080/in the browser. After successful access, you can see the cAdvisor that collects statistics on the Docker host and container.

Grafana 6. Install the Grafana dashboard and link it to the InfluxDB container
sudo docker run -d -p 3000:3000 -e HTTP_USER=admin -e HTTP_PASS=admin -e INFLUXDB_HOST=influxsrv -e INFLUXDB_PORT=8086 -e INFLUXDB_NAME=cadvisor -e INFLUXDB_USER=root -e INFLUXDB_PASS=root --link influxsrv:influxsrv --name grafana grafana/grafana


After the installation is successful, enter http: // localhost: 3000/in the browser to access Grafana.

1. log on to Grafana and configure the data source
On the logon page, enter admin in Username and admin in Password. Click login to enter

2. Connect InfluxDB to the Grafana dashboard

After logging in, click the Grafama icon in the upper left corner of the page. In the menu bar that appears, click data source.

3. Fill in the relevant information on the Data Source Settings Interface

Data Sources/New Interface

Enter the following information

Data Sources / NewSettingsName:influxDB Default:yesType:InfluxDBHTTPURL:http://influxsrv:8086/Access:proxyAuthBasic Auth:yes     With Credentials: noTLS Client Auth:no   With CA Cert:noSkip TLS Verification (Insecure):noBasic Auth DetailsUser:adminPassword:adminAdvanced HTTP SettingsWhitelisted Cookies:noneInfluxDB DetailsDatabase:cadvisorUser:rootPassword:rootMin time interval:60s


When you click Save & Test to return the Data source is working information, it indicates that grafana is correctly connected to the corresponding container.

7. Complete visual monitoring with Grafana Configuration

Create monitoring panel

Enter relevant information

For configuration options on Grafaba, see Using InfluxDB in Grafana.

8. Use the docker compose. yml configuration file to deploy the Docker Monitoring System

Here is a ready-made Docker Monitoring Profile docker-compose.yml

Download this file

Run

 docker-compose -f docker-compose.yml up -d

For details, see Docker-monitoring.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.