Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/split template 5.4 5.5 #8

Merged
merged 6 commits into from
Jun 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,59 @@ The following may also be added to your inventory.

* `collectd_interval`: at what interval in seconds to take measurements (default: 60)
* `check_disk`: a value which we will use to select what disk to monitor (default: xvde)
* `fs_type`: the file system type to monitor (default: ext4)
* `collectd_df_fs_type`: the file system type to monitor (Collectd 5.4 default: ext4. Collectd 5.5 default: undefined)
* `collectd_df_device`: the dev device to monitor.
* `collectd_df_mountpoint`: the mount point to monitor.
* `collectd_df_IgnoreSelected`: [see wiki](https://collectd.org/wiki/index.php/Plugin:DF#Parameters) (default: false)
* `collectd_df_ReportByDevice`: [see wiki](https://collectd.org/wiki/index.php/Plugin:DF#Parameters) (default: false)
* `collectd_df_ReportInodes`: [see wiki](https://collectd.org/wiki/index.php/Plugin:DF#Parameters) (default: false)
* `collectd_df_ValuesAbsolute`: [see wiki](https://collectd.org/wiki/index.php/Plugin:DF#Parameters) (default: true)
* `collectd_df_ValuesPercentage`: [see wiki](https://collectd.org/wiki/index.php/Plugin:DF#Parameters) (default: false)
* `monitor_coretemp`: set to true if you want to monitor coretemp (only useful on real hardware)
* `private_ip`: set to the IP address of the `collectd_forwarder` if `collectd_fowarder` has multiple IPs. Example:
```
collectd1.somedc.prod ansible_ssh_host=10.0.1.111 private_ip=172.16.1.111
```

### Plugin configuration

#### [Disk](https://collectd.org/wiki/index.php/Plugin:Disk)


Default: xvde

```
check_disk: xvde
```

#### [DF](https://collectd.org/wiki/index.php/Plugin:DF)

All options are optional.

The following should be set as an array.
Example 1: (Single value)
```
collectd_df_device: '["/dev/xvda1"]'
collectd_df_mountpoint: '["/"]'
collectd_df_fs_type: '["xfs"]'
```
Example 2: (Multiple values)
```
collectd_df_device: '["/dev/xvda1","/dev/xvdb1"]'
collectd_df_mountpoint: '["/","/data"]'
collectd_df_fs_type: '["xfs","ext4"]'
```

You can change the rest of the defaults.
```
collectd_df_IgnoreSelected: false
collectd_df_ReportByDevice: false
collectd_df_ReportInodes: false
collectd_df_ValuesAbsolute: true
collectd_df_ValuesPercentage: false
```


### Roles addition

It is possible for any roles to add their own custom metric collection configuration.
Expand Down
17 changes: 17 additions & 0 deletions tasks/centos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: "Set collectd's config file destination"
set_fact: >
collectd_config_dest=/etc/collectd.conf
collectd_d_config_dir=/etc/collectd.d
tags:
- collectd

Expand Down Expand Up @@ -71,3 +72,19 @@
tags:
- collectd
- files

- name: "Get Collectd version"
shell: |
executable=/bin/bash
v=$(rpm -qa --queryformat %{version} collectd); echo "${v%.*}"
register: collectd_version
tags:
- collectd
- files

- name: "Set version"
set_fact:
installed_version: "{{ collectd_version.stdout }}"
tags:
- collectd
- files
19 changes: 18 additions & 1 deletion tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: "Set collectd's config file destination"
set_fact: >
collectd_config_dest=/etc/collectd/collectd.conf
collectd_d_config_dir=/etc/collectd/collectd.conf.d
tags:
- collectd

Expand All @@ -25,4 +26,20 @@
when: monitor_coretemp
tags:
- collectd
- files
- files

- name: "Get Collectd version"
shell: |
executable=/bin/bash
v=$(dpkg-query --showformat='${Version}' --show collectd); echo "${v%.*}"
register: collectd_version
tags:
- collectd
- files

- name: "Set version"
set_fact:
installed_version: "{{ collectd_version.stdout }}"
tags:
- collectd
- files
16 changes: 14 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,21 @@
- files
- configs

- name: "Upload df plugin config"
template: >
src=df.conf.j2
dest={{ collectd_d_config_dir }}/df.conf
mode=0644
notify:
- Restart collectd
tags:
- collectd
- files
- configs

- name: "Upload Librato collectd config"
template: >
src=librato.conf.j2
src=librato.conf.{{ installed_version }}.j2
dest=/etc/collectd.d/librato.conf
owner=root
group=root
Expand All @@ -53,7 +65,7 @@

- name: "Install /etc/collectd.conf"
template: >
src=collectd.conf.j2
src=collectd.conf.{{ installed_version }}.j2
dest={{ collectd_config_dest }}
mode=0644
notify:
Expand Down
4 changes: 0 additions & 4 deletions templates/collectd.conf.j2 → templates/collectd.conf.5.4.j2
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ LoadPlugin network
ReportStats false
</Plugin>

LoadPlugin df
<Plugin df>
FSType "{{ fs_type|default('ext4') }}"
</Plugin>

#
# Custom python plugins
Expand Down
Loading