List of commits:
Subject Hash Author Date (UTC)
first commit 48ca46721600b6cd3bfb590adc36b395bb6004af Antonio Rendina 2020-04-04 14:05:39
Commit 48ca46721600b6cd3bfb590adc36b395bb6004af - first commit
Author: Antonio Rendina
Author date (UTC): 2020-04-04 14:05
Committer name: Antonio Rendina
Committer date (UTC): 2020-04-04 14:05
Parent(s):
Signing key:
Tree: ae9b32ad46659e8fff8ab2e7d633b52695e33a05
File Lines added Lines deleted
.gitignore 3 0
README.md 132 0
Vagrantfile 76 0
File .gitignore added (mode: 100644) (index 0000000..2da9e1d)
1 .vagrant
2 node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
3 prometheus-2.17.1.linux-amd64.tar.gz
File README.md added (mode: 100644) (index 0000000..0eac795)
1 # Install Prometheus on Centos7
2
3 https://www.howtoforge.com/tutorial/how-to-install-prometheus-and-node-exporter-on-centos-7/
4
5 ## Step 1 - Create a new User and Download Prometheus
6
7 Create a new user
8 ```
9 useradd -m -s /bin/bash prometheus
10 ```
11 Become prometheus user and download the software
12 ```
13 su - prometheus
14 wget https://github.com/prometheus/prometheus/releases/download/v2.17.1/prometheus-2.17.1.linux-amd64.tar.gz
15 ```
16
17 Extract the tarball and rename the directory
18 ```
19 tar -xzvf prometheus-2.17.1.linux-amd64.tar.gz
20 mv -v prometheus-2.17.1.linux-amd64 prometheus
21 ```
22
23 ## Step 2 - Configure Prometheus As a Systemd Service
24 ```
25 cat << 'EOF' > /etc/systemd/system/prometheus.server
26 [Unit]
27 Description=Prometheus Server
28 Documentation=https://prometheus.io/docs/introduction/overview/
29 After=network-online.target
30
31 [Service]
32 User=prometheus
33 Restart=on-failure
34
35 #Change this line if you download the
36 #Prometheus on different path user
37 ExecStart=/home/prometheus/prometheus/prometheus \
38 --config.file=/home/prometheus/prometheus/prometheus.yml \
39 --storage.tsdb.path=/home/prometheus/prometheus/data
40
41 [Install]
42 WantedBy=multi-user.target
43
44 EOF
45 ```
46 Reload systemd
47 ```
48 systemctl daemon-reload
49 ```
50
51 Start and enable Prometheus
52 ```
53 systemctl start prometheus
54 systemctl enable prometheus
55 ```
56 Check that everything is fine
57 ```
58 systemctl status prometheus
59 netstat -plntu
60 ```
61
62 # Step 3 - Configure Firewalld
63
64 Open port 9090 for the Prometheus access using firewall-cmd commands below.
65 ```
66 firewall-cmd --add-port=9090/tcp --permanent
67 firewall-cmd --reload
68 ```
69 # Step 4 - Install and Configure node_exporter
70
71 Download node_exporter
72 ```
73 su - prometheus
74 wget https://github.com/prometheus/node_exporter/releases/download/v1.0.0-rc.0/node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
75 ```
76 extract node exporter and rename the directory
77 ```
78 tar -xzvf /vagrant/node_exporter-1.0.0-rc.0.linux-amd64.tar.gz
79 mv node_exporter-1.0.0-rc.0.linux-amd64/ node_exporter
80 ```
81
82 Create a new service for node_exporter
83 ```
84 cd /etc/systemd/system/
85 cat << EOF >> node_exporter.service
86 [Unit]
87 Description=Node Exporter
88 Wants=network-online.target
89 After=network-online.target
90
91 [Service]
92 User=prometheus
93 ExecStart=/home/prometheus/node_exporter/node_exporter
94
95 [Install]
96 WantedBy=default.target
97 EOF
98 ```
99 Reload systemd
100 ```
101 systemctl daemon-reload
102 ```
103 Enable and start the service
104 ```
105 systemctl start node_exporter
106 systemctl enable node_exporter
107 ```
108 Check that everything is fine
109 ```
110 netstat -plntu
111 ```
112
113 # Step 5 - Add node_exporter to the Prometheus Server
114 Login to the prometheus user.
115 ```
116 su - prometheus
117 ```
118 Goto the 'prometheus' directory and edit the configuration file 'prometheus.yml'.
119 ```
120 cd prometheus/
121 vim prometheus.yml
122 ```
123 Under the 'scrape_config' line, add new job_name node_exporter by copy-pasting the configuration below.
124 ```
125 - job_name: 'node_exporter'
126 static_configs:
127 - targets: ['localhost:9100']
128 ```
129 Restart the prometheus service
130 ```
131 systemctl restart prometheus
132 ```
File Vagrantfile added (mode: 100644) (index 0000000..97998e4)
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # All Vagrant configuration is done below. The "2" in Vagrant.configure
5 # configures the configuration version (we support older styles for
6 # backwards compatibility). Please don't change it unless you know what
7 # you're doing.
8 Vagrant.configure("2") do |config|
9 # The most common configuration options are documented and commented below.
10 # For a complete reference, please see the online documentation at
11 # https://docs.vagrantup.com.
12
13 # Every Vagrant development environment requires a box. You can search for
14 # boxes at https://vagrantcloud.com/search.
15 config.vm.box = "bento/centos-7"
16
17 # Disable automatic box update checking. If you disable this, then
18 # boxes will only be checked for updates when the user runs
19 # `vagrant box outdated`. This is not recommended.
20 # config.vm.box_check_update = false
21
22 # Create a forwarded port mapping which allows access to a specific port
23 # within the machine from a port on the host machine. In the example below,
24 # accessing "localhost:8080" will access port 80 on the guest machine.
25 # NOTE: This will enable public access to the opened port
26 # config.vm.network "forwarded_port", guest: 80, host: 8080
27
28 # Create a forwarded port mapping which allows access to a specific port
29 # within the machine from a port on the host machine and only allow access
30 # via 127.0.0.1 to disable public access
31 # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
32
33 # Create a private network, which allows host-only access to the machine
34 # using a specific IP.
35 config.vm.define :vm01 do |vm01|
36 # uncomment the line below to set up the ambari dev environment
37 # c7201.vm.provision :shell, :path => "dev-bootstrap.sh"
38 vm01.vm.hostname = "vm01.nowhere.org"
39 vm01.vm.network :private_network, ip: "192.168.33.10"
40 end
41 # config.vm.network "private_network", ip: "192.168.33.10"
42
43 # Create a public network, which generally matched to bridged network.
44 # Bridged networks make the machine appear as another physical device on
45 # your network.
46 # config.vm.network "public_network"
47
48 # Share an additional folder to the guest VM. The first argument is
49 # the path on the host to the actual folder. The second argument is
50 # the path on the guest to mount the folder. And the optional third
51 # argument is a set of non-required options.
52 # config.vm.synced_folder "../data", "/vagrant_data"
53
54 # Provider-specific configuration so you can fine-tune various
55 # backing providers for Vagrant. These expose provider-specific options.
56 # Example for VirtualBox:
57 #
58 # config.vm.provider "virtualbox" do |vb|
59 # # Display the VirtualBox GUI when booting the machine
60 # vb.gui = true
61 #
62 # # Customize the amount of memory on the VM:
63 # vb.memory = "1024"
64 # end
65 #
66 # View the documentation for the provider you are using for more
67 # information on available options.
68
69 # Enable provisioning with a shell script. Additional provisioners such as
70 # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
71 # documentation for more information about their specific syntax and use.
72 # config.vm.provision "shell", inline: <<-SHELL
73 # apt-get update
74 # apt-get install -y apache2
75 # SHELL
76 end
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/arendina/prometheus_grafana

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/arendina/prometheus_grafana

Clone this repository using git:
git clone git://git.rocketgit.com/user/arendina/prometheus_grafana

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main