[collectd] [PATCH] couchdb plugin
Doug MacEachern
Doug.MacEachern at hyperic.com
Wed May 6 18:26:55 CEST 2009
Hi Florian,
On May 6, 2009, at 8:12 AM, Florian Forster wrote:
> Hi Doug,
>
> On Wed, May 06, 2009 at 10:07:34AM -0400, Doug MacEachern wrote:
>> Doh! Patch attached this time.
>
> looks great :) What do you use for `type-instance', especially if the
> key contains wildcard characters? I'm primarily asking because the
> path
> contains slashes which is one of two illegal characters in the type
> instance field (the other one being the NULL byte ;). Maybe it'd be
> good
> to add that to the manpage.
The default type-instance is two deepest keys:
if (key->instance == NULL)
ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%s-%s",
db->state[db->depth-1].name, db->state[db->depth].name);
'*' is not actually used in the type-instance name, it is replaced
with the key at that level.
From what I've seen so far, it is safe to assume the keys will be at
least 2 deep, but I can add some sanity checking there.
Here's how it looks annotated with the config:
./src/collectd -C ~/test/couchdb.conf -T
Instance "httpd"
<Key "httpd_status_codes/*/count">
Type "http_response_codes"
</Key>
PUTVAL mako/couchdb-httpd/http_response_codes-200-count interval=10
1241626483:175734
PUTVAL mako/couchdb-httpd/http_response_codes-201-count interval=10
1241626483:175701
PUTVAL mako/couchdb-httpd/http_response_codes-202-count interval=10
1241626483:57650
PUTVAL mako/couchdb-httpd/http_response_codes-301-count interval=10
1241626483:83190
PUTVAL mako/couchdb-httpd/http_response_codes-304-count interval=10
1241626483:175701
PUTVAL mako/couchdb-httpd/http_response_codes-400-count interval=10
1241626483:57655
PUTVAL mako/couchdb-httpd/http_response_codes-401-count interval=10
1241626483:57467
PUTVAL mako/couchdb-httpd/http_response_codes-403-count interval=10
1241626483:57467
PUTVAL mako/couchdb-httpd/http_response_codes-404-count interval=10
1241626483:175701
PUTVAL mako/couchdb-httpd/http_response_codes-405-count interval=10
1241626483:83201
PUTVAL mako/couchdb-httpd/http_response_codes-409-count interval=10
1241626483:83202
PUTVAL mako/couchdb-httpd/http_response_codes-412-count interval=10
1241626483:175701
PUTVAL mako/couchdb-httpd/http_response_codes-417-count interval=10
1241626483:57467
PUTVAL mako/couchdb-httpd/http_response_codes-500-count interval=10
1241626483:57652
<Key "httpd_request_methods/*/count">
Type "http_request_methods"
</Key>
PUTVAL mako/couchdb-httpd/http_request_methods-COPY-count interval=10
1241626483:83202
PUTVAL mako/couchdb-httpd/http_request_methods-DELETE-count
interval=10 1241626483:175701
PUTVAL mako/couchdb-httpd/http_request_methods-GET-count interval=10
1241626483:175734
PUTVAL mako/couchdb-httpd/http_request_methods-HEAD-count interval=10
1241626483:57473
PUTVAL mako/couchdb-httpd/http_request_methods-POST-count interval=10
1241626483:175701
PUTVAL mako/couchdb-httpd/http_request_methods-PUT-count interval=10
1241626483:175701
<Key "httpd/requests/count">
Type "http_requests"
</Key>
PUTVAL mako/couchdb-httpd/http_requests-requests-count interval=10
1241626483:175734
<Key "couchdb/request_time/mean">
Type "gauge"
Instance "request_time_mean"
</Key>
PUTVAL mako/couchdb-httpd/gauge-request_time_mean interval=10
1241626483:1.959542
Instance "dbs"
<Key "*/doc_count">
Type "gauge"
</Key>
<Key "*/doc_del_count">
Type "counter"
</Key>
<Key "*/disk_size">
Type "bytes"
</Key>
PUTVAL mako/couchdb-dbs/gauge-chef-doc_count interval=10
1241626483:2.000000
PUTVAL mako/couchdb-dbs/counter-chef-doc_del_count interval=10
1241626483:1
PUTVAL mako/couchdb-dbs/bytes-chef-disk_size interval=10
1241626483:15423.000000
PUTVAL mako/couchdb-dbs/gauge-test_suite_db-doc_count interval=10
1241626484:6.000000
PUTVAL mako/couchdb-dbs/counter-test_suite_db-doc_del_count
interval=10 1241626484:1
PUTVAL mako/couchdb-dbs/bytes-test_suite_db-disk_size interval=10
1241626484:17508.000000
PUTVAL mako/couchdb-dbs/gauge-test_suite_db_a-doc_count interval=10
1241626484:2.000000
PUTVAL mako/couchdb-dbs/counter-test_suite_db_a-doc_del_count
interval=10 1241626484:0
PUTVAL mako/couchdb-dbs/bytes-test_suite_db_a-disk_size interval=10
1241626484:14943.000000
PUTVAL mako/couchdb-dbs/gauge-test_suite_db_b-doc_count interval=10
1241626484:2.000000
PUTVAL mako/couchdb-dbs/counter-test_suite_db_b-doc_del_count
interval=10 1241626484:0
PUTVAL mako/couchdb-dbs/bytes-test_suite_db_b-disk_size interval=10
1241626484:16090.000000
You can also configure the specific values you want rather than use
the wildcard, for example:
<Key "httpd_status_codes/200/count">
Type "http_response_codes"
Instance "OKs"
</Key>
<Key "httpd_request_methods/GET/count">
Type "http_request_methods"
Instance "GETs"
</Key>
<Key "test_suite_db/doc_count">
Type "gauge"
</Key>
> I'll take a short look at the code tomorrow and apply the patch to
> the master branch.
Great, thanks! I probably won't be able to spend time on it again
till next week or so, but I'll follow up with the sanity check/doc
changes at least soon.
Best,
-Doug
> Regards,
> -octo
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x91523C3D
> http://verplant.org/
More information about the collectd
mailing list