Centos7 installation and configuration prometheus

centos7 installation and configuration prometheus

Update system & disable selinux

yum update -y
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g'/etc/sysconfig/selinux
# reboot 

Download the prometheus installation package##

# Execute the following command to download
wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz

Configure prometheus

useradd --no-create-home --shell /bin/false prometheus
mkdir /etc/prometheus
mkdir /var/lib/prometheus
chown prometheus:prometheus /etc/prometheus
chown prometheus:prometheus /var/lib/prometheus
tar -xvzf prometheus-2.8.1.linux-amd64.tar.gz
mv prometheus-2.8.1.linux-amd64 prometheuspackage
cp prometheuspackage/prometheus /usr/local/bin/
cp prometheuspackage/promtool /usr/local/bin/
chown prometheus:prometheus /usr/local/bin/prometheus
chown prometheus:prometheus /usr/local/bin/promtool
cp -r prometheuspackage/consoles /etc/prometheus
cp -r prometheuspackage/console_libraries /etc/prometheus
chown -R prometheus:prometheus /etc/prometheus/consoles
chown -R prometheus:prometheus /etc/prometheus/console_libraries
vim /etc/prometheus/prometheus.yml

# Add the following configuration to the file
global:
 scrape_interval: 10s

scrape_configs:- job_name:'prometheus_master'
 scrape_interval: 5s
 static_configs:- targets:['localhost:9090']

# Change file ownership
chown prometheus:prometheus /etc/prometheus/prometheus.yml      
vim /etc/systemd/system/prometheus.service

# Copy the following to the file
[ Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[ Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
- - config.file /etc/prometheus/prometheus.yml \
- - storage.tsdb.path /var/lib/prometheus/ \
- - web.console.templates=/etc/prometheus/consoles \
- - web.console.libraries=/etc/prometheus/console_libraries

[ Install]
WantedBy=multi-user.target
systemctl daemon-reload
# start up
systemctl start prometheus
# Check status
systemctl status prometheus
firewall-cmd --zone=public--add-port=9090/tcp --permanent
systemctl reload firewalld

Visit Prometheus Web Interface##

http://Server-IP:9090/graph

Use Prometheus to monitor Linux servers##

# download
wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
tar -xvzf node_exporter-0.17.0.linux-amd64.tar.gz

# For node_exporter create user
useradd -rs /bin/false nodeusr

# Move binary files
mv node_exporter-0.17.0.linux-amd64/node_exporter /usr/local/bin/
vim /etc/systemd/system/node_exporter.service

# Add the following to the file
[ Unit]
Description=Node Exporter
After=network.target

[ Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter

[ Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter
firewall-cmd --zone=public--add-port=9100/tcp --permanent
systemctl restart firewalld
http://IP-Address:9100/metrics
vim /etc/prometheus/prometheus.yml

# Add the following configuration under scrape configuration
 - job_name:'node_exporter_centos'
 scrape_interval: 5s
 static_configs:- targets:['10.94.10.209:9100']
systemctl restart prometheus
http://Prometheus-Server-IP:9090/targets

Recommended Posts

Centos7 installation and configuration prometheus
Centos mysql installation and configuration
CentOS 7 installation and configuration PPTP
CentOS installation and configuration cmake
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
Centos7 hadoop cluster installation and configuration
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
CentOS NTP server installation and configuration
Centos7 mysql database installation and configuration
CentOS 7 system installation and configuration graphic tutorial
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
OpenMPI-Ubuntu installation and configuration
Installation and configuration of redis under centos7
Mysql8.0.15 installation configuration (centos7)
Centos7 hive stand-alone mode installation and configuration
Installation and configuration of JDK in CentOS 7 system
CentOS 7 installation and configuration graphic tutorials under VMware10
Installation and configuration of rsync server under CentOS 6.5
Installation and configuration of CentOS 7 in VMware Workstation
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
Ubuntu16.04 installation and simple configuration
centos7 kvm installation and use
CentOS7 postgresql installation and use
Ubuntu PostgreSQL installation and configuration
Centos7 elk7.1.1 installation and use
2019-07-09 CentOS7 installation
centos7_1708 installation
CentOS 8 install Git and basic configuration
CentOS7 installation and maintenance of Gitlab
CentOS7.2 and Nginx configuration virtual host
CentOS 7.X system installation and optimization
Centos 7 RAID 5 detailed explanation and configuration
Ubuntu 19.1 installation and configuration Chinese environment
Configuration and beautification after Ubuntu installation (1)
Nginx installation and configuration load (ubuntu12.04)
CentOs7 installation and deployment Zabbix3.4 original
Erlang 20.2 installation and deployment under CentOS 7
Ubuntu configuration source and installation software
Detailed explanation of Spark installation and configuration tutorial under centOS7
Centos5 installation guide
CentOS7.0 network configuration
Centos7.5 configuration java environment installation tomcat explanation
Centos-6.5 installation and deployment of LNMP environment
Linux kernel compilation and CentOS system installation
Python - centos6 installation
Centos7.6 operating system installation and optimization record
Centos7 installation and deployment of gitlab server
CentOS7 basic configuration
Docker installation (CentOS7 installation)
Centos python3 compile installation and compile gcc upgrade
Zabbix installation and deployment and localization under CentOS
CentOS7 installation zabbix 4.0 tutorial (graphics and text)
Jenkins installation and deployment tutorial under CentOS 7
CentOS7 docker installation
KVM installation and preliminary use under CentOS 7.2
Centos MySQL8 configuration
DLNA/UPnP Server installation and configuration under Ubuntu 12.04
Centos7 installation and deployment of Airflow detailed