Opened 11 months ago
Closed 6 months ago
#544 closed defect (fixed)
LUA script return wrong code & message, but right perfdata
| Reported by: | dmatyas | Owned by: | mickem |
|---|---|---|---|
| Priority: | 1 | Milestone: | 0.4.1 |
| Component: | LUA | Version: | 0.4.0 |
| Severity: | Bugs | Keywords: | |
| Cc: |
Description
Simple LUA script:
function foo (command, args)
key='CheckCounter'
args1='Counter\:=\\MSExchangeIS Mailbox(First Storage Group-Forth (PAT4))\\Client Logons'
args2='MinCrit=0'
args3='MinWarn=10'
code, msg, perf = nscp.execute(key,args1,args2,args3)
return code, msg, perf
end
nscp.register('lua_test1', 'foo')
This script return right perfdata, but wrong code & msg:
d:..\..\..\trunk\service\NSClient++.cpp:923: Injecting: lua_test1... d:d:\source\nscp\trunk\modules\luascript\script_wrapper.hpp:37: get: d:..\..\..\trunk\service\NSClient++.cpp:923: Injecting: checkcounter... e:..\..\..\..\trunk\modules\CheckSystem\PDHCollector.cpp:297: COunter not found: 0 d:..\..\..\trunk\service\NSClient++.cpp:947: Result checkcounter: WARNING d:..\..\..\trunk\service\NSClient++.cpp:947: Result lua_test1: WARNING ------------------------------------------------ skiped ------------------------------------------------ d:..\..\..\..\trunk\modules\NSCAClient\NSCAClient.cpp:393: Sending (data): host: pat4, service: nsca_testzzzz, code: 3, time: 1342003107, result: ERROR: Failed to get counter value: 0|'\MSExchangeIS Mailbox(First Storage Group-Forth (PAT4))\Client Logons'=162;10;0
Whats wrong?
Change History (3)
comment:1 Changed 11 months ago by mickem
comment:2 Changed 11 months ago by mickem
- Milestone set to 0.4.0
comment:3 Changed 6 months ago by mickem
- Milestone changed from 0.4.0 to 0.4.1
- Resolution set to fixed
- Status changed from new to closed
new subsystem for lua in 0.4.1 which atleast works for me.
reopen if issue still persists...
Note: See
TracTickets for help on using
tickets.









Now I am no expert in Lua but as I spent last few evenings writing lua scripts I can say I noticed that local prefixed variables sometimes makes a world of difference.
So might wanna try to do:
What I noticed what that if I did not use local variables they were "reused" and sometimes had the wrong data...
I am also about to release an updated 0.4.1 which has a new 350+ lines of Lua script for doing NRPE unit tests so might wanna give that a peek (it will be in next build of 0.4.1 as well as next commit)...
Michael Medin