-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_prometheus_script.tftpl.bckup
145 lines (140 loc) · 4.63 KB
/
my_prometheus_script.tftpl.bckup
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
#!/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
sleep 3
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
sleep 5
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/
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
sleep 3
systemctl daemon-reload
systemctl enable node_exporter
systemctl start node_exporter
sleep 5
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
# cat << EOT > /etc/process_exporter/process-exporter.yaml
# process_names:
# - comm:
# # Data service responsible for storing user data
# - memcached
# # Couchbase cluster manager run as Erlang virtual machines -
# # babysitter, ns_server, and ns_couchdb
# - beam.smp
# # Index service
# - indexer
# # Full-Text Search Service
# - cbft
# # Analytics Service
# - cbas
# # Couchbase Query service
# - cbq-engine
# # Extracts secondary key from documents
# - projector
# # Cross Data Center Replication (XDCR) - replicates data from one cluster to another
# - goxdcr
# # Utility in Go to get disk usage stats
# - godu
# # Process that acts as a bridge between ns_server (Erlang) and the other
# # server components (cbq- engine, cbft, etc.)
# - goport
# # Service that is used to encrypt the cluster configuration stored on disk
# - gosecrets
# # Erlang port process (wrapper) used to talk to the saslauthd daemon for authentication purposes
# - saslauthd-port
# # Erlang-specfic process which acts as a name server for Erlang distribution
# - epmd
# # Erlang-specific process used to collect CPU: 1 for ns_server VM and 1 for ns_couchdb VM
# - cpu_sup
# # Erlang-specific process used to collect memory usage: 1 for ns_server VM
# # and 1 for ns_couchdb VM
# - memsup
# # Built-in Erlang port process that is used to perform name service lookup
# - inet_gethost
# # Open source tool sigar that is used to collect system information
# - portsigar
# # Eventing Service
# - eventing-produc
# # Eventing Service
# - eventing-consum
# - uwsgi
# - prometheus
# - alertmanager
# - grafana
# EOT
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
sleep 3
systemctl daemon-reload
systemctl enable process-exporter
systemctl start process-exporter