Last active
September 28, 2015 00:08
-
-
Save TimidRobot/1353415 to your computer and use it in GitHub Desktop.
Graphite Carbon-Aggregator Re-Write Rules to clean up Collectd data via collectd-carbon.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file defines regular expression patterns that can be used to | |
# rewrite metric names in a search & replace fashion. It consists of two | |
# sections, [pre] and [post]. The rules in the pre section are applied to | |
# metric names as soon as they are received. The post rules are applied | |
# after aggregation has taken place. | |
# | |
# The general form of each rule is as follows: | |
# | |
# regex-pattern = replacement-text | |
# | |
# For example: | |
# | |
# [post] | |
# _sum$ = | |
# _avg$ = | |
# | |
# These rules would strip off a suffix of _sum or _avg from any metric names | |
# after aggregation. | |
[pre] | |
#### Hostname Cleanup | |
_cw\. = . | |
_pozitronic_com\. = . | |
#### Collectd Cleanup | |
# apache | |
\.apache\.mod_status\.apache_scoreboard\. = .apache.scoreboard. | |
\.apache\.mod_status\. = .apache. | |
# cpu | |
\.cpu\.idle\.value$ = .idle | |
\.cpu\.interrupt\.value$ = .interrupt | |
\.cpu\.nice\.value$ = .nice | |
\.cpu\.softirq\.value$ = .softirq | |
\.cpu\.steal\.value$ = .steal | |
\.cpu\.system\.value$ = .system | |
\.cpu\.user\.value$ = .user | |
\.cpu\.wait\.value$ = .wait | |
# df | |
\.df_complex = | |
# disk | |
\.disk_merged = .merged | |
\.disk_octets = .octets | |
\.disk_ops = .ops | |
\.disk_time = .time | |
# entropy | |
entropy\.entropy\.value$ = entropy | |
# interface | |
\.if_errors\. = .errors. | |
\.if_octets\. = .octets. | |
\.if_packets\. = .packets. | |
# load | |
\.load\.load\. = .load. | |
# memcached | |
\.memcached\.memcached_connections\.current\.value$ = .memcached.connections | |
\.memcached\.df\.cache\.free$ = .memcached.cache.free | |
\.memcached\.df\.cache\.used$ = .memcached.cache.used | |
\.memcached\.memcached_items\.current\.value$ = .memcached.items | |
\.memcached\.memcached_ = .memcached. | |
\.memcached\.percent\.hitratio\.value$ = .memcached.hitratio | |
# memory | |
\.memory\.memory\. = .memory. | |
# mysql | |
\.cache_result\.qcache- = .cache_result. | |
\.cache_size\.qcache.value$ = .cache_size | |
# nfs | |
^.*\.nfs\.v2.*$ = trash | |
\.nfs\.v3client\.nfs_procedure\. = .nfs.client. | |
\.nfs\.v3server\.nfs_procedure\. = .nfs.server. | |
# ping | |
\.ping\.ping_ = .ping. | |
\.ping\.([a-z_]+)\.([0-9-]+).value = .ping.\2.\1 | |
# postfix | |
\.postfix\.gauge\.queue_length- = .postfix.queue_length. | |
# swap | |
\.swap\.swap\. = .swap. | |
\.swap_io = .io | |
# tail: apache access all | |
\.tail\.access_log_all\.counter\.status_ = .tail.access_log_all.status. | |
\.tail\.access_log_all\.response_time.first_byte_ = .tail.access_log_all.first_byte. | |
\.tail\.access_log_all\.response_time.response_ = .tail.access_log_all.response. | |
# tail: varnish combined | |
\.tail\.varnish_combined\.counter\.status_ = .tail.varnish_combined.status. | |
# tail: postfix | |
\.tail\.postfix\.counter\.conn-in- = .tail.postfix.conn-in. | |
\.tail\.postfix\.counter\.conn-out- = .tail.postfix.conn-out. | |
\.tail\.postfix\.counter\.rejected- = .tail.postfix.rejected. | |
\.tail\.postfix\.counter\.status- = .tail.postfix.status. | |
\.tail\.postfix\.gauge\.delay- = .tail.postfix.delay. | |
\.tail\.postfix\.ipt_bytes. = .tail.postfix. | |
# tcpconns | |
\.tcp_connections\. = . | |
# uptime | |
uptime\.uptime\.value$ = uptime | |
# users | |
users\.users\.value$ = users | |
# varnish | |
# backend | |
\.varnish\.derive\.backend_conn\.value$ = .varnish.backend.conn | |
\.varnish\.derive\.backend_fail\.value$ = .varnish.backend.fail | |
# cache | |
\.varnish\.derive\.cache_hitpass\.value$ = .varnish.cache.hitpass | |
\.varnish\.derive\.cache_hit\.value$ = .varnish.cache.hit | |
\.varnish\.derive\.cache_miss\.value$ = .varnish.cache.miss | |
\.varnish\.derive\.n_expired\.value$ = .varnish.cache.expired | |
\.varnish\.derive\.n_lru_nuked\.value$ = .varnish.cache.lru-nuked | |
# client | |
\.varnish\.derive\.client_conn\.value$ = .varnish.client.conn | |
\.varnish\.derive\.client_req\.value$ = .varnish.client.req | |
# misc | |
\.varnish\.gauge\.n_ban\.value$ = .varnish.total_active_bans | |
\.varnish\.gauge\.n_object\.value$ = .varnish.n_struct_object | |
\.varnish\.gauge\.n_wrk\.value$ = .varnish.worker_threads | |
\.varnish\.gauge\.n_wrk_drop\.value$ = .varnish.work_dropped_requests | |
\.varnish\.gauge\.n_wrk_lqueue\.value$ = .varnish.work_request_queue_length | |
\.varnish\.gauge\.uptime\.value$ = .varnish.uptime | |
#### following should be the last rule | |
# misc | |
\.value = |
Note the use of groups in the ping pattern.
This was super helpful. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Collectd's default metric names end up being overly verbose in Graphite. These rewrite rules significantly increase the ease of using collectd gathered data.