Merge branch 'collectd-4.9'
authorFlorian Forster <octo@huhu.verplant.org>
Tue, 5 Jan 2010 10:48:07 +0000 (11:48 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 5 Jan 2010 10:48:07 +0000 (11:48 +0100)
src/apache.c
src/collectd-python.pod
src/collectd-snmp.pod
src/collectd.conf.in
src/routeros.c
src/rrdtool.c

index df1b560..d6712dc 100644 (file)
@@ -202,7 +202,7 @@ static int config_set_boolean (int *ret_boolean, /* {{{ */
                return (-1);
        }
 
-       if (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)
+       if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
        {
                if (ci->values[0].value.boolean)
                        *ret_boolean = 1;
index 3620aee..021a6c5 100644 (file)
@@ -96,6 +96,16 @@ exception either.
 
 To quit collectd send I<EOF> (press I<Ctrl+D> at the beginning of a new line).
 
+=item
+
+B<3.> collectd handles I<SIGCHLD>. This means that python won't be able to
+determine the return code of spawned processes with system(), popen() and
+subprocess. This will result in python not using external programs like less
+to display help texts. You can override this behavior with the B<PAGER>
+environment variable, e.g. I<export PAGER=less> before starting collectd.
+Depending on your version of python this might or might not result in an
+B<OSError> exception which can be ignored.
+
 =back
 
 =item E<lt>B<Module> I<Name>E<gt> block
index 51e0481..3c6e799 100644 (file)
@@ -175,7 +175,8 @@ traffic.
 The gauge-values returned by the SNMP-agent are multiplied by I<Value>.  This
 is useful when values are transfered as a fixed point real number. For example,
 thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
-a scale value of B<0.1> to correct this. The default value is of course B<1.0>.
+a scale value of B<0.1> to correct this. The default value is, of course,
+B<1.0>.
 
 This value is not applied to counter-values.
 
@@ -184,7 +185,7 @@ This value is not applied to counter-values.
 I<Value> is added to gauge-values returned by the SNMP-agent after they have
 been multiplied by any B<Scale> value. If, for example, a thermometer returns
 degrees Kelvin you could specify a shift of B<273.15> here to store values in
-degrees Celsius. The default value is of course B<0.0>.
+degrees Celsius. The default value is, of course, B<0.0>.
 
 This value is not applied to counter-values.
 
index c9f55cd..1204d84 100644 (file)
@@ -89,6 +89,7 @@ FQDNLookup   true
 @BUILD_PLUGIN_MEMORY_TRUE@@BUILD_PLUGIN_MEMORY_TRUE@LoadPlugin memory
 #@BUILD_PLUGIN_MULTIMETER_TRUE@LoadPlugin multimeter
 #@BUILD_PLUGIN_MYSQL_TRUE@LoadPlugin mysql
+#@BUILD_PLUGIN_NETAPP_TRUE@LoadPlugin netapp
 #@BUILD_PLUGIN_NETLINK_TRUE@LoadPlugin netlink
 @LOAD_PLUGIN_NETWORK@LoadPlugin network
 #@BUILD_PLUGIN_NFS_TRUE@LoadPlugin nfs
@@ -107,6 +108,8 @@ FQDNLookup   true
 #@BUILD_PLUGIN_POWERDNS_TRUE@LoadPlugin powerdns
 #@BUILD_PLUGIN_PROCESSES_TRUE@LoadPlugin processes
 #@BUILD_PLUGIN_PROTOCOLS_TRUE@LoadPlugin protocols
+#@BUILD_PLUGIN_PYTHON_TRUE@LoadPlugin python
+#@BUILD_PLUGIN_ROUTEROS_TRUE@LoadPlugin routeros
 #@BUILD_PLUGIN_RRDCACHED_TRUE@LoadPlugin rrdcached
 @LOAD_PLUGIN_RRDTOOL@LoadPlugin rrdtool
 #@BUILD_PLUGIN_SENSORS_TRUE@LoadPlugin sensors
@@ -414,6 +417,58 @@ FQDNLookup   true
 #      </Database>
 #</Plugin>
 
+#<Plugin netapp>
+#      <Host "netapp1.example.com">
+#              Protocol      "https"
+#              Address       "10.0.0.1"
+#              Port          443
+#              User          "username"
+#              Password      "aef4Aebe"
+#              Interval      30
+#
+#              <WAFL>
+#                      Interval 30
+#                      GetNameCache   true
+#                      GetDirCache    true
+#                      GetBufferCache true
+#                      GetInodeCache  true
+#              </WAFL>
+#
+#              <Disks>
+#                      Interval 30
+#                      GetBusy true
+#              </Disks>
+#
+#              <VolumePerf>
+#                      Interval 30
+#                      GetIO      "volume0"
+#                      IgnoreSelectedIO      false
+#                      GetOps     "volume0"
+#                      IgnoreSelectedOps     false
+#                      GetLatency "volume0"
+#                      IgnoreSelectedLatency false
+#              </VolumePerf>
+#
+#              <VolumeUsage>
+#                      Interval 30
+#                      GetCapacity "vol0"
+#                      GetCapacity "vol1"
+#                      IgnoreSelectedCapacity false
+#                      GetSnapshot "vol1"
+#                      GetSnapshot "vol3"
+#                      IgnoreSelectedSnapshot false
+#              </VolumeUsage>
+#
+#              <System>
+#                      Interval 30
+#                      GetCPULoad     true
+#                      GetInterfaces  true
+#                      GetDiskOps     true
+#                      GetDiskIO      true
+#              </System>
+#      </Host>
+#</Plugin>
+
 #<Plugin netlink>
 #      Interface "All"
 #      VerboseInterface "All"
@@ -584,6 +639,28 @@ FQDNLookup   true
 #      IgnoreSelected false
 #</Plugin>
 
+#<Plugin python>
+#      ModulePath "/path/to/your/python/modules"
+#      LogTraces true
+#      Interactive true
+#      Import "spam"
+#
+#      <Module spam>
+#              spam "wonderful" "lovely"
+#      </Module>
+#</Plugin>
+
+#<Plugin routeros>
+#      <Router>
+#              Host "router.example.com"
+#              Port "8728"
+#              User "admin"
+#              Password "dozaiTh4"
+#              CollectInterface true
+#              CollectRegistrationTable true
+#      </Router>
+#</Plugin>
+
 #<Plugin rrdcached>
 #      DaemonAddress "unix:/tmp/rrdcached.sock"
 #      DataDir "@prefix@/var/lib/@PACKAGE_NAME@/rrd"
index 02c96d7..4fe33fa 100644 (file)
@@ -39,8 +39,8 @@ struct cr_data_s
 };
 typedef struct cr_data_s cr_data_t;
 
-static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
-    counter_t rx, counter_t tx)
+static void cr_submit_io (cr_data_t *rd, const char *type, /* {{{ */
+    const char *type_instance, counter_t rx, counter_t tx)
 {
        value_t values[2];
        value_list_t vl = VALUE_LIST_INIT;
@@ -50,7 +50,7 @@ static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.host, rd->node, sizeof (vl.host));
        sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
@@ -58,37 +58,41 @@ static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
        plugin_dispatch_values (&vl);
 } /* }}} void cr_submit_io */
 
-static void submit_interface (const ros_interface_t *i) /* {{{ */
+static void submit_interface (cr_data_t *rd, /* {{{ */
+    const ros_interface_t *i)
 {
   if (i == NULL)
     return;
 
   if (!i->running)
   {
-    submit_interface (i->next);
+    submit_interface (rd, i->next);
     return;
   }
 
-  cr_submit_io ("if_packets", i->name,
+  cr_submit_io (rd, "if_packets", i->name,
       (counter_t) i->rx_packets, (counter_t) i->tx_packets);
-  cr_submit_io ("if_octets", i->name,
+  cr_submit_io (rd, "if_octets", i->name,
       (counter_t) i->rx_bytes, (counter_t) i->tx_bytes);
-  cr_submit_io ("if_errors", i->name,
+  cr_submit_io (rd, "if_errors", i->name,
       (counter_t) i->rx_errors, (counter_t) i->tx_errors);
-  cr_submit_io ("if_dropped", i->name,
+  cr_submit_io (rd, "if_dropped", i->name,
       (counter_t) i->rx_drops, (counter_t) i->tx_drops);
 
-  submit_interface (i->next);
+  submit_interface (rd, i->next);
 } /* }}} void submit_interface */
 
 static int handle_interface (__attribute__((unused)) ros_connection_t *c, /* {{{ */
-    const ros_interface_t *i, __attribute__((unused)) void *user_data)
+    const ros_interface_t *i, void *user_data)
 {
-  submit_interface (i);
+  if ((i == NULL) || (user_data == NULL))
+    return (EINVAL);
+
+  submit_interface (user_data, i);
   return (0);
 } /* }}} int handle_interface */
 
-static void cr_submit_gauge (const char *type, /* {{{ */
+static void cr_submit_gauge (cr_data_t *rd, const char *type, /* {{{ */
     const char *type_instance, gauge_t value)
 {
        value_t values[1];
@@ -98,7 +102,7 @@ static void cr_submit_gauge (const char *type, /* {{{ */
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.host, rd->node, sizeof (vl.host));
        sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
@@ -106,7 +110,8 @@ static void cr_submit_gauge (const char *type, /* {{{ */
        plugin_dispatch_values (&vl);
 } /* }}} void cr_submit_gauge */
 
-static void submit_regtable (const ros_registration_table_t *r) /* {{{ */
+static void submit_regtable (cr_data_t *rd, /* {{{ */
+    const ros_registration_table_t *r)
 {
   char type_instance[DATA_MAX_NAME_LEN];
 
@@ -116,38 +121,40 @@ static void submit_regtable (const ros_registration_table_t *r) /* {{{ */
   /*** RX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s-rx",
       r->interface, r->radio_name);
-  cr_submit_gauge ("bitrate", type_instance,
+  cr_submit_gauge (rd, "bitrate", type_instance,
       (gauge_t) (1000000.0 * r->rx_rate));
-  cr_submit_gauge ("signal_power", type_instance,
+  cr_submit_gauge (rd, "signal_power", type_instance,
       (gauge_t) r->rx_signal_strength);
-  cr_submit_gauge ("signal_quality", type_instance,
+  cr_submit_gauge (rd, "signal_quality", type_instance,
       (gauge_t) r->rx_ccq);
 
   /*** TX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s-tx",
       r->interface, r->radio_name);
-  cr_submit_gauge ("bitrate", type_instance,
+  cr_submit_gauge (rd, "bitrate", type_instance,
       (gauge_t) (1000000.0 * r->tx_rate));
-  cr_submit_gauge ("signal_power", type_instance,
+  cr_submit_gauge (rd, "signal_power", type_instance,
       (gauge_t) r->tx_signal_strength);
-  cr_submit_gauge ("signal_quality", type_instance,
+  cr_submit_gauge (rd, "signal_quality", type_instance,
       (gauge_t) r->tx_ccq);
 
   /*** RX / TX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s",
       r->interface, r->radio_name);
-  cr_submit_io ("if_octets", type_instance,
+  cr_submit_io (rd, "if_octets", type_instance,
       (counter_t) r->rx_bytes, (counter_t) r->tx_bytes);
-  cr_submit_gauge ("snr", type_instance, (gauge_t) r->signal_to_noise);
+  cr_submit_gauge (rd, "snr", type_instance, (gauge_t) r->signal_to_noise);
 
-  submit_regtable (r->next);
+  submit_regtable (rd, r->next);
 } /* }}} void submit_regtable */
 
 static int handle_regtable (__attribute__((unused)) ros_connection_t *c, /* {{{ */
-    const ros_registration_table_t *r,
-    __attribute__((unused)) void *user_data)
+    const ros_registration_table_t *r, void *user_data)
 {
-  submit_regtable (r);
+  if ((r == NULL) || (user_data == NULL))
+    return (EINVAL);
+
+  submit_regtable (user_data, r);
   return (0);
 } /* }}} int handle_regtable */
 
@@ -180,7 +187,7 @@ static int cr_read (user_data_t *user_data) /* {{{ */
   if (rd->collect_interface)
   {
     status = ros_interface (rd->connection, handle_interface,
-       /* user data = */ NULL);
+       /* user data = */ rd);
     if (status != 0)
     {
       char errbuf[128];
@@ -195,7 +202,7 @@ static int cr_read (user_data_t *user_data) /* {{{ */
   if (rd->collect_regtable)
   {
     status = ros_registration_table (rd->connection, handle_regtable,
-       /* user data = */ NULL);
+       /* user data = */ rd);
     if (status != 0)
     {
       char errbuf[128];
index ee5d70c..ed1ced1 100644 (file)
@@ -676,6 +676,7 @@ static int rrd_cache_insert (const char *filename,
                rc->values = NULL;
                rc->first_value = 0;
                rc->last_value = 0;
+               rc->random_variation = 0;
                rc->flags = FLAG_NONE;
                new_rc = 1;
        }