diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3268211 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.*.sw? diff --git a/configurator/couchdb.sh b/configurator/couchdb.sh new file mode 100644 index 0000000..b8200b9 --- /dev/null +++ b/configurator/couchdb.sh @@ -0,0 +1,220 @@ +#!/bin/bash + +# Copyright (C) 2016 wikiwi.io +# +# This software may be modified and distributed under the terms +# of the MIT license. See the LICENSE file for details. + +if [ -n "${COUCHDB_STATUS_URL}" ]; then +echo Configuring couchdb... +cat < /opt/stackdriver/collectd/etc/collectd.d/couchdb.conf +# This is the monitoring configuration for CouchDB. +# +# Adapted from +# https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/couchdb.conf +# for use in a CouchDB 2.x cluster. +LoadPlugin curl_json + + # For example: + # + + Instance "couchdb" + + + Type "counter" + Instance "auth_cache_hits" + + + Type "counter" + Instance "auth_cache_misses" + + + Type "counter" + Instance "database_reads" + + + Type "counter" + Instance "database_writes" + + + Type "counter" + Instance "httpd/bulk_requests" + + + Type "counter" + Instance "httpd/clients_requesting_changes" + + + Type "counter" + Instance "httpd_request_methods/COPY" + + + Type "counter" + Instance "httpd_request_methods/DELETE" + + + Type "counter" + Instance "httpd_request_methods/GET" + + + Type "counter" + Instance "httpd_request_methods/HEAD" + + + Type "counter" + Instance "httpd_request_methods/OPTIONS" + + + Type "counter" + Instance "httpd_request_methods/POST" + + + Type "counter" + Instance "httpd_request_methods/PUT" + + + Type "counter" + Instance "httpd/requests" + + + Type "counter" + Instance "httpd_status_codes/200" + + + Type "counter" + Instance "httpd_status_codes/201" + + + Type "counter" + Instance "httpd_status_codes/202" + + + Type "counter" + Instance "httpd_status_codes/301" + + + Type "counter" + Instance "httpd_status_codes/304" + + + Type "counter" + Instance "httpd_status_codes/400" + + + Type "counter" + Instance "httpd_status_codes/401" + + + Type "counter" + Instance "httpd_status_codes/403" + + + Type "counter" + Instance "httpd_status_codes/404" + + + Type "counter" + Instance "httpd_status_codes/405" + + + Type "counter" + Instance "httpd_status_codes/409" + + + Type "counter" + Instance "httpd_status_codes/412" + + + Type "counter" + Instance "httpd_status_codes/500" + + + Type "counter" + Instance "httpd/temporary_view_reads" + + + Type "counter" + Instance "httpd/view_reads" + + + Type "gauge" + Instance "open_databases" + + + Type "gauge" + Instance "open_os_files" + + # couchdb/request_time is a histogram. The values I'd most like + # to export as metrics -- + # couchdb/request_time/value/percentile[{50,75,90,95,99,999}] -- + # are not available. Hence, we will not export anything from + # couchdb/request_time. + + + Type "counter" + Instance "replicator/checkpoints/failure" + + + Type "counter" + Instance "replicator/checkpoints/success" + + + Type "gauge" + Instance "replicator/cluster_is_stable" + + + Type "counter" + Instance "replicator/requests" + + + Type "counter" + Instance "replicator/responses/failure" + + + Type "counter" + Instance "replicator/responses/success" + + + + +LoadPlugin match_regex +LoadPlugin target_set +LoadPlugin target_replace + + + + Plugin "^curl_json$" + PluginInstance "^couchdb.*$" + + + PluginInstance "^couchdb" "" + + + Plugin "couchdb" + MetaData "stackdriver_metric_type" "custom.googleapis.com/couchdb/%{type_instance}" + MetaData "label:service_name" "couchdb" + + + + + PluginInstance "^$" + + + PluginInstance "localhost" + + + + Target "return" + + + + + + + Chain "curl_json_couchdb" + + + +PreCacheChain "PreCache" +EOL +fi