I'm trying to list the status of a probe using nimbus.request., but I get nothing retrurned. What am I doing wrong? I know this should return one table.
mypds = pds.create()pds.putString (mypds,"name", "logmon")pds.putString (mypds,"robot", "isp998")result,rc=nimbus.request("/Enterprise/MONIMBUSP3/isp998", "probe_list",mypds)for i=1, #result do if result ~= nil then data = result[i] print(data.active) end
A couple of things:
Give this a try (put in a username and password first):
nimbus.login("user", "password")mypds = pds.create()pds.putString (mypds,"name", "logmon")pds.putString (mypds,"robot", "isp998")result,rc=nimbus.request("/Enterprise/MONIMBUSP3/isp998", "probe_list",mypds)if result ~= nil then for k,v in pairs(result.logmon) do print(k.." : "..v) endendpds.delete(mypds)
By the way, I do not think you need to include the robot argument to the callback. That should be optional. (Of course, it should not hurt either.)
This would be nimbus.request from a lua script running on the NAS, not NSA.... Were you thinking NSA? nimbus.login() does not exist on the NAS....
Yes, I tested the code using the NSA. I think you should be able to use the code I posted in the NAS if you leave out the nimbus.login() call. Let me know if that does not work.
No error, but I don't think it's pulling anything back. I'm wondering if it's a bug with the probe. I tried pulling the same data using the nimbus request in the EC and I get an error message "token contains data in a format not supported" . The pu can handle the request no problem.
I just tried the code in the NAS, and it actually worked fine for me. But I noticed when I copied and pasted it that there was an extra space in the robot address. I just edited the code above and fixed that, so you might want to check the copy you ran. That would probably make a big difference.
If that does not work, try putting in a line to print the rc variable after calling nimbus.request() and see what value it returns.
You should also (although implisit) add the "probe-name" to the request. Note how the associative table can
be accessed in the snippet below. You can leave out the "robot" parameter to the arguments, this is only needed when the probe is running under a virtual robot e.g. Novell
mypds = pds.create()pds.putString (mypds,"name", "logmon")result,rc=nimbus.request("/Development/Holmen/prexpcase/controller", "probe_list",mypds)if rc == NIME_OK then for k,v in pairs(result["logmon"]) do printf("%s = %s",k,v) endelse printf("no data...")endpds.delete(mypds)
Thanks, Keith and Carstein! Solid solution, works!
Could this perhaps be moved to General Development.
Just discovered the Message, nearly the same as I asked in development :->