{"id":472,"date":"2009-10-05T23:11:20","date_gmt":"2009-10-05T22:11:20","guid":{"rendered":"http:\/\/wp.devco.net\/?p=472"},"modified":"2009-10-09T17:54:05","modified_gmt":"2009-10-09T16:54:05","slug":"ruby_pdns_version_05","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2009\/10\/05\/ruby_pdns_version_05.php","title":{"rendered":"Ruby PDNS Version 0.5"},"content":{"rendered":"

I just released version 0.5<\/a> of Ruby PDNS<\/a>.  This mainly introduces a full statistics capability and fixes a minor bug or two.<\/p>\n

I didn’t intend on releasing another version before 1.0 but it turns out the stats feature were quite a big job worthy of a release.<\/p>\n

The stats is complicated by the fact that PDNS runs multiple instances of my code sharing the load between them, this makes keeping stats pretty hard because I have no shared memory space like you would in a multi threaded app.  So I’d somehow need to dump per process stats and calculate totals.  Everyone I asked suggested writing a log and summarizing the log data but this just never felt right to me – there would be issues with log rotation and knowing till when you last counted stats and so forth – so I kept looking for a solution.<\/p>\n

I struggled to come up with a good approach for a long time, finally settling on each process writing a YAML file with it’s stats and a cron job to aggregate it regularly.  This turned out to be quite elegant – much more so than processing logs for example – as the cron job cleans up files it already processed and also ignore too old ones etc.  If the cron job keeps running it should be zero maintenance.<\/p>\n

I added a script – pdns-get-stats.rb – to query the aggregated stats:<\/p>\n

$ pdns-get-stats.rb –usec –record puppet
usagecount:896 totaltime:165844 averagetime:185<\/p>\n

$ pdns-get-stats.rb –usec –record ruby-pdns-totals
usagecount:68705 totaltime:11056529 averagetime:160<\/p><\/blockquote>\n

The puppet record is using GeoIP so you’d expect it to be a bit slower than ones that just shuffle records and this is clear above, though I am quite pleased with the performance of the GeoIP code.  Times are in microseconds.<\/p>\n

Those who know Cacti<\/a> will recognise the format as being compatible with the Cacti plugin standard – if there is demand I can easily add Munin, Collectd etc query tools<\/p>\n

Using the details I was able to draw a quick little graph below using Cacti<\/p>\n

<\/center><\/p>\n

The release is available in RPM, tgz and gem at the project site<\/a>.<\/p>\n

The next major step is to write a API that is externally accessible, perhaps using REST over HTTP, this means you could send data from your monitoring or CMDB and adjust weights or really anything you can code using external data.<\/p>\n","protected":false},"excerpt":{"rendered":"

I just released version 0.5 of Ruby PDNS.  This mainly introduces a full statistics capability and fixes a minor bug or two. I didn’t intend on releasing another version before 1.0 but it turns out the stats feature were quite a big job worthy of a release. The stats is complicated by the fact that […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[7],"tags":[121,13,16],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/472"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":2,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/472\/revisions"}],"predecessor-version":[{"id":973,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/472\/revisions\/973"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}