From: Florian Forster Date: Tue, 6 Nov 2007 16:40:35 +0000 (+0000) Subject: Merge branch 'collectd-4.1' into collectd-4.2 X-Git-Tag: collectd-4.2.1~5 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=7a8e55e284c85ec5cd63ed457515769509308cc5;p=collectd.git Merge branch 'collectd-4.1' into collectd-4.2 Conflicts: contrib/README src/snmp.c src/types.db --- 7a8e55e284c85ec5cd63ed457515769509308cc5 diff --cc contrib/README index 2e9cbf54,6f0836f8..398d13ba --- a/contrib/README +++ b/contrib/README @@@ -38,11 -38,15 +38,20 @@@ should look something like this datadir: "/var/lib/collectd/rrd/" libdir: "/usr/lib/collectd/" + exec-munin.px + ------------- + Script to be used with the exec-plugin (see collectd-exec(5) for details) + which executes munin plugins, parses the output and translates it to a format + the exec-plugin understands. The features are limited - changing the munin + plugins to use the output format understood by the exec-plugin is recommended. + See the embedded POD documentation for more details: + $ perldoc contrib/exec-munin.px + +exec-smartctl +------------- + Sample script for the exec plugin. Please refer to the documentation in the +file - you will have to adapt it to your needs anyway. + extractDS.px ------------ Creates a new RRD-file with only one data-source (DS) of the source-RRD- diff --cc src/snmp.c index 8673df19,30064765..4311ff16 --- a/src/snmp.c +++ b/src/snmp.c @@@ -1131,29 -869,83 +1128,35 @@@ static int csnmp_read_table (host_defin break; } - /* Check if we left the subtree */ - if (snmp_oid_ncompare (data->instance.oid.oid, data->instance.oid.oid_len, - vb->name, vb->name_length, - data->instance.oid.oid_len) != 0) - { - if (res != NULL) - snmp_free_pdu (res); - res = NULL; - - break; - } - - /* Allocate a new `csnmp_list_instances_t', insert the instance name and - * add it to the list */ - il = (csnmp_list_instances_t *) malloc (sizeof (csnmp_list_instances_t)); - if (il == NULL) + /* Check if all values (and possibly the instance) have left their + * subtree */ + if (csnmp_check_res_left_subtree (host, data, res) != 0) + { + if (res != NULL) + snmp_free_pdu (res); + res = NULL; + - status = -1; break; + } - il->subid = vb->name[vb->name_length - 1]; - il->next = NULL; - /* Get instance name */ - if ((vb->type == ASN_OCTET_STR) || (vb->type == ASN_BIT_STR)) + /* if an instance-OID is configured.. */ + if (data->instance.oid.oid_len > 0) { - char *ptr; - size_t instance_len; - - instance_len = sizeof (il->instance) - 1; - if (instance_len > vb->val_len) - instance_len = vb->val_len; - - strncpy (il->instance, (char *) ((vb->type == ASN_OCTET_STR) - ? vb->val.string - : vb->val.bitstring), - instance_len); - il->instance[instance_len] = '\0'; - - for (ptr = il->instance; *ptr != '\0'; ptr++) + /* Allocate a new `csnmp_list_instances_t', insert the instance name and + * add it to the list */ + if (csnmp_instance_list_add (&instance_list, &instance_list_ptr, + res) != 0) { - if ((*ptr > 0) && (*ptr < 32)) - *ptr = ' '; - else if (*ptr == '/') - *ptr = '_'; + ERROR ("snmp plugin: csnmp_instance_list_add failed."); + status = -1; + break; } - DEBUG ("snmp plugin: il->instance = `%s';", il->instance); - } - else - { - value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER); - snprintf (il->instance, sizeof (il->instance), - "%llu", val.counter); - } - il->instance[sizeof (il->instance) - 1] = '\0'; - DEBUG ("snmp plugin: data = `%s'; il->instance = `%s';", - data->name, il->instance); - - if (instance_list_ptr == NULL) - instance_list = il; - else - instance_list_ptr->next = il; - instance_list_ptr = il; - - /* Copy OID to oid_list[0] */ - memcpy (oid_list[0].oid, vb->name, sizeof (oid) * vb->name_length); - oid_list[0].oid_len = vb->name_length; - - for (i = 0; i < data->values_len; i++) - { - csnmp_table_values_t *vt; - vb = vb->next_variable; + /* Set vb on the last variable */ + for (vb = res->variables; + (vb != NULL) && (vb->next_variable != NULL); + vb = vb->next_variable) + /* do nothing */; if (vb == NULL) { status = -1; @@@ -1343,11 -1124,12 +1353,13 @@@ static int csnmp_read_value (host_defin for (i = 0; i < data->values_len; i++) if (snmp_oid_compare (data->values[i].oid, data->values[i].oid_len, vb->name, vb->name_length) == 0) - vl.values[i] = csnmp_value_list_to_value (vb, ds->ds[i].type); + vl.values[i] = csnmp_value_list_to_value (vb, ds->ds[i].type, + data->scale, data->shift); } /* for (res->variables) */ - snmp_free_pdu (res); + if (res != NULL) + snmp_free_pdu (res); + res = NULL; DEBUG ("snmp plugin: -> plugin_dispatch_values (%s, &vl);", data->type); plugin_dispatch_values (data->type, &vl); diff --cc src/types.db index 560354c1,c0463c4a..bfd400c0 --- a/src/types.db +++ b/src/types.db @@@ -4,10 -4,9 +4,10 @@@ apache_requests count:COUNTER:0:134217 apache_scoreboard count:GAUGE:0:65535 bitrate value:GAUGE:0:4294967295 charge value:GAUGE:0:U +connections value:COUNTER:0:U counter value:COUNTER:U:U - cpu value:COUNTER:0:4294967295 cpufreq value:GAUGE:0:U + cpu value:COUNTER:0:4294967295 current value:GAUGE:U:U delay seconds:GAUGE:-1000000:1000000 df used:GAUGE:0:1125899906842623, free:GAUGE:0:1125899906842623 @@@ -63,19 -55,19 +63,20 @@@ ps_cputime user:COUNTER:0:16000000, sy ps_pagefaults minflt:COUNTER:0:9223372036854775807, majflt:COUNTER:0:9223372036854775807 ps_rss value:GAUGE:0:9223372036854775807 ps_state value:GAUGE:0:65535 + serial_octets rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295 + signal_noise value:GAUGE:U:0 + signal_power value:GAUGE:U:0 + signal_quality value:GAUGE:0:U spam_score value:GAUGE:U:U + swap value:GAUGE:0:1099511627776 +tcp_connections value:GAUGE:0:4294967295 temperature value:GAUGE:-273.15:U time_dispersion seconds:GAUGE:-1000000:1000000 - time_offset seconds:GAUGE:-1000000:1000000 timeleft timeleft:GAUGE:0:3600 - voltage value:GAUGE:U:U - serial_octets rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295 - swap value:GAUGE:0:1099511627776 + time_offset seconds:GAUGE:-1000000:1000000 users users:GAUGE:0:65535 - vs_threads value:GAUGE:0:65535 - vs_processes value:GAUGE:0:65535 + voltage_threshold value:GAUGE:U:U, threshold:GAUGE:U:U + voltage value:GAUGE:U:U vs_memory value:GAUGE:0:9223372036854775807 - signal_quality value:GAUGE:0:U - signal_power value:GAUGE:U:0 - signal_noise value:GAUGE:U:0 + vs_processes value:GAUGE:0:65535 + vs_threads value:GAUGE:0:65535