I have the below script which has output, but need to add extra fields No: and IP address and sort it by profile wise.
Group Profile
Network SGFTSW01
Network SGFB
Servers CALL
script:
buffer = "Net_Connect Inventory \n"
hublist = nimbus.request("hub","gethubs");
hubs = hublist.hublist
args = pds.create()
for hub_key,hub_table in pairs(hubs) do
hub = hubs[hub_key]
-- print (hub.name)
if hub.name == "" then
args = pds.create()
pds.putString (args,"name","net_connect")
hubaddr = "/"..hub.domain.."/"..hub.name.."/"..hub.robotname
-- printf(hubaddr)
cfg,rc = nimbus.request (hubaddr.."/controller","probe_config_get",args)
pds.delete(args)
hubr = "/"..hub.domain.."/"..hub.name.."/"..hub.robotname.."/net_connect"
output = "\n".."site: " .. hubr .. "\n\n"
-- print (output)
buffer = buffer..output
profile_list,rc = nimbus.request (hubr,"get_profile_status")
if profile_list ~= nil then
profiles = profile_list.Profiles
output = ("Group Profile ".."\n\n")
-- print (output)
buffer = buffer..output
for profile_key,profile_table in pairs(profiles) do
profile = profiles[profile_key]
cfg_profile = cfg["/profiles/"..profile.profile_name]
if cfg_profile.group ~= nil then
output = cfg_profile.group.." "..profile.profile_name.."\n"
-- print (output)
buffer = buffer..output
end
end
end
end
end
recipient = "a.recipient.com"
subject = " Net Connect Inventory "
print (buffer)
action.email (recipient,subject,buffer)