DX Unified Infrastructure Management

  • 1.  LUA script -Netconnect

    Posted Feb 08, 2019 08:42 AM

    Can someone help me to have the code to get the number of profiles in netconnect probe  and email it to recipients .

     

    Eg: We have two groups , Server and Network in netconnect . I am looking to get the  number of profiles on each folder

     

    Server - 10

    Network -10



  • 2.  Re: LUA script -Netconnect

    Posted Feb 20, 2019 09:04 AM

    profiles are all contained in one file, net_connect.cfg, and in that file identified as such:

    <profiles>
       <1st profile name>

    ...

       </1st profile name>
       <2nd profile name>

     ....

    </2nd profile name>



  • 3.  Re: LUA script -Netconnect

    Posted Feb 20, 2019 09:38 AM

    Thanks David for the reply. Yes, i can see the profiles inside the .cfg file. But my requirement is to email it in the below format using LUA.

     

    No: Profile   Device IP Address

    1    server   cspsrvr   1.1.1.1

    2    server    test        2.2.2.2

    3. network   cisco       8.8.8.8

    4. network   ciscotest   9.9.9.9



  • 4.  Re: LUA script -Netconnect

    Posted Feb 20, 2019 09:59 AM

    Sorry, I misunderstood. So the need is for someone to write the script. For that either Services or a consultant can be engaged.



  • 5.  Re: LUA script -Netconnect

    Posted Feb 20, 2019 10:17 AM

    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)