- yyyy-mm-dd, Version 4.1.2
+yyyy-mm-dd, Version 4.2.0
+ * collectd: The new config option `Include' lets you include other
+ configfiles and thus split up your config into smaller parts. This
+ may be especially interresting for the snmp plugin to keep the data
+ definitions seperate from the host definitions.
+ * snmp plugin: Added the options `Scale' and `Shift' to Data-blocks to
+ correct the values returned by SNMP-agents.
+
+ 2007-09-28, Version 4.1.2
* apcups plugin: Fix reporting of the `load percent' data.
+ * wireless plugin: Correct the handling of cards returning signal and
+ noise quality as percentage.
+ * perl plugin: Fix a possible buffer overflow in get_module_name().
+ * build system: Further improve the detection of libraries.
* netlink plugin: Build issues under some older versions of the Linux
includes (i. e. Debian Sarge) have been fixed.
+ * snmp plugin: Fix a potential segfault when a host times out. Add
+ support for the `timeticks' type.
2007-09-12, Version 4.1.1
* Build system: The detection of `libnetlink' has been improved.
* xmms plugin: The new `xmms' plugin graphs the bitrate and frequency
of music played with xmms.
- yyyy-mm-dd, Version 4.0.9
+ 2007-09-28, Version 4.0.9
* apcups plugin: Fix reporting of the `load percent' data.
+ * wireless plugin: Correct the handling of cards returning signal and
+ noise quality as percentage.
+ * perl plugin: Fix a possible buffer overflow in get_module_name().
2007-09-12, Version 4.0.8
* collectd: The `sstrerror' function was improved to work correctly
from collectd, parses them and exits according to Nagios-standards.
* manpages: The manpages have been improved a lot.
+ 2007-09-28, Version 3.11.7
+ * wireless plugin: Correct the handling of cards returning signal and
+ noise quality as percentage.
+
2007-08-31, Version 3.11.6
* processes plugin: Fix a potential segmentation fault.
instance_t instance;
oid_t *values;
int values_len;
+ double scale;
+ double shift;
struct data_definition_s *next;
};
typedef struct data_definition_s data_definition_t;
return (0);
} /* int csnmp_config_add_data_instance */
+static int csnmp_config_add_data_shift (data_definition_t *dd, oconfig_item_t *ci)
+{
+ if ((ci->values_num != 1)
+ || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
+ {
+ WARNING ("snmp plugin: The `Scale' config option needs exactly one number argument.");
+ return (-1);
+ }
+
+ dd->shift = ci->values[0].value.number;
+
+ return (0);
+} /* int csnmp_config_add_data_shift */
+
+static int csnmp_config_add_data_scale (data_definition_t *dd, oconfig_item_t *ci)
+{
+ if ((ci->values_num != 1)
+ || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
+ {
+ WARNING ("snmp plugin: The `Scale' config option needs exactly one number argument.");
+ return (-1);
+ }
+
+ dd->scale = ci->values[0].value.number;
+
+ return (0);
+} /* int csnmp_config_add_data_scale */
+
static int csnmp_config_add_data (oconfig_item_t *ci)
{
data_definition_t *dd;
free (dd);
return (-1);
}
+ dd->scale = 1.0;
+ dd->shift = 0.0;
for (i = 0; i < ci->children_num; i++)
{
status = csnmp_config_add_data_instance (dd, option);
else if (strcasecmp ("Values", option->key) == 0)
status = csnmp_config_add_data_values (dd, option);
+ else if (strcasecmp ("Shift", option->key) == 0)
+ status = csnmp_config_add_data_shift (dd, option);
+ else if (strcasecmp ("Scale", option->key) == 0)
+ status = csnmp_config_add_data_scale (dd, option);
else
{
WARNING ("snmp plugin: Option `%s' not allowed here.", option->key);
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_close failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_close failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
sfree (errstr);
}
snmp_error (&sess, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_open failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_open failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
sfree (errstr);
}
} /* void csnmp_host_open_session */
-static value_t csnmp_value_list_to_value (struct variable_list *vl, int type)
+static value_t csnmp_value_list_to_value (struct variable_list *vl, int type,
+ double scale, double shift)
{
value_t ret;
uint64_t temp = 0;
if ((vl->type == ASN_INTEGER)
|| (vl->type == ASN_UINTEGER)
|| (vl->type == ASN_COUNTER)
+ #ifdef ASN_TIMETICKS
+ || (vl->type == ASN_TIMETICKS)
+ #endif
|| (vl->type == ASN_GAUGE))
{
temp = (uint32_t) *vl->val.integer;
{
ret.gauge = NAN;
if (defined != 0)
- ret.gauge = temp;
+ ret.gauge = (scale * temp) + shift;
}
return (ret);
DEBUG ("snmp plugin: csnmp_read_table (host = %s, data = %s)",
host->name, data->name);
+ if (host->sess_handle == NULL)
+ {
+ DEBUG ("snmp plugin: csnmp_read_table: host->sess_handle == NULL");
+ return (-1);
+ }
+
ds = plugin_get_ds (data->type);
if (!ds)
{
char *errstr = NULL;
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_synch_response failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
csnmp_host_close_session (host);
status = -1;
}
else
{
- value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER);
+ value_t val = csnmp_value_list_to_value (vb, DS_TYPE_COUNTER, 1.0, 0.0);
snprintf (il->instance, sizeof (il->instance),
"%llu", val.counter);
}
if (vt != NULL)
{
vt->subid = vb->name[vb->name_length - 1];
- vt->value = csnmp_value_list_to_value (vb, ds->ds[i].type);
+ vt->value = csnmp_value_list_to_value (vb, ds->ds[i].type,
+ data->scale, data->shift);
vt->next = NULL;
if (value_table_ptr[i] == NULL)
DEBUG ("snmp plugin: csnmp_read_value (host = %s, data = %s)",
host->name, data->name);
+ if (host->sess_handle == NULL)
+ {
+ DEBUG ("snmp plugin: csnmp_read_table: host->sess_handle == NULL");
+ return (-1);
+ }
+
ds = plugin_get_ds (data->type);
if (!ds)
{
char *errstr = NULL;
snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
- ERROR ("snmp plugin: snmp_sess_synch_response failed: %s",
- (errstr == NULL) ? "Unknown problem" : errstr);
+ ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
+ host->name, (errstr == NULL) ? "Unknown problem" : errstr);
csnmp_host_close_session (host);
sfree (errstr);
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);
int i;
if (host_head == NULL)
+ {
+ NOTICE ("snmp plugin: No host has been defined.");
return (-1);
+ }
call_snmp_init_once ();
threads = (pthread_t *) malloc (threads_num * sizeof (pthread_t));
if (threads == NULL)
+ {
+ ERROR ("snmp plugin: malloc failed.");
return (-1);
+ }
memset (threads, '\0', threads_num * sizeof (pthread_t));
for (i = 0; i < threads_num; i++)