Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
belavina opened this issue Jul 30, 2019 · 0 comments
Open

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

belavina opened this issue Jul 30, 2019 · 0 comments

Comments

@belavina
Copy link
Contributor

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants