-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpcp.yaml
190 lines (165 loc) · 6.07 KB
/
pcp.yaml
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
---
- hosts: hosts
remote_user: root
gather_facts: no
tasks:
- name: unlock the packages
shell: foreman-maintain packages unlock
- name: enable optional repos & install PCP packages
shell: "{{ item }}"
with_items:
- subscription-manager repos --enable rhel-7-server-optional-rpms
- yum install pcp pcp-pmda-apache pcp-pmda-postgresql pcp-system-tools pcp-webjs -y
- name: enable & start pmcd,pmlogger daemons
service:
name: "{{ item }}"
enabled: yes
state: started
with_items:
- pmcd
- pmlogger
- name: create a file with content
copy:
dest: /var/lib/pcp/pmdas/proc/hotproc.conf
content: |
#pmdahotproc
Version 1.0
# processes with load 0.9 or 1GB RSS memory
(cpuburn > 0.9 || residentsize > 1000000) &&
(
fname == "java" ||
fname == "qdrouterd" ||
fname == "qpidd" ||
(fname == "postgres" && psargs ~ /-D/) ||
fname == "mongod" ||
fname == "dynflow_executor" ||
fname == "dynflow_executor_monitor" ||
fname ~ /smart_proxy_dynflow_core/ ||
psargs ~ /Passenger RackApp/ ||
psargs ~ /celery beat/ ||
psargs ~ /celery worker/ ||
psargs ~ /pulp/ ||
psargs ~ /smart-proxy/ ||
psargs ~ /squid.conf/
)"
- name: create a new dir to configure PCP to log the process metrics
file:
path: /var/lib/pcp/config/pmlogconf/foreman-hotproc
state: directory
mode: 0777
- name: create a file for summary
copy:
dest: /var/lib/pcp/config/pmlogconf/foreman-hotproc/summary
content: |
#pmlogconf-setup 2.0
ident foreman hotproc metrics
probe hotproc.control.config != "" ? include : exclude
hotproc.psinfo.psargs
hotproc.psinfo.cnswap
hotproc.psinfo.nswap
hotproc.psinfo.rss
hotproc.psinfo.vsize
hotproc.psinfo.cstime
hotproc.psinfo.cutime
hotproc.psinfo.stime
hotproc.psinfo.utime
hotproc.io.write_byteslt.changed == false"
hotproc.io.read_bytes
hotproc.schedstat.cpu_time
hotproc.fd.count
- name: install the process monitoring PMDA
shell: cd /var/lib/pcp/pmdas/proc ; ./Install
- name: enable Apache HTTP Server extended status module
copy:
dest: /etc/httpd/conf.d/01-status.conf
content: |
ExtendedStatus On
LoadModule status_module modules/mod_status.so
<Location "/server-status">
PassengerEnabled off
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>
- name: enable the Apache HTTP Server PMDA
shell: cd /var/lib/pcp/pmdas/apache ; echo | ./Install
- name: add a line to prevent the sat installer overwriting the extended status module
lineinfile:
path: /etc/foreman-installer/custom-hiera.yaml
line: 'apache::purge_configs: false'
- name: configure PCP to collect metrics from PostgreSQL
shell: "{{ item }}"
with_items:
- cd /var/lib/pcp/pmdas/postgresql ; ./Install
- semanage permissive -a pcp_pmcd_t
- yum install foreman-telemetry pcp-mmvstatsd -y
- name: copy the database file file from the remote host to the controller
slurp:
src: /etc/foreman/database.yml
register: result
- name: copy the stored contents
copy:
content: "{{ result['content'] | b64decode }}"
dest: ~/copy_file.yaml
delegate_to: localhost
- include_vars: ~/copy_file.yaml
- name: configure the PCP database interface to permit access to the PostgreSQL database
copy:
dest: /etc/pcpdbi.conf
content: |
$database = "dbi:Pg:dbname=foreman;host=localhost";
$username = "foreman";
$password = "{{ production.password }}";
$os_user = "foreman";
- name: enable pcp-mmvstatsd daemons
service:
name: pcp-mmvstatsd
enabled: yes
state: started
- name: enable the Satellite telemetry functionality
copy:
dest: /etc/foreman/settings.yaml
content: |
:telemetry:
:prefix: 'fm_rails'
:statsd:
:enabled: true
:host: '127.0.0.1:8125'
:protocol: 'statsd'
:prometheus:
:enabled: false
:logger:
:enabled: false
:level: 'INFO'
- name: schedule daily storage of metrics in archive files
copy:
dest: /etc/cron.daily/refresh_mmv
content: |
#!/bin/bash
echo "log mandatory on 1 minute mmv" | /usr/bin/pmlc -P
- name: change the permissons
shell: chmod +x /etc/cron.daily/refresh_mmv
- name: restart httpd pmcd pmlogger the services
service:
name: "{{ item }}"
state: restarted
with_items:
- httpd
- pmcd
- pmlogger
- name: PCP web API and applications
shell: yum install pcp-webapi pcp-webapp-grafana pcp-webapp-vector -y
- name: enable pmwebd daemons
service:
name: pmwebd
enabled: yes
- name: start the services
service:
name: "{{ item }}"
state: started
with_items:
- pmwebd
- firewalld
- name: open firewall port to allow access to the PCP web service
shell: firewall-cmd --add-port=44323/tcp ; firewall-cmd --permanent --add-port=44323/tcp