exometer icon indicating copy to clipboard operation
exometer copied to clipboard

User error: snmpa_trap: Invalid value: wrongType

Open ates opened this issue 10 years ago • 6 comments

How to reproduce:

1> application:ensure_all_started(snmp).
{ok,[snmp]}
2> application:ensure_all_started(exometer).
{ok,[syntax_tools,compiler,goldrush,lager,exometer]}
3> exometer:new([foo, bar], histogram, [{snmp, [{min, 1000}, {mean, 1000}]}]).
ok

Got in shell:

18:17:16.226 [error] ** User error: snmpa_trap: Invalid value: wrongType
   Oid:  [1,3,6,1,4,1,40076,1,3,0]
   Val:  {value,0}
   Type: {asn1_type,'OCTET STRING',0,64,[],true,'OCTET STRING',false,undefined}

Exometer configuration:

{exometer, [
        {report, [
            {reporters, [
                {exometer_report_snmp, [
                    {mib_template, "priv/mibs/APP-METRICS-MIB.mib"},
                    {mib_dir, "tmp/exometer"}
                ]}
            ]}
        ]}
    ]}

ates avatar Mar 25 '14 16:03 ates

Can you share the template file as well?

tolbrino avatar Mar 26 '14 13:03 tolbrino

APP-METRICS-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, Counter32, Counter64, Gauge32, enterprises FROM SNMPv2-SMI
    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP FROM SNMPv2-CONF;

sifox MODULE-IDENTITY
    LAST-UPDATED "201401190525Z"
    ORGANIZATION "Company"
    CONTACT-INFO "[email protected]"
    DESCRIPTION
        "This MIB module is used for exposing app metrics."
    REVISION  "201401190525Z"
    DESCRIPTION
        "The initial version"
    ::= { enterprises 40076 }

exometerMetrics OBJECT IDENTIFIER ::= { sifox 1 }

-- CONTENT START

-- CONTENT END

END

ates avatar Mar 26 '14 13:03 ates

Any news?

ates avatar Mar 28 '14 10:03 ates

ping

ates avatar May 26 '14 10:05 ates

I faced with the same issue. Looks like that root of issue here in next: "mean" datapoint in generated mib configured as OCTET STRING (i guess it's because lack of support of floating point values in snmp), but internal exometer representation is integer or float. So it require some additional converting and has special processing case when it returning with snmp get command response https://github.com/Feuerlabs/exometer/blob/master/src/exometer_report_snmp.erl#L524 But this special handling ommited when value pushed to snmp agent as result of calling exometer_report_snmp:exometer_report/5 function.

IgorKarymov avatar Aug 08 '14 14:08 IgorKarymov

You are correct. I'll add the proper data conversion to the outbound calls as well.

tolbrino avatar Aug 15 '14 09:08 tolbrino