-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprometheus_script.tftpl
More file actions
122 lines (115 loc) · 3.91 KB
/
Copy pathprometheus_script.tftpl
File metadata and controls
122 lines (115 loc) · 3.91 KB
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
#!/bin/bash
yum update -y
useradd -Ms /bin/false prometheus
mkdir /etc/prometheus
mkdir /var/lib/prometheus
chown prometheus:prometheus /var/lib/prometheus
cd /tmp/
wget https://github.com/prometheus/prometheus/releases/download/v2.37.2/prometheus-2.37.2.linux-amd64.tar.gz
tar -xvf prometheus-2.37.2.linux-amd64.tar.gz
cd prometheus-2.37.2.linux-amd64
mv console* /etc/prometheus
mv prometheus.yml /etc/prometheus
chown -R prometheus:prometheus /etc/prometheus
mv prometheus /usr/local/bin/
mv promtool /usr/local/bin/
chown prometheus:prometheus /usr/local/bin/prometheus
cat << EOT > /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
Restart=on-failure
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
EOT
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
useradd -Mrs /bin/false node_exporter
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.4.0/node_exporter-1.4.0.linux-amd64.tar.gz
tar -xvf node_exporter-1.4.0.linux-amd64.tar.gz
mv node_exporter-1.4.0.linux-amd64/node_exporter /usr/local/bin/
chown node_exporter:node_exporter /usr/local/bin/node_exporter
cat << EOT > /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
Restart=on-failure
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
EOT
systemctl daemon-reload
systemctl enable node_exporter
systemctl start node_exporter
useradd -Mrs /bin/false process_exporter
cd /tmp
wget https://github.com/ncabatoff/process-exporter/releases/download/v0.7.10/process-exporter-0.7.10.linux-amd64.tar.gz
tar -xvf process-exporter-0.7.10.linux-amd64.tar.gz
mv process-exporter-0.7.10.linux-amd64/process-exporter /usr/local/bin/
chown process_exporter:process_exporter /usr/local/bin/process-exporter
mkdir /etc/process_exporter
chown process_exporter:process_exporter /etc/process_exporter
touch /etc/process_exporter/process-exporter.yaml
chown process_exporter:process_exporter /etc/process_exporter/process-exporter.yaml
cat << EOT > /etc/systemd/system/process_exporter.service
[Unit]
Description=Process Exporter
After=network.target
[Service]
User=process_exporter
Group=process_exporter
Type=simple
Restart=on-failure
ExecStart=/usr/local/bin/process-exporter \
--config.path /etc/process_exporter/process-exporter.yaml \
--web.listen-address=:9256
[Install]
WantedBy=multi-user.target
EOT
systemctl daemon-reload
systemctl enable process_exporter
systemctl start process_exporter
useradd -Mrs /bin/false alertmanager
cd /tmp
wget https://github.com/prometheus/alertmanager/releases/download/v0.24.0/alertmanager-0.24.0.linux-amd64.tar.gz
tar -xvf alertmanager-0.24.0.linux-amd64.tar.gz
mv alertmanager-0.24.0.linux-amd64/alertmanager /usr/local/bin/
chown alertmanager:alertmanager /usr/local/bin/alertmanager
mkdir /etc/alertmanager
chown alertmanager:alertmanager /etc/alertmanager
touch /etc/alertmanager/alertmanager.yml
chown alertmanager:alertmanager /etc/alertmanager/alertmanager.yml
mkdir /var/lib/alertmanager
cat << EOT > /etc/systemd/system/alertmanager.service
[Unit]
Description=AlertManager Server Service
After=network-online.target
[Service]
User=alertmanager
Group=alertmanager
Type=Simple
ExecStart=/usr/local/bin/alertmanager \
--config.file /etc/alertmanager/alertmanager.yml \
--storage.path /var/lib/alertmanager
[Install]
WantedBy=multi-user.target
EOT
systemctl daemon-reload
systemctl start alertmanager
systemctl enable alertmanager