Description
collectd is a small daemon which collects system information
periodically and provides mechanisms to monitor and store the values
in a variety of ways. Since the daemon doesn't need to startup every
time it wants to update the values it's very fast and easy on the
system. Also, the statistics are very fine grained since the files are
updated every 10 seconds by default. The collected information can be
used to find current performance bottlenecks (performance analysis)
and predict future system load (capacity planning).
Juju collectd subordinate charm
This subordinate charm will deploy collectd daemon
By default metrics are not forwarded or exposed in any way
but that can be achieved using configuration options
Optionally the charm can expose metrics for prometheus scraping.
This requires prometheus-collectd-exporter package to
be available for installation
How to deploy the charm
The charm relates with any principal charm using juju-info interface.
Assuming that the principal service is called ubuntu and have a copy
of collectd subordinate in charms/$distrocodename/collectd relative
to your current directory.
... then to perform a deployment execute the following steps:
juju deploy --repository=charms local:trusty/collectd collectd
# and
juju add-relation ubuntu collectd
To send metrics to the graphite server listening on 192.168.99.10 port 2003:
juju set collectd graphite_endpoint=192.168.99.10:2003
To expose metrics for prometheus on port 9103 under "/metrics" URL:
juju set collectd prometheus_export=http://127.0.0.1:9103/metrics
See config.yaml for more details about configuration options
Development
Branch code to:
$JUJU_REPOSITORY/layers/collectd/
Modify
Assemble the charm:
charm compose
Configuration
- nagios_servicegroups
- (string) Comma separated list of nagios servicegroups for the graphite check
- juju
- graphite_protocol
- (string) TCP or UDP. Only used if graphite_endpoint is set
- TCP
- interval
- (int) Interval at which to query values by default
- 10
- graphite_prefix
- (string) Prepended to unit hostname in graphite. Only used in graphite_endpoint is set
- collectd.
- graphite_endpoint
- (string) Optional graphite hostname(or IP) and port. For example: graphite.example.com:2003 If set write_graphite will be enabled and configured
- hostname_type
- (string) Controls how hostname is determined by collectd. Accepted values are: fqdn - sets "FQDNLookup true" in the collectd.conf hostname - use python socket.gethostname() to get hostname. Useful in clouds where FQDN lookup does not work If unset or set to empty string defaults to fqdn
- prometheus_export
- (string) If set collectd will be configured to publish metrics to prometheus graphite_exporter service using write_http plugin. If host is set to 127.0.0.1 the charm will install collectd_exporter package which must be available for installation. See "install_sources" and "install_keys". Please note that it is also possible to send metric to remote collectd_exporter using collectd binary protocol. This can be done using "network_target" option. Examples: To send metrics to remote collectd_exporter instance using http POST to "/my-post-url": http://remote.host.example.com:9103/my-post-url To install collectd_exporter locally and expose metrics for prometheus scraping under "/metrics" URI set this option to: http://127.0.0.1:9103/metrics If set to "True", it'll default to "http://127.0.0.1:9103/metrics", specially handy if you're relating it to prometheus service, as this setting is still needed for the relation to work.
- nagios_context
- (string) A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
- juju
- network_target
- (string) Configured collectd to send data over network to remote collectd intance. Example: 192.168.99.99:25826
- plugins
- (string) Comma separated list of plugins to enable. If set to "default" list of plugins will match defaults shipped with Ubuntu package
- default
- install_keys
- (string) YAML list of GPG keys for installation sources, as a string. For apt repository URLs, use the public key ID used to verify package signatures. For other sources such as PPA, use empty string. This list must have the same number of elements as install_sources, even if the key items are all empty string. An example to go with the above for install_sources: install_keys: | - "" - ""
- install_sources
- (string) YAML list of additional installation sources, as a string. The number of install_sources must match the number of install_keys. For example: install_sources: | - ppa:project1/ppa - ppa:project2/ppa