Move collectd
Collectd can be used for more than just OpenStack. To make things more generic, we are moving to collectd-openstack for OSP collectd. As well as collectd-generic for things that are not OpenStack specific. + (akrzos) nit picking some whitespace and simplifing the generic collectd config. Change-Id: I6e7364e7af24507b5568469e247088ecae85a7fe
This commit is contained in:
parent
0fa2c1e1c8
commit
270a4ed4b9
10
ansible/install/collectd-generic.yml
Normal file
10
ansible/install/collectd-generic.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
#
|
||||
# Generic Playbook to install collectd on generic machines
|
||||
#
|
||||
|
||||
- hosts: nodes
|
||||
remote_user: root
|
||||
roles:
|
||||
- common
|
||||
- collectd-generic
|
@ -7,7 +7,7 @@
|
||||
remote_user: "{{ local_remote_user }}"
|
||||
roles:
|
||||
- { role: common, when: collectd_undercloud }
|
||||
- { role: collectd, when: collectd_undercloud }
|
||||
- { role: collectd-openstack, when: collectd_undercloud }
|
||||
tasks:
|
||||
- name: Collectd off if not collectd_undercloud
|
||||
service: name=collectd state=stopped enabled=false
|
||||
@ -18,7 +18,7 @@
|
||||
remote_user: "{{ host_remote_user }}"
|
||||
roles:
|
||||
- { role: common, when: collectd_controller }
|
||||
- { role: collectd, when: collectd_controller }
|
||||
- { role: collectd-openstack, when: collectd_controller }
|
||||
tasks:
|
||||
- name: Collectd off if not collectd_controller
|
||||
service: name=collectd state=stopped enabled=false
|
||||
@ -29,7 +29,7 @@
|
||||
remote_user: "{{ host_remote_user }}"
|
||||
roles:
|
||||
- { role: common, when: collectd_ceph }
|
||||
- { role: collectd, when: collectd_ceph }
|
||||
- { role: collectd-openstack, when: collectd_ceph }
|
||||
tasks:
|
||||
- name: Collectd off if not collectd_ceph
|
||||
service: name=collectd state=stopped enabled=false
|
||||
@ -40,7 +40,7 @@
|
||||
remote_user: "{{ host_remote_user }}"
|
||||
roles:
|
||||
- { role: common, when: collectd_compute }
|
||||
- { role: collectd, when: collectd_compute }
|
||||
- { role: collectd-openstack, when: collectd_compute }
|
||||
tasks:
|
||||
- name: Collectd off if not collectd_compute
|
||||
service: name=collectd state=stopped enabled=false
|
85
ansible/install/roles/collectd-generic/tasks/main.yml
Normal file
85
ansible/install/roles/collectd-generic/tasks/main.yml
Normal file
@ -0,0 +1,85 @@
|
||||
---
|
||||
#
|
||||
# Install/run collectd for browbeat
|
||||
#
|
||||
|
||||
- name: Check for epel
|
||||
shell: rpm -qa | grep -q epel-release
|
||||
ignore_errors: true
|
||||
register: epel_installed
|
||||
|
||||
- name: Install epel repo
|
||||
command: rpm -ivh {{ epel_repo }}
|
||||
become: true
|
||||
when: epel_installed.rc != 0
|
||||
|
||||
- name: Install collectd rpms
|
||||
yum: name={{ item }} state=present
|
||||
become: true
|
||||
with_items:
|
||||
- collectd
|
||||
- collectd-turbostat
|
||||
|
||||
- name: Configure collectd.conf
|
||||
template:
|
||||
src=collectd.conf.j2
|
||||
dest=/etc/collectd.conf
|
||||
owner=root
|
||||
group=root
|
||||
mode=0644
|
||||
become: true
|
||||
with_items:
|
||||
- interval: "{{ collectd_interval }}"
|
||||
ip_address: "{{ graphite_host }}"
|
||||
prefix: "{{ graphite_prefix }}"
|
||||
|
||||
#
|
||||
# Configure selinux bits
|
||||
#
|
||||
- name: Check for collectd permissive
|
||||
shell: semodule -l | grep -q permissive_collectd_t
|
||||
become: true
|
||||
register: collectd_permissive
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Set permissive for collectd
|
||||
shell: semanage permissive -a collectd_t
|
||||
become: true
|
||||
when: collectd_permissive.rc != 0
|
||||
|
||||
#
|
||||
# Additional policy bits may be needed for exec
|
||||
#
|
||||
- name: Collectd policy customization
|
||||
copy:
|
||||
src=custom-collectd.pp
|
||||
dest=/root/custom-collectd.pp
|
||||
owner=root
|
||||
group=root
|
||||
mode=644
|
||||
become: true
|
||||
|
||||
- name: Check for collectd custom
|
||||
shell: semodule -l | grep -q custom-collectd
|
||||
become: true
|
||||
register: collectd_custom
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Set custom policy for collectd
|
||||
shell: semodule -i /root/custom-collectd.pp
|
||||
become: true
|
||||
when: collectd_custom.rc != 0
|
||||
|
||||
#
|
||||
# Start collectd service
|
||||
#
|
||||
- name: Setup collectd service
|
||||
service: name=collectd state=restarted enabled=true
|
||||
become: true
|
||||
|
||||
- name: Disable EPEL
|
||||
shell: rpm -e epel-release
|
||||
ignore_errors: true
|
||||
become: true
|
@ -0,0 +1,85 @@
|
||||
# Installed by Browbeat Ansible Installer
|
||||
|
||||
# Interval default is 10s
|
||||
Interval {{ item.interval }}
|
||||
|
||||
# Hostname for this machine, if not defined, use gethostname(2) system call
|
||||
Hostname "{{inventory_hostname}}"
|
||||
|
||||
# Allow collectd to log
|
||||
LoadPlugin syslog
|
||||
|
||||
# Loaded Plugins:
|
||||
LoadPlugin write_graphite
|
||||
LoadPlugin cpu
|
||||
LoadPlugin df
|
||||
LoadPlugin disk
|
||||
LoadPlugin interface
|
||||
LoadPlugin irq
|
||||
LoadPlugin load
|
||||
LoadPlugin match_regex
|
||||
LoadPlugin memory
|
||||
LoadPlugin numa
|
||||
LoadPlugin processes
|
||||
LoadPlugin swap
|
||||
LoadPlugin turbostat
|
||||
LoadPlugin uptime
|
||||
|
||||
PreCacheChain "PreCache"
|
||||
<Chain "PreCache">
|
||||
<Rule "ignore_tap">
|
||||
<Match "regex">
|
||||
Plugin "^interface$"
|
||||
PluginInstance "^tap*"
|
||||
</Match>
|
||||
Target "stop"
|
||||
</Rule>
|
||||
<Rule "ignore_interfaces_q">
|
||||
<Match "regex">
|
||||
Plugin "^interface$"
|
||||
PluginInstance "^q.*"
|
||||
</Match>
|
||||
Target "stop"
|
||||
</Rule>
|
||||
Target "return"
|
||||
</Chain>
|
||||
|
||||
# Graphite Host Configuration
|
||||
<Plugin write_graphite>
|
||||
<Carbon>
|
||||
Host "{{ item.ip_address }}"
|
||||
Port "2003"
|
||||
Prefix "{{ item.prefix }}."
|
||||
Protocol "tcp"
|
||||
LogSendErrors true
|
||||
StoreRates true
|
||||
AlwaysAppendDS false
|
||||
EscapeCharacter "_"
|
||||
</Carbon>
|
||||
</Plugin>
|
||||
|
||||
<Plugin df>
|
||||
ValuesPercentage true
|
||||
</Plugin>
|
||||
|
||||
<Plugin disk>
|
||||
Disk "/^[hsv]d[a-z]+[0-9]?$/"
|
||||
IgnoreSelected false
|
||||
</Plugin>
|
||||
|
||||
<Plugin processes>
|
||||
# Example, collect on all httpd processes:
|
||||
Process "httpd"
|
||||
|
||||
# Collect on collectd process
|
||||
ProcessMatch "collectd" "/usr/sbin/collectd.+-C.+/etc/collectd.conf"
|
||||
</Plugin>
|
||||
|
||||
<Plugin swap>
|
||||
ReportBytes true
|
||||
ValuesPercentage true
|
||||
</Plugin>
|
||||
|
||||
|
||||
# Include other collectd configuration files
|
||||
Include "/etc/collectd.d"
|
Binary file not shown.
@ -89,5 +89,6 @@
|
||||
become: true
|
||||
|
||||
- name: Disable EPEL
|
||||
yum: disablerepo=epel
|
||||
shell: rpm -e epel-release
|
||||
ignore_errors: true
|
||||
become: true
|
@ -1 +0,0 @@
|
||||
Subproject commit 1f7820e845d13e824c945b58f61aaac360854171
|
Loading…
Reference in New Issue
Block a user