RobPol

Automatic Dashboard Generation problem publishing and colour of panel Bg

Discussion created by RobPol on Jul 20, 2011
Latest reply on Jul 21, 2011 by RobPol

using the ndg I have got pretty far. I can build the dashboard I want, save it as xml and copy past it to dashboard designer. It works great. I would prefer to save it direct from my ndg script but that fails. Even the example that comes with ndg (reproduced below) fails. It looks like it is not talking to the UMP correctly.

 

I am running ndg on the hub machine and thought it would be using soap to talk to the wasp, I put in the server name and port for the wasp and it finds the dapi version so it is getting some comunication. In the code below and have confirmed user and pass are good.

 

The error I get is:

Jul 20 16:27:06:240 nsa: Script error, modules\example-ndg:21: No QoS table, please check the server,username and password settings.

 

One other thing, is there a way to set bgcolor in a panel? I tried color which does the txt colour OK, tried bgColor and it warns it is not a valid setting and ignores it.


here is the example I am using:

-- This example creates a matrix (n x 10) of gauges with CPU values.
--
file = io.open("robot_locations.csv", "w")

-- Location for the UMP server ?
local server   = "10.15.10.83:8084"
local username = "administrator"
local password = "***********"

print "requiring environment"
require "ndg/environment"
require "ndg"

print "creating dashboard"
-- Create a dashboard and synchronize local resources with resources on server
-- local d = dashboard.get("test","http://"..server.."/DashboardAPI/services/DashboardAPI",username,password)
local dh = dashboard.create("CPU Monitor","http://"..server.."/DashboardAPI/services/DashboardAPI",username,password)
if dh == nil then
    error ("No Dashboard could be created. Check the server,username and password settings.")
end

local i = 0
local ypos = 10
local gh = 80
local gw  = 80

print "getting QoS table"

resp,rc = nimbus.request("hub", "gethubs")
for h,hinfo in pairs(resp.hublist) do
   print ("inspecting hub: ",hinfo.addr)
   match,pos = substr(hinfo.addr,"hub")
   if match then
      local args = pds.create()
      pds.putInt(args, "detail", 0)
      sessionhandle = nimbus.session_open(hinfo.addr)
      if sessionhandle ~= nil then
         local r_resp,rc = nimbus.session_request(sessionhandle, "getrobots", args, 300)
         if rc == 0 then
            for r,rinfo in pairs(r_resp.robotlist) do
               print( rinfo.os_user2.."\t"..rinfo.os_user1.."\t"..rinfo.name)
               file:write (rinfo.os_user2..","..rinfo.os_user1..","..rinfo.name.."\n")
            end
         end
      end
   end
end
nimbus.session_close(sessionhandle)
   
if i > 0 then
    -- if dashboard.save(dh,true,"Superuser") == NIME_OK then
    if dashboard.save(dh,"testdash.xml")== NIME_OK then
        print "The dashboard was saved and published successfully!"
    else
        print "Failed to save dashboard..."
    end
else
    print "no matching qos objects..."
end

dashboard.free(dh)

Outcomes