docker-compose部署pinpoint开启email报警功能

做事前认真阅读下Readme文档,磨刀不误砍柴工

Pinpoint-Docker for Pinpoint

Official git repository of Dockerized components of the Pinpoint Application Monitoring.
Installing Pinpoint with these docker files will take approximately 10min. to check out the features of pinpoint.

What is Pinpoint

Pinpoint, is the world’s leading open-source application monitoring solution – trusted by millions of users around the globe.
It supports and helps you understand your application in a glance and allow you to build world-class, high-quality software.

Supported Tags

  • 1.8.2
  • 1.8.1
  • 1.8.0
  • 1.7.3
  • 1.7.2

Requirements

How to install Pinpoint?

You can easily bring up an entire Dockerized Pinpoint(latest release) environment by using Docker Compose with any of the provided docker-compose.yml files as below.
With docker-compose.yml under Pinpoint-Docker folder brings up all the environment attached with Pinpoint-QuickStart(sample app).
To monitor your agent see configuration part for further details.

git clone https://github.com/naver/pinpoint-docker.git
cd pinpoint-docker
docker-compose pull && docker-compose up -d

If you’d like to bring up a previous release. Try with docker-compose file from other tags.

git clone https://github.com/naver/pinpoint-docker.git
git checkout {tag}
cd pinpoint-docker
docker-compose pull && docker-compose up -d

You can also build the image with docker-compose up -d command without pulling the image. But you can reduce the time to 1/3 by just downloading them.

This will install and run all services required to run all features in Pinpoint in docker containers joined with same network.
– Pinpoint-Web Server
– Pinpoint-Collector
– Pinpoint-Agent
– Pinpoint-Flink(to support certain feature)
– Pinpoint-Zookeeper
– Pinpoint-Hbase
– Pinpoint-QuickStart(a sample application, 1.8.1+)
– Pinpoint-Mysql(to support certain feature)
This may take several minutes to download all necessary images.

You can replace QuickStart application part with your application to start monitoring.
– check Testing QuickStart application for a quick demo of pinpoint
– check Monitoring YOUR Application part for further details

Mysql (optional, 1.8.1+)

The Pinpoint-Mysql is necessary to use ‘Alarm’ feature. It’s server is running on port 13306 and contains the data structure used to register users, groups, and alerts to be sent.

To send email alerts, you must make BATCH_ENABLE=true and change the other mail-related environment variables (MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_PROPERTIES_MAIL_SMTP_FROM, …) to the Pinpoint-Web server in .env file.

For more information checkout Setting Alarm in Pinpoint documentation.

Flink configuration (optional)

The Pinpoint-Flink is necessary to use ‘Application Inspector’ feature.

After all containers are started and ready to go. There is one more thing to do to use all existing features in Pinpoint.
It’s not mandatory, but to use all the features and since it’s a simple task, let’s take care of it.

Register a job on to pinpoint-flink server.
You can build the job from the open-source of Pinpoint, additional guide is here.
or
you can simply upload pre-built jar file under pinpoint-flink/build/pinpoint-flink-job-{pinpoint-version}.jar (beware of the version, it should matched with PINPOINT_VERSION in .env file)
If anyone have solution to put the job file into flink image without doing manually, please let us know.

Pinpoint-Flink server is running on port 8081. From submit new job menu
Submit the jar file with com.navercorp.pinpoint.flink.StatStreamingVer2Job in entry class as below image.

Testing QuickStart application

Now you are ready to monitor the sample application(Pinpoint-QuickStart port 8000) provided.
If you can’t find any connected application from Pinpoint-Web’s first page(port 8079 as default), don’t panic and wait for a while.
It will take some time for Pinpoint to retrieve the application’s information when running for the first time.

Monitoring YOUR Application

Pinpoint-Agent only prepares required libraries for triggering Pinpoint-Agent.
Running and configuring agents is manual action done by the user, but don’t worry it’s very simple.

If you are not familiar with Pinpoint concept, please read: Overview,
Agents Installation

You will need to attach Pinpoint-Agent to your application.

Running Pinpoint-Agent docker-compose separately, Examples are here.
Otherwise, you can check how Pinpoint-Quickstart is attached to Pinpoint-Agent with docker-compose.

We’ll try to create more examples along the way.
If anyone who can share their dockerfile, it’s always welcome.

Distributed System

Until now, every components are in one docker, single-node approach, which is excellent for test and development.
It provides an easy way to prototype new ideas and use cases, as well as try out new functionality and the latest Pinpoint releases.
It’s not intended nor supported for production use.

You can use docker-compose and .env files under each folder to install the modules separately into several servers.
If containers are separated, ip configurations in .env must be changed within.

For example, if you want your application running from a docker and rest of Pinpoint in another.
You can remove pinpoint-agent and pinpoint-quickstart from docker-compose.yml and run to establish all necessary component of pinpoint.
And create another docker-compose.yml just like one under pinpoint-quickstart folder to run your application.
Finally, since agent needs to acknowledge the collector ip. collector ip needs to be changed in .env.

Configurations

Configuration relies on supplying docker-compose with environment variables defined in .env file. So it’s recommended to change variables only from .env file.
With docker-compose in this repository. You can create stand-alone containers that are needed to run most of the features in Pinpoint.

Ports can be also configured in .env file.
(Default ports are Pinpoint-Web:8079, Quickstart:8000 and Flink:8081 as configured in .env file)

Pinpoint-Zookeeper is just an example of using zookeeper image. You can modify docker-compose files to suit your needs.

For more specific details on what the values represents in .env file. Please check Pinpoint Github Repository or
Pinpoint Web properties, Pinpoint Collector properties, Pinpoint Agent configuration.
Please note that only essential configuration options are adopted to pinpoint-docker(docker-compose).

配置发邮件注意事项

To send email alerts, you must make BATCH_ENABLE=true and change the other mail-related environment variables (MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_PROPERTIES_MAIL_SMTP_FROM, …) to the Pinpoint-Web server in .env file.

首先在pinpoint-web环境变量文件里开启BATCH_ENABLE

激活BATCH

[root@VM_8_77_centos pinpoint-docker]# grep BATCH_ENABLE .env
BATCH_ENABLE=true

其次设置好发邮件账号信息

按照实际情况填写

[root@VM_8_77_centos pinpoint-docker]# grep MAIL .env
MAIL_HOST=stmp.test.com
MAIL_PORT=25
MAIL_USERNAME=user
MAIL_PASSWORD=pass
MAIL_PROPERTIES_MAIL_TRANSPORT_PROTOCOL=smtp
MAIL_PROPERTIES_MAIL_SMTP_AUTH=true
MAIL_PROPERTIES_MAIL_SMTP_PORT=25
MAIL_PROPERTIES_MAIL_SMTP_FROM=test@example.com
MAIL_PROPERTIES_MAIL_STARTTLS_ENABLE=false
MAIL_PROPERTIES_MAIL_STARTTLS_REQUIRED=false
MAIL_PROPERTIES_MAIL_DEBUG=false


重新生成pinpoint-web容器

[root@VM_8_77_centos pinpoint-docker]# docker-compose kill pinpoint-web
[root@VM_8_77_centos pinpoint-docker]# docker-compose rm pinpoint-web
[root@VM_8_77_centos pinpoint-docker]# docker-compose up -d

参考官网配置报警策略


https://github.com/naver/pinpoint/blob/master/doc/alarm.md