-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-promtail-hyper.sh
More file actions
154 lines (143 loc) · 2.5 KB
/
config-promtail-hyper.sh
File metadata and controls
154 lines (143 loc) · 2.5 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
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
#!/bin/bash
# List of hosts
hosts=(
compute-1
compute-2
compute-3
compute-4
compute-5
compute-6
compute-7
compute-8
compute-9
compute-10
compute-11
compute-12
compute-13
compute-14
compute-15
compute-16
compute-17
compute-18
compute-19
compute-20
compute-21
compute-22
compute-23
compute-24
compute-25
compute-26
compute-27
compute-28
compute-29
compute-30
compute-31
compute-32
compute-33
compute-34
compute-35
compute-36
compute-37
compute-38
compute-39
compute-40
compute-41
compute-42
compute-43
compute-44
compute-45
compute-46
compute-47
compute-48
compute-49
compute-50
compute-51
compute-52
compute-53
compute-54
compute-55
compute-56
compute-57
compute-58
compute-59
compute-60
compute-61
compute-62
compute-63
compute-64
compute-65
compute-66
compute-67
)
# Path konfigurasi Promtail
# config_path="/usr/local/bin/config-promtail-hyper.yml"
# Membuat konfigurasi untuk setiap host
for host in "${hosts[@]}"; do
echo "Creating Promtail config for ${host}..."
ssh "${host}" "sudo cat << EOF > "/usr/local/bin/config-promtail-hyper.yml"
server:
http_listen_port: 9081
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
client:
url: http://172.18.251.13:3100/loki/api/v1/push
scrape_configs:
- job_name: oslog
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: oslog
__path__: /var/log/{cinder,ceph,openvswitch,ovn,keystone}/*.log
- job_name: haproxy
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: oslog
__path__: /var/log/haproxy.log
- job_name: neutron
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: neutron
__path__: /var/log/neutron/*.log
- job_name: nova
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: nova
__path__: /var/log/nova/*.log
- job_name: ssh
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: ssh
__path__: /var/log/auth.log
relabel_configs:
- source_labels: [__address__]
target_label: instance
- job_name: kernel
static_configs:
- targets:
- localhost
labels:
host: ${host}
job: kernel
__path__: /var/log/kern.log
EOF"
echo "Promtail config for ${host} created."
# Restart Promtail
echo "Restarting Promtail..."
ssh ${host} sudo systemctl restart promtail-hyper.service
echo "Promtail restarted."
done