commit 1485a93801949dd52481b330e43078c26181baed
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Wed Jul 31 15:12:24 2019 +0200
Sync collectd
roles/collectd/base/tasks/main.yml | 59 ++++++++++++-----------
roles/collectd/base/templates/collectd.conf.j2 | 18 +++++++
roles/collectd/base/templates/graphite.conf | 2 +-
roles/collectd/bind/files/bind.conf | 21 ++++++++
roles/collectd/bind/tasks/main.yml | 15 ++++++
roles/collectd/memcached/tasks/main.yml | 2 +-
roles/collectd/postgres/templates/postgres.conf | 2 +-
roles/collectd/server/tasks/main.yml | 22 +++++++--
8 files changed, 105 insertions(+), 36 deletions(-)
---
diff --git a/roles/collectd/base/tasks/main.yml b/roles/collectd/base/tasks/main.yml
index 8848459..caeb5c6 100644
--- a/roles/collectd/base/tasks/main.yml
+++ b/roles/collectd/base/tasks/main.yml
@@ -1,9 +1,9 @@
---
-# collectd client setup
+# collectd client setup
# install pkg
- name: install collectd
- yum: name=collectd state=present
+ package: name=collectd state=present
tags:
- collectd
when: ansible_distribution_major_version|int < 22
@@ -15,11 +15,12 @@
- collectd
when: ansible_distribution_major_version|int > 21
-# enable collectd
-- name: enable collectd svc
- service: state=running enabled=true name=collectd
+# install collectd-disk on F25+ (it was split out)
+- name: install collectd-disk
+ dnf: name=collectd-disk state=present
tags:
- collectd
+ when: ansible_distribution_major_version|int > 24
# install collected.conf
- name: /etc/collectd.conf
@@ -48,34 +49,32 @@
when: inventory_hostname.startswith('hv01')
# apache - localhost only - pretty much any apache server
-- name: install collectd-apache
- yum: state=present name=collectd-apache
+- name: install collectd-apache (yum)
+ package: state=present name=collectd-apache
tags:
- collectd
notify:
- restart collectd
- when: collectd_apache is defined and ansible_distribution_major_version|int < 22
+ when: collectd_apache and ansible_distribution_major_version|int < 22
-- name: /etc/collectd/apache.conf
- copy: src=apache.conf dest=/etc/collectd.d/apache.conf
+- name: install collectd-apache (dnf)
+ dnf: state=present name=collectd-apache
tags:
- collectd
notify:
- restart collectd
- when: collectd_apache is defined
+ when: collectd_apache and ansible_distribution_major_version|int > 21
-- name: /etc/collectd/graphite.conf
- template: src=graphite.conf dest=/etc/collectd.d/graphite.conf
+- name: /etc/collectd/apache.conf
+ copy: src=apache.conf dest=/etc/collectd.d/apache.conf
tags:
- collectd
- - graphite
- - graphite-collectd
notify:
- restart collectd
- when: collectd_graphite is defined and ansible_distribution_major_version !=
'6'
+ when: collectd_apache
- name: Install libsemanage-python so we can set an sebool below
- yum: name=libsemanage-python state=present
+ package: name=libsemanage-python state=present
tags:
- collectd
when: collectd_apache is defined and ansible_distribution_major_version|int < 22
@@ -87,7 +86,7 @@
ignore_errors: True
notify:
- restart collectd
- when: collectd_apache is defined or collectd_graphite is defined
+ when: ( collectd_apache is defined ) and ansible_selinux.status !=
"disabled"
- name: enable collectd nfs module
copy: src=nfs.conf dest=/etc/collectd.d/nfs.conf
@@ -113,7 +112,7 @@
- name: check to see if its even installed yet
shell: semodule -l | grep fi-collectd | wc -l
register: ficgeneral_grep
- check_mode: False
+ check_mode: no
changed_when: "'0' in ficgeneral_grep.stdout"
tags:
- collectd
@@ -121,7 +120,7 @@
- name: install our general collectd selinux module
command: semodule -i /usr/share/collectd/fi-collectd.pp
- when: ficgeneral_module|changed or ficgeneral_grep|changed
+ when: ficgeneral_module is changed or ficgeneral_grep is changed
tags:
- collectd
- selinux
@@ -138,7 +137,7 @@
shell: semodule -l | grep fi-pstorefs | wc -l
when: ansible_distribution_major_version|int != 6
register: ficpstorefs_grep
- check_mode: False
+ check_mode: no
changed_when: "'0' in ficpstorefs_grep.stdout"
tags:
- collectd
@@ -146,25 +145,23 @@
- name: install our pstorefs/collectd selinux module
command: semodule -i /usr/share/collectd/fi-pstorefs.pp
- when: ansible_distribution_major_version|int != 6 and (ficpstorefs_module|changed or
ficpstorefs_grep|changed)
+ when: ansible_distribution_major_version|int != 6 and (ficpstorefs_module is changed or
ficpstorefs_grep is changed)
tags:
- collectd
- selinux
-
+
# each of the below should move to a separate task list
# since they are odd-balls and one-offs
-# bind - localhost only - ns servers only
-
# fedmsg - busgateway## only
# add /usr/share/collectd/fedmsg-types.db
-
+
# memcached - memcached only
# postgres - this is a conn check
-## add /usr/share/collectd/pgconn-types.db
+## add /usr/share/collectd/pgconn-types.db
# openvpn - for bastion/openvpn gateways only
@@ -174,8 +171,12 @@
# haproxy
## add /usr/share/collectd/haproxy-types.db
## add socat pkg
-##
+##
# webproxy
-
+# enable collectd
+- name: enable collectd svc
+ service: state=started enabled=true name=collectd
+ tags:
+ - collectd
diff --git a/roles/collectd/base/templates/collectd.conf.j2
b/roles/collectd/base/templates/collectd.conf.j2
index 91f5a63..87ab32d 100644
--- a/roles/collectd/base/templates/collectd.conf.j2
+++ b/roles/collectd/base/templates/collectd.conf.j2
@@ -39,6 +39,24 @@ LoadPlugin vmem
IgnoreSelected false
</Plugin>
+<Plugin "interface">
+ Interface "/^veth/"
+ IgnoreSelected true
+</Plugin>
+
+<Plugin "df">
+ MountPoint "^/.*/.snapshot/"
+ MountPoint "^/var/lib/containers/storage/overlay/.*/merged/"
+ MountPoint "^/var/lib/containers/docker/devicemapper/.*/.*/"
+ MountPoint "^/var/lib/origin/openshift.local.volumes.*"
+ MountPoint "^/run/containers/storage/overlay-containers/.*"
+ MountPoint "^/tmp/iso/mount/"
+ FSType "shm"
+ FSType "tmpfs"
+ FSType "overlay"
+ IgnoreSelected true
+</Plugin>
+
<Plugin hddtemp>
TranslateDevicename false
</Plugin>
diff --git a/roles/collectd/base/templates/graphite.conf
b/roles/collectd/base/templates/graphite.conf
index 4b76a99..c0e467f 100644
--- a/roles/collectd/base/templates/graphite.conf
+++ b/roles/collectd/base/templates/graphite.conf
@@ -2,7 +2,7 @@ LoadPlugin "write_graphite"
<Plugin "write_graphite">
<Node "laptop">
- Host "graphite.cloud.fedoraproject.org"
+ Host "graphite.rpmfusion.org"
Port "2003"
Prefix "collectd.{{ env }}."
#Postfix ""
diff --git a/roles/collectd/bind/files/bind.conf b/roles/collectd/bind/files/bind.conf
new file mode 100644
index 0000000..bdb4caa
--- /dev/null
+++ b/roles/collectd/bind/files/bind.conf
@@ -0,0 +1,21 @@
+LoadPlugin bind
+
+<Plugin bind>
+ URL "http://localhost:8053/"
+ OpCodes true
+ QTypes true
+
+ ServerStats true
+ ZoneMaintStats true
+ ResolverStats false
+ MemoryStats true
+
+ <View "DEFAULT">
+ QTypes true
+ ResolverStats true
+ CacheRRSets true
+
+ Zone "127.in-addr.arpa/IN"
+ </View>
+</Plugin>
+
diff --git a/roles/collectd/bind/tasks/main.yml b/roles/collectd/bind/tasks/main.yml
new file mode 100644
index 0000000..878140c
--- /dev/null
+++ b/roles/collectd/bind/tasks/main.yml
@@ -0,0 +1,15 @@
+---
+
+- name: install collectd-bind
+ package: name=collectd-bind state=present
+ tags:
+ - packages
+ - collectd
+
+- name: Copy in /etc/collectd.d/bind.conf
+ copy: >
+ src=bind.conf
+ dest=/etc/collectd.d/bind.conf
+ tags:
+ - collectd
+ notify: restart collectd
diff --git a/roles/collectd/memcached/tasks/main.yml
b/roles/collectd/memcached/tasks/main.yml
index fc0d04f..f363df8 100644
--- a/roles/collectd/memcached/tasks/main.yml
+++ b/roles/collectd/memcached/tasks/main.yml
@@ -9,7 +9,7 @@
notify: restart collectd
- name: Ensure that semanage is present
- yum: name=policycoreutils-python state=present
+ package: name=policycoreutils-python state=present
tags:
- collectd/memcached
- collectd
diff --git a/roles/collectd/postgres/templates/postgres.conf
b/roles/collectd/postgres/templates/postgres.conf
index be57b93..d829e00 100644
--- a/roles/collectd/postgres/templates/postgres.conf
+++ b/roles/collectd/postgres/templates/postgres.conf
@@ -1,3 +1,3 @@
<Plugin exec>
- Exec "nobody" "/usr/local/bin/collectd-postgres.sh"
"-h" "{{ ansible_fqdn }}" "-p" "10"
+ Exec "nobody" "/usr/local/bin/collectd-postgres.sh"
"-h" "{{ inventory_hostname }}" "-p" "10"
</Plugin>
diff --git a/roles/collectd/server/tasks/main.yml b/roles/collectd/server/tasks/main.yml
index c934c87..1cebff2 100644
--- a/roles/collectd/server/tasks/main.yml
+++ b/roles/collectd/server/tasks/main.yml
@@ -1,10 +1,10 @@
---
-# collectd server setup
+# collectd server setup
# install pkg
- name: install collectd server packages
- yum: name={{ item }} state=present
- with_items:
+ package: name={{ item }} state=present
+ with_items:
- collectd-rrdtool
- collectd-ping
- collectd-web
@@ -40,6 +40,20 @@
# install upgrade target
- name: install collect upgrade target to handle v4 clients
copy: src=vfive-upgrade.conf dest=/etc/collectd.d/vfive-upgrade.conf
- tags:
+ tags:
+ - config
+ - collectd/server
+
+# create /var/log/collectd as it's on a larger volume
+- name: create /var/log/collectd
+ file: path=/var/log/collectd owner=root group=root mode=0755 state=directory
+ tags:
+ - config
+ - collectd/server
+
+# create a link from /var/lib/collectd to /var/log/collectd
+- name: create link from /var/lib/collectd to /var/log/collectd
+ file: state=link src=/var/log/collectd dest=/var/lib/collectd
+ tags:
- config
- collectd/server