buluma.collectd
Ansible ロール collectd
システムに collectd をインストールし、設定します。
GitHub | バージョン | 問題 | プルリクエスト | ダウンロード数 |
---|---|---|---|---|
例 Playbook
この例は molecule/default/converge.yml
から取得されており、各プッシュ、プルリクエスト、リリース時にテストされています。
---
- name: converge
hosts: all
become: true
gather_facts: true
vars:
collectd_plugin_logging: logfile
collectd_basic_plugins:
- cpu
- interface
- load
- memory
collectd_plugins:
- name: df
config: |
MountPoint "/proc"
MountPoint "/dev"
MountPoint "/\/docker\/containers\//"
MountPoint "/\/docker\/devicemapper\//"
MountPoint "/\/docker\/plugins\//"
MountPoint "/\/docker\/overlay\//"
MountPoint "/\/docker\/overlay2\//"
MountPoint "/\/docker\/netns\//"
FSType "overlay"
FSType "proc"
FSType "tmpfs"
IgnoreSelected true
ReportInodes true
- name: disk
config: |
Disk "/^hd"
IgnoreSelected true
- name: interface
config: |
Interface "lo"
Interface "/veth.*/"
IgnoreSelected true
- name: swap
config: |
ReportByDevice false
ReportBytes true
- name: write_http
config: |
<Node "test">
URL "127.0.0.1:8080/test.collectd"
Format "JSON"
StoreRates true
</Node>
- name: postgresql
config: |
<Query tickets>
Statement "SELECT count(t.id) AS count FROM tickets t WHERE t.closed is null;"
<Result>
Type gauge
InstancePrefix "tickets"
ValuesFrom "count"
</Result>
</Query>
<Database "test">
Host "psql-database.hostname.com"
Port "5432"
User "my_psqladminuser"
Password "my_passwd"
SSLMode "prefer"
Query tickets
</Database>
pre_tasks:
- name: apt キャッシュを更新します。
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
roles:
- role: buluma.collectd
マシンを準備する必要があります。CI では molecule/default/prepare.yml
を使用してこれを行います。
---
- name: prepare
hosts: all
become: true
gather_facts: false
roles:
- role: buluma.bootstrap
- role: buluma.epel
これらのロールの使い方については、完全な説明と例もご覧ください。
ロール変数
変数のデフォルト値は defaults/main.yml
に設定されています。
---
# collectdのデフォルトファイル
collectd_conf_hostname: "{{ ansible_hostname }}"
collectd_conf_fqdnlookup: "false"
collectd_conf_basedir: /var/lib/collectd
collectd_conf_pidfile: /var/run/collectd.pid
collectd_conf_typesdb: /usr/share/collectd/types.db
collectd_conf_autoloadplugin: "false"
collectd_conf_collectinternalstats: "false"
collectd_conf_interval: 10
collectd_conf_maxreadinterval: 86400
collectd_conf_timeout: 2
collectd_conf_readthreads: 5
collectd_conf_writethreads: 5
collectd_conf_include_dir: /etc/collectd.d
collectd_conf_fnmatch_filters:
- "*.conf"
collectd_conf_extra: ~
#### ロギング設定
collectd_plugin_logging: syslog
collectd_plugin_logging_directory: "/var/log/collectd"
collectd_plugin_logfile_loglevel: "info"
collectd_plugin_logfile_file: "{{ collectd_plugin_logging_directory }}/collectd.log"
collectd_plugin_logfile_timestamp: "true"
collectd_plugin_logfile_printseverity: "false"
collectd_plugin_logstash_loglevel: "info"
collectd_plugin_logstash_file: "{{ collectd_plugin_logging_directory }}/collectd.json.log"
collectd_plugin_syslog_loglevel: "info"
# collectd_plugin_syslog_notifylevel: ""
# 追加の設定無しで利用可能なプラグインを有効にするために 'collectd_basic_plugins' を使用します。
collectd_basic_plugins:
- cpu
- interface
- load
- memory
# - aggregation
# - amqp
# - apache
# - apcups
# - apple_sensors
# - aquaero
# - ascent
# - barometer
# - battery
# - bind
# - ceph
# - cgroups
# - chrony
# - conntrack
# - contextswitch
# - cpu
# - cpufreq
# - cpusleep
# - csv
# - curl
# - curl_json
# - curl_xml
# - dbi
# - df
# - disk
# - dns
# - dpdkevents
# - dpdkstat
# - drbd
# - email
# - entropy
# - ethstat
# - exec
# - fhcount
# - filecount
# - fscache
# - gmond
# - gps
# - grpc
# - hddtemp
# - hugepages
# - intel_pmu
# - intel_rdt
# - interface
# - ipc
# - ipmi
# - iptables
# - ipvs
# - irq
# - java
# - load
# - lpar
# - lua
# - lvm
# - madwifi
# - mbmon
# - mcelog
# - md
# - memcachec
# - memcached
# - memory
# - mic
# - modbus
# - mqtt
# - multimeter
# - mysql
# - netapp
# - netlink
# - network
# - nfs
# - nginx
# - notify_desktop
# - notify_email
# - notify_nagios
# - ntpd
# - numa
# - nut
# - olsrd
# - onewire
# - openldap
# - openvpn
# - oracle
# - ovs_events
# - ovs_stats
# - perl
# - pinba
# - ping
# - postgresql
# - powerdns
# - processes
# - protocols
# - python
# - redis
# - routeros
# - rrdcached
# - rrdtool
# - sensors
# - serial
# - sigrok
# - smart
# - snmp
# - snmp_agent
# - statsd
# - swap
# - table
# - tail
# - tail_csv
# - tape
# - tcpconns
# - teamspeak2
# - ted
# - thermal
# - tokyotyrant
# - turbostat
# - unixsock
# - uptime
# - users
# - uuid
# - varnish
# - virt
# - vmem
# - vserver
# - wireless
# - write_graphite
# - write_http
# - write_kafka
# - write_log
# - write_mongodb
# - write_prometheus
# - write_redis
# - write_riemann
# - write_sensu
# - write_tsdb
# - xencpu
# - xmms
# - zfs_arc
# - zone
# - zookeeper
# 追加の設定が必要なプラグインを有効にするには 'collectd_plugins' を使用します。
collectd_plugins: []
# 例:
# - name: example
# interval: 120 #秒
# flush_interval: 600 #秒
# flush_timeout:
# config: |4
# Something: true
# <Nested block>
# NestedKey: "value"
# </Nested>
# - name: write_http
# config: |4
# <Node "oms">
# URL "127.0.0.1:26000/oms.collectd"
# Format "JSON"
# StoreRates true
# </Node>
# - name: postgresql
# config: |4
# <Query tickets>
# Statement "SELECT count(t.id) AS count FROM tickets t WHERE t.closed is null;"
# <Result>
# Type gauge
# InstancePrefix "tickets"
# ValuesFrom "count"
# </Result>
# </Query>
# <Database "test">
# Host "psql-database.hostname.com"
# Port "5432"
# User "my_psqladminuser"
# Password "my_passwd"
# SSLMode "prefer"
# Query tickets
# </Database>
要件
- requirements.txt にリストされている pip パッケージ。
使用されるロールの状態
システムを準備するために以下のロールが使用されます。別の方法でシステムを準備することもできます。
必要なもの | GitHub | バージョン |
---|---|---|
buluma.bootstrap | ||
buluma.epel |
コンテキスト
このロールは、複数の互換性のあるロールの一部です。詳細については、これらのロールのドキュメントをご覧ください。
関連するロールの概要は以下のとおりです:
互換性
このロールは、以下の コンテナイメージ でテストされています。
コンテナ | タグ |
---|---|
Alpine | すべて |
EL | 8 |
Debian | bullseye |
Fedora | すべて |
opensuse | すべて |
Ubuntu | focal, bionic |
必要な Ansible の最小バージョンは 2.10 で、以下のテストが行われています:
- 前のバージョン。
- 現在のバージョン。
- 開発バージョン。
問題が見つかった場合は、GitHubに報告してください。