From: Florian Forster Date: Sun, 13 Sep 2009 10:24:20 +0000 (+0200) Subject: Merge branch 'collectd-4.6' into collectd-4.7 X-Git-Tag: collectd-4.7.3~1 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=3ddd3791fefa478d770aba82303ec6a1913874fc;hp=658c85755ef1f4284228d1e5edbc4452a31bd944;p=collectd.git Merge branch 'collectd-4.6' into collectd-4.7 Conflicts: ChangeLog version-gen.sh --- diff --git a/ChangeLog b/ChangeLog index 1d6decbe..969c9e94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,27 @@ * uptime plugin: The new uptime plugin can collect the server's uptime. Thanks to Marco Chiappero for the patch. +2009-09-10, Version 4.6.5 + * collectd: Remove old values when a cache entry is marked as missing. + This way the “GETVAL” command of the UnixSock plugin doesn't return + old, no longer valid values when this happens. Thanks to Andrés J. + Díaz for the patch. + * apache, ascent, bind, curl, nginx plugins: Advise the cURL library + to follow redirects. Thanks to Joey Hess for reporting this bug. + * df plugin: Check the ignorelist before stating the file system, + possibly reducing the number of stats considerably. Thanks to Joey + Hess for reporting this bug. + * iptables plugin: Support for the new libiptc API has been added. + Thanks to Sebastian Harl for the patch. The build system has been + updated to the plugin only includes the shipped header files when it + is linked with the shipped library, too. + * libvirt plugin: Re-connect to libvirtd if connecting fails. Thanks + to Alan Pevec for the patch. + * powerdns plugin: Set a timeout when reading data from the datagram + socket. Handling of the “LocalSocket” option has been fixed. An + incorrectly used “type” has been corrected. Thanks to Luke Heberling + for his patches. + 2009-07-18, Version 4.6.4 * collectd: Okay-notifications have been fixed. Thanks to Andrés J. Díaz for fixing this bug. @@ -1152,15 +1173,15 @@ 2005-07-08, Version 1.3: CPU stats * Collecting CPU statistics now -2004-07-12, Version 1.2: Using syslog +2005-07-12, Version 1.2: Using syslog * collectd is now using the syslog facility to report errors, warnings and the like.. * The default directory is now /var/db/collectd -2004-07-10, Version 1.1: Minor changes +2005-07-10, Version 1.1: Minor changes * Nothing really useful to say ;) -2004-07-09, Version 1.0: Initial Version +2005-07-09, Version 1.0: Initial Version * The following modules are provided: * Load average * Ping time diff --git a/contrib/collectd_unix_sock.rb b/contrib/collectd_unix_sock.rb new file mode 100644 index 00000000..f4733617 --- /dev/null +++ b/contrib/collectd_unix_sock.rb @@ -0,0 +1,135 @@ +# Ruby class to access collectd daemon through the UNIX socket +# plugin. +# +# Requires collectd to be configured with the unixsock plugin, like so: +# +# LoadPlugin unixsock +# +# SocketFile "/var/run/collectd-unixsock" +# SocketPerms "0775" +# +# +# Copyright (C) 2009 Novell Inc. +# Author: Duncan Mac-Vicar P. +# +# Inspired in python version: +# Copyright (C) 2008 Clay Loveless +# +# This software is provided 'as-is', without any express or implied +# warranty. In no event will the author be held liable for any damages +# arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not +# claim that you wrote the original software. If you use this software +# in a product, an acknowledgment in the product documentation would be +# appreciated but is not required. +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# 3. This notice may not be removed or altered from any source distribution. +# +require 'socket' + +# Access to collectd data using the unix socket +# interface +# +# see http://collectd.org/wiki/index.php/Plugin:UnixSock +# +class CollectdUnixSock + include Socket::Constants + + # initializes the collectd interface + # path is the location of the collectd + # unix socket + # + # collectd = CollectdUnixSock.new + # + def initialize(path='/var/run/collectd-unixsock') + @socket = UNIXSocket.open(path) + # @socket = Socket.new(AF_UNIX, SOCK_STREAM, 0) + # @socket.connect(path) + @path = path + end + + # iterates over available values, passing the + # identifier to the block and the time + # the data for this identifier was last + # updated + # + # collectd.each_value do |time, identifier| + # ... + # end + def each_value + n_lines = cmd("LISTVAL") + n_lines.times do + line = @socket.readline + time_s, identifier = line.split(' ', 2) + time = Time.at(time_s.to_i) + yield time, identifier + end + end + + # iterates over each value current data + # + # collectd.each_value_data('myhost/swap/swap-free') { |col, val| } + # + # each iteration gives the column name and the value for it. + # + # You can also disable flushing by specifying it as an option: + # + # client.each_value_data('tarro/swap/swap-free', + # :flush => false ) do |col, val| + # # .. do something with col and val + # end + # + # :flush option is by default true + # + def each_value_data(identifier, opts={}) + n_lines = cmd("GETVAL \"#{identifier}\"") + n_lines.times do + line = @socket.readline + col, val = line.split('=', 2) + yield col, val + end + + # unless the user explicitly disabled + # flush... + unless opts[:flush] == false + cmd("FLUSH identifier=\"#{identifier}\"") + end + + end + + private + + # internal command execution + def cmd(c) + @socket.write("#{c}\n") + line = @socket.readline + status_string, message = line.split(' ', 2) + status = status_string.to_i + raise message if status < 0 + status + end + +end + +if __FILE__ == $0 + + client = CollectdUnixSock.new + client.each_value do |time, id| + puts "#{time.to_i} - #{id}" + end + + client.each_value_data("tarro/cpu-0/cpu-user") do |col, val| + puts "#{col} -> #{val}" + end + + client.each_value_data("tarro/interface/if_packets-eth0") do |col, val| + puts "#{col} -> #{val}" + end + +end diff --git a/contrib/collection3/etc/collection.conf b/contrib/collection3/etc/collection.conf index 2360f3c4..1bef175d 100644 --- a/contrib/collection3/etc/collection.conf +++ b/contrib/collection3/etc/collection.conf @@ -47,6 +47,13 @@ GraphWidth 400 Color starting ff00ff Color waiting ffb000 + + DataSources value + DSName value Percent + RRDTitle "Cache hit ratio for {plugin_instance} {type_instance}" + RRDVerticalLabel "Percent" + RRDFormat "%5.1lf %%" + Module GenericStacked DataSources value @@ -83,6 +90,35 @@ GraphWidth 400 Module Df DataSources free used + + Module GenericStacked + DataSources value + RRDTitle "disk usage on {plugin_instance}" + RRDVerticalLabel "Byte" + RRDFormat "%6.2lf%s" + DSName "snap_used used for snapshots" + DSName "snap_reserved snapshot reserve " + DSName "used in use " + DSName "free free " + DSName "sis_saved sis_saved " + Order free snap_used snap_reserved sis_saved used + Color snap_reverse ff8000 + Color used ff0000 + Color snap_used 000080 + Color snap_reserved ff8000 + Color free 00ff00 + Color sis_saved 00e0e0 + + + Module GenericIO + DataSources read write + DSName "read Read " + DSName write Write + RRDTitle "Disk Latency for {plugin_instance}" + RRDVerticalLabel "microseconds" + Scale 0.000001 + RRDFormat "%5.1lf %ss" + Module GenericIO DataSources read write @@ -103,6 +139,26 @@ GraphWidth 400 # RRDOptions ... RRDFormat "%5.1lf" + + Module GenericStacked + DataSources value + RRDTitle "Netapp disc ops on {plugin_instance}" + RRDVerticalLabel "Ops" + RRDFormat "%6.2lf" + DSName fcp_ops FCP-Ops + DSName nfs_ops NFS-Ops + DSName http_ops HTTP-Ops + DSName cifs_ops CIFS-Ops + DSName dafs_ops DAFS-Ops + DSName iscsi_ops iSCSI-Ops + Order fcp_ops nfs_ops http_ops cifs_ops dafs_ops iscsi_ops + Color fcp_ops 000080 + Color nfs_ops ff0000 + Color http_ops ffb000 + Color cifs_ops 00e0a0 + Color dafs_ops 00e000 + Color iscsi_ops 00e0ff + Module GenericIO DataSources read write diff --git a/src/powerdns.c b/src/powerdns.c index ef9669ac..37fceed7 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -164,13 +164,13 @@ statname_lookup_t lookup_table[] = /* {{{ */ {"latency", "latency", NULL}, /* Other stuff.. */ - {"corrupt-packets", "io_packets", "corrupt"}, + {"corrupt-packets", "ipt_packets", "corrupt"}, {"deferred-cache-inserts", "counter", "cache-deferred_insert"}, {"deferred-cache-lookup", "counter", "cache-deferred_lookup"}, {"qsize-a", "cache_size", "answers"}, {"qsize-q", "cache_size", "questions"}, - {"servfail-packets", "io_packets", "servfail"}, - {"timedout-packets", "io_packets", "timeout"}, + {"servfail-packets", "ipt_packets", "servfail"}, + {"timedout-packets", "ipt_packets", "timeout"}, {"udp4-answers", "dns_answer", "udp4"}, {"udp4-queries", "dns_question", "queries-udp4"}, {"udp6-answers", "dns_answer", "udp6"},