Changeset 367bf20 in nscp for scripts


Ignore:
Timestamp:
04/03/08 19:47:01 (5 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
9567d4b, eb30340
Parents:
b7ed6ac
Message:

2008-04-03 MickeM

  • Moved COM init to "core" (from WMI module) + Added new Check command: CheckTaskSched Use like so:

CheckTaskSched +filter-exit-code==1 ShowAll MaxWarn=1 MaxCrit=1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/test.lua

    r8b206ee r367bf20  
     1--require("luacom") 
     2--require("luacom") 
     3--require("luacom-lua5-13") 
    14 
    2 print('Loading test script...') 
     5nscp.print('Loading test script...') 
     6-- win = loadlib("win32.dll","luaopen_w32") 
     7-- print(win) -- nil 
     8require( 'w32' ) 
     9nscp.print(w32) 
     10nscp.print(w32.FindWindow) 
    311 
    4 register_command('check_something', 'something') 
     12nscp.execute('version') 
     13v = nscp.getSetting('NSCA Agent', 'interval', 'broken') 
     14nscp.print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') 
     15nscp.print('value: ' .. v) 
     16nscp.print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') 
     17 
     18nscp.register('check_something', 'something') 
     19nscp.register('lua_debug', 'debug') 
     20nscp.register('foo', 'something') 
    521 
    622function something (command) 
    7   print(command) 
    8   code, msg, perf = inject('CheckCPU','time=5','MaxCrit=5') 
     23  nscp.print(command) 
     24  --code, msg, perf = inject('CheckCPU','time=5','MaxCrit=5') 
     25  msg = 'hello' 
     26  perf = 'hello' 
     27  code = 'ok' 
    928  print(code .. ': ' .. msg .. ', ' .. perf) 
     29  collectgarbage () 
     30 
    1031  return code, 'hello from LUA: ' .. msg, perf 
    1132end 
     33 
     34 
     35function debug (command, args) 
     36    table.foreachi(args, print) 
     37    print ('Command was: ' .. command) 
     38    return 'ok', 'hello' 
     39end 
Note: See TracChangeset for help on using the changeset viewer.