Skip to content

Uptime OID not working when asset has zero in its key #88

@belavina

Description

@belavina

When SNMP asset (PDU/UPS) with 0 in its key is created, snmpsimd.py reports evalsha execution error (script passed to snmpsimd.py located in enginecore/scriptsnmppub.lua);

Request var-binds: 1.3.6.1.2.1.1.2.0=<>, flags: NEXT, GET
data error at /tmp/simengine/190/public.snmprec controller for 1.3.6.1.2.1.1.2.0: Error running script (call to f_14c4ad5b88087a058dff387f56cbe4c356819080): @user_script:18: user_script:18: attempt to perform arithmetic on local 'start_time' (a boolean value) 

Most likely happening due to 0 substitution with key:gsub('0', '') in the evalsha lua script:

if oid == "1.3.6.1.2.1.1.3.0" then
local formatted_key, _ = key:gsub('0', '')
local start_time = redis.call('get', (tonumber(formatted_key)..":start_time"))
local now = redis.call('TIME')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions