author | Florian Forster <octo@noris.net> | |
Tue, 6 Nov 2007 16:40:35 +0000 (16:40 +0000) | ||
committer | Florian Forster <octo@noris.net> | |
Tue, 6 Nov 2007 16:40:35 +0000 (16:40 +0000) |
Conflicts:
contrib/README
src/snmp.c
src/types.db
contrib/README
src/snmp.c
src/types.db
1 | 2 | |||
---|---|---|---|---|
contrib/README | patch | | diff1 | | diff2 | | blob | history |
src/snmp.c | patch | | diff1 | | diff2 | | blob | history |
src/types.db | patch | | diff1 | | diff2 | | blob | history |
diff --cc contrib/README
index 2e9cbf54263e9a6aa1cd840fad8ddb177e42d6eb,6f0836f82387d90613aa0b8f98a84746e5b433fe..398d13ba9bdd0dcab5020e5fb2b51f210c31d273
--- 1/contrib/README
--- 2/contrib/README
+++ b/contrib/README
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 8673df199e9ffe135993986a24f5cc1e1607b50e,300647659a7e31b6b539abfe953e56c8ccaec73c..4311ff1670b5f92a6e2927d16420e2c1c5f8a011
--- 1/src/snmp.c
--- 2/src/snmp.c
+++ b/src/snmp.c
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;
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 560354c16a50a170dbdaee4f60c45c01bff62198,c0463c4adf5b65d423c47e5f86c43863bb832770..bfd400c029256b2a13987151319c8fb6818e8e55
--- 1/src/types.db
--- 2/src/types.db
+++ b/src/types.db
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
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