}
}
- /* Check if an error occurred */
- if ((vl->val.string == NULL) || (endptr == (char *) vl->val.string))
+ if (status != 0)
{
- if (type == DS_TYPE_COUNTER)
- ret.counter = 0;
- else if (type == DS_TYPE_GAUGE)
- ret.gauge = NAN;
+ switch (type)
+ {
+ case DS_TYPE_COUNTER:
+ case DS_TYPE_DERIVE:
+ case DS_TYPE_ABSOLUTE:
+ memset (&ret, 0, sizeof (ret));
+ break;
+
+ case DS_TYPE_GAUGE:
+ ret.gauge = NAN;
+ break;
+
+ default:
+ ERROR ("snmp plugin: csnmp_value_list_to_value: Unknown "
+ "data source type: %i.", type);
+ ret.gauge = NAN;
+ }
}
- }
+ } /* if (vl->type == ASN_OCTET_STR) */
else if (type == DS_TYPE_COUNTER)
- ret.counter = temp;
+ {
+ ret.counter = tmp_unsigned;
+ }
else if (type == DS_TYPE_GAUGE)
{
ret.gauge = NAN;
if (defined != 0)
- ret.gauge = (scale * temp) + shift;
+ ret.gauge = (scale * tmp_signed) + shift;
}
+ else if (type == DS_TYPE_DERIVE)
+ ret.derive = (derive_t) temp;
+ else if (type == DS_TYPE_ABSOLUTE)
+ ret.absolute = (absolute_t) temp;
+ else
+ {
+ ERROR ("snmp plugin: csnmp_value_list_to_value: Unknown data source "
+ "type: %i.", type);
+ ret.gauge = NAN;
+ }
return (ret);
} /* value_t csnmp_value_list_to_value */