-
Notifications
You must be signed in to change notification settings - Fork 0
/
prom graph.txt
303 lines (178 loc) · 7.05 KB
/
prom graph.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
centos installations
=======================
=======================
netstat -tnlp | grep -E '(22|111|2224|9090)'
lsof -i :22 :111 :2224 :9090
ss -tlnp | grep -E '(22|111|2224|9090)'
=======================
=======================
sudo systemctl stop cockpit
sudo systemctl disable cockpit
sudo systemctl status cockpit
netstat -tnl | grep 9090 // still in tcpv6
systemctl stop cockpit.socket
[root@sanjeev ~]# sudo dnf remove cockpit -y
[root@sanjeev ~]# sudo dnf autoremove -y
=======================
=======================
[root@server2 ~]# yum update -y --allowerasing --skip-broken --nobest
[root@server2 ~]# sudo su -
[root@server2 ~]# env | grep 2.2
[root@server2 ~]# export RELEASE="2.2.1"
=======================
=======================
[root@server2 ~]# useradd --no-create-home --shell /bin/false prometheus
[root@server2 ~]# useradd --no-create-home --shell /bin/false node_exporter
[root@server2 ~]# mkdir /etc/prometheus
[root@server2 ~]# mkdir /var/lib/prometheus
=======================
=======================
[root@server2 ~]# chown prometheus:prometheus /etc/prometheus
[root@server2 ~]# chown prometheus:prometheus /var/lib/prometheus
======================
=======================
https://prometheus.io/download/
[root@server2 ~]# cd /opt/
[root@server2 opt]# wget https://github.com/prometheus/prometheus/releases/download/v2.51.0/prometheus-2.51.0.linux-amd64.tar.gz
[root@server2 opt]# tar -xvf prometheus-*.tar.gz
[root@server2 opt]# cd prometheus-2.51.0.linux-amd64/
[root@server2 prometheus-2.51.0.linux-amd64]# ls
[root@server2 prometheus-2.51.0.linux-amd64]# cp prometheus /usr/local/bin
[root@server2 prometheus-2.51.0.linux-amd64]# cp promtool /usr/local/bin
[root@sanjeev prometheus-2.51.0.linux-amd64]# cd
[root@server2 ~]# chown prometheus:prometheus /usr/local/bin/prometheus
[root@server2 ~]# chown prometheus:prometheus /usr/local/bin/promtool
======================
=======================
[root@server2 ~]# cp -r /opt/prometheus-2.51.0.linux-amd64/consoles /etc/prometheus/
[root@server2 ~]# cp -r /opt/prometheus-2.51.0.linux-amd64/console_libraries/ /etc/prometheus/
[root@server2 ~]# cp /opt/prometheus-2.51.0.linux-amd64/prometheus.yml /etc/prometheus/
[root@server2 ~]# ls -l /etc/prometheus/
[root@server2 ~]# chown -R prometheus:prometheus /etc/prometheus/consoles/
[root@server2 ~]# chown -R prometheus:prometheus /etc/prometheus/console_libraries/
[root@server2 ~]# chown -R prometheus:prometheus /etc/prometheus/prometheus.yml
[root@server2 ~]# ls -l /etc/prometheus/
======================
=======================
[root@server2 ~]# prometheus --version
[root@server2 ~]# promtool --version
[root@server2 ~]# cat /etc/prometheus/prometheus.yml
======================
=======================
[root@server2 ~]# sudo -u prometheus /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
[root@server2 ~]# vim /etc/systemd/system/prometheus.service
[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
[root@server2 ~]# systemctl daemon-reload
[root@server2 ~]# systemctl start prometheus
[root@server2 ~]# systemctl enable prometheus
[root@server2 ~]# systemctl status prometheus
systemctl daemon-reload
systemctl start prometheus
systemctl enable prometheus
systemctl status prometheus
======================
=======================
[root@server2 ~]# netstat -tnl | grep 9090
[root@server2 ~]# firewall-cmd --add-port=9090/tcp --permanent
[root@server2 ~]# firewall-cmd --reload
http://192.168.1.130:9090
======================
=======================
[root@sanjeev ~]# netstat -tnl | grep 3000
[root@sanjeev ~]# cat /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/enterprise/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
[root@sanjeev ~]# yum install grafana -y
[root@sanjeev ~]# systemctl daemon-reload
[root@sanjeev ~]# systemctl enable grafana-server.service
[root@sanjeev ~]# systemctl start grafana-server.service
[root@sanjeev ~]# systemctl status grafana-server.service
[root@sanjeev ~]# firewall-cmd --add-port=3000/tcp --permanent
[root@sanjeev ~]# firewall-cmd --reload
http://192.168.1.130:3000/
======================
=======================
username: admin
password: admin
Grafana DataSource
Settings Icon ->> Configuration ->> data sources
Home >> Connections >> Data sources
Type: Prometheus
Prometheus URL: http://192.168.1.130:9090/
======================
=======================
Install Node Exporter
[root@sanjeev ~]# cd /opt/
[root@sanjeev opt]# wget wget https://github.com/prometheus/node_exporter/releases/download/v1.2.0/node_exporter-1.2.0.linux-amd64.tar.gz
[root@sanjeev opt]# ls -lh node_exporter-1.2.0.linux-amd64.tar.gz
[root@sanjeev opt]# tar -xvf node_exporter-1.2.0.linux-amd64.tar.gz
[root@sanjeev opt]# cd node_exporter-1.2.0.linux-amd64/
[root@sanjeev node_exporter-1.2.0.linux-amd64]# cp node_exporter /usr/local/bin/
[root@sanjeev ~]# chown prometheus:prometheus /usr/local/bin/node_exporter
[root@sanjeev ~]# vi /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=default.target
[root@sanjeev ~]# systemctl daemon-reload
[root@sanjeev ~]# systemctl enable node_exporter
[root@sanjeev ~]# systemctl start node_exporter
[root@sanjeev ~]# systemctl status node_exporter
======================
=======================
Configure the Node Exporter
as a Prometheus target
[root@sanjeev ~]# vim /etc/prometheus/prometheus.yml
- targets: ["localhost:9090","localhost:9100"]
[root@sanjeev ~]# systemctl restart prometheus
======================
=======================
Creating Grafana
Dashboard to Monitor Linux Server
Home >> Dashboards >> Import dashboard
14513 [LOAD]
======================
=======================
======================
=======================
======================
=======================
======================
=======================
======================
=======================
======================
=======================
======================