Prometheus (Prometheus)
experimental environment :( various hosts, ip, required services)
docker01 docker02 docker03
1.10 1.20 1.30
NodeEXporter NodeEXporter NodeEXporter
cAdvisor cAdvisor cAdvisor
Prometheus Server
Grafana
all turn off the firewall, disable SELinux.
[Root @ docker01 ~] # systemctl firewalld STOP
[docker01 the root @ ~] # systemctl disable firewalld
[docker01 the root @ ~] # 0 the setenforce
the setenforce: the SELinux iS Disabled
to deploy components:
Prometheus server: Prometheus master server. NodeEXporter: Host responsible for collecting information on hardware and operating system information. cAdvisor: container is responsible for collecting information on running Host. Grafana: Prometheus responsible for displaying monitor screen. 1. Import mirror docker01:
[root@docker01 ~]# docker load < mycadvisor.tar && docker load < grafana.tar && docker load < node-exporter.tar && docker load < prometheus.tar
docker02:
[docker02 the root @ ~] # Docker Load <mycadvisor.tar && Docker Load <Node-exporter.tar
docker03:
[docker03 the root @ ~] # Docker Load <mycadvisor.tar && Docker Load <Node-exporter.tar
mirrored pull completed ! ! !
1) 3 nodes are deployed node-EXporter and cAdvisor.
PS: 3 sets Dounong, went to the browser to verify
the deployment node-EXporter, collection of hardware and system information
[root @ docker01 ~] # docker run -d -p 9100 : 9100 -v / proc: / host / proc -v / sys: / host / sys -v /: / rootfs --net = host prom / node-exporter --path.procfs / host / proc --path.sysfs / Host / SYS --collector.filesystem.ignored-Mount-Points "^ / (SYS | proc | dev | Host | etc) ($ | /)"
PS: Note the use of the --net = host, so Prometheus Server can communicate directly with the Node-Exporter.
Authentication: Open your browser and verify the results: ip plus 9100 Ports:
// deploy the installation cAdvisor. Node information collecting container.
PS: 3 sets Dounong, went to verify the browser
[root @ docker01 ~] # docker run -v /: / rootfs: ro -v / var / run: / var / run /: rw -v / sys: / sys: ro -v / var / lib / docker: / var / lib / docker: ro -p 8080: 8080 --detach = true --name = cadvisor --net = host google / cadvisor
after, go deployed, browser access: IP plus 8080 ports:
2) in docker01 the deployment of Prometheus Server service.
Before deploying Prometheus, we need to modify its configuration file, so let's run a container, first copy out its configuration file.
[docker01 the root @ ~] -d -p RUN # Docker 9090: 9090 - Net --name = Host PROM Prometheus / Prometheus [docker01 the root @ ~] CP # Docker Prometheus: ./ /etc/prometheus/prometheus.yml [root @ docker01 ~] # vim prometheus.yml 28 line read: • - Targets: [ 'localhost: 9090', 'localhost: 8080', 'localhost: 9100', '192.168.1.20:8080', ' 192.168.1.20:9100','192.168.1.30:8080','192.168.1.30:9100 '
PS: Here the development of monitoring items prometheus, including its own monitoring data back also collected.
[docker01 the root @ ~] -f RM # Docker Prometheus
Prometheus [docker01 the root @ ~] -d -p RUN # Docker 9090: 9090 Host --name Prometheus - Net = -v /root/prometheus.yml:/etc /prometheus/prometheus.yml prom / prometheus Internet access authentication: ip plus port docker01 of 9090:
PS: Oh, here you can see into our individual monitored items.
Hangs After docker02:
Continue to run after docker02:
3) On docker01, deploy grafana service, prometheus used to display the data collected.
[docker01 the root @ ~] # mkdir grafana-Storage
[docker01 the root @ ~] -R & lt grafana-# Storage the chmod 777 / [the root docker01 @ ~] -d -p RUN # Docker 3000: 3000 --name grafana -v / root / grafana-storage: / var / lib / grafana -e "GF_SECURITY_ADMIN_PASSWORD = 123.com" grafana / grafana browser access Authentication: account: admin password: 123.com
PS: to see this, indicating a proper connection when prometheus and grafana service.
At this time, although granfana to collect the data, but how to display it, remains a problem, gafana support for custom display information, but you want to customize is very troublesome, but fortunately, granfana official provided some templates for us to for our use .
granfana official website:
https://grafana.com/docs/grafana/latest/
Select a template, then, we have 2 ways to apply this template.
The first way: by using a template JSON file.
After the download is complete, on the desktop, console came grafana
second way to import template:
directly through the ID template.
Template ID:
with 10619
back to grafana console
accident:
Template comes with: