DX Infrastructure Manager

Expand all | Collapse all

LUA script for net_connect probe

  • 1.  LUA script for net_connect probe

    Posted 10-11-2018 07:54 AM

    I am looking for a script which will check robot against net_connect list for all the hubs . This should be emailed to recipients. can someone help me with the script if exists ?



  • 2.  Re: LUA script for net_connect probe

    Posted 10-11-2018 08:11 AM

    Do you want to create a list of target devices in every net_connect probe instances ?



  • 3.  Re: LUA script for net_connect probe

    Posted 10-11-2018 08:21 AM

    No. I am looking for checking  the count of robots in hub vs netconnect.

    script looks good if they have the  following 

     

    Eg: Results like 

      ping SNIEMRCERTDB     ok   - means robot is in both hub and netconnect
      Robot 'webmixdevall01:172.20.35.246' is not monitored by net_connect. - means robot is not monitored in netconnect


  • 4.  Re: LUA script for net_connect probe

    Posted 10-11-2018 11:47 PM

    Thanks. You would like to check if all the robots in your UIM domain are being registered as monitoring target of your net_connect probe ?



  • 5.  Re: LUA script for net_connect probe

    Posted 10-12-2018 05:05 AM

    An example of building device lists that own "ping" as Configuration Item.

    However, integrating list of robot might be challenging to me.

    As far as you enable ping monitoring, target device own "ping" Configuration Item.

     

    select cmd.dev_name from CM_CONFIGURATION_ITEM cmci

    INNER JOIN CM_DEVICE cmd on cmd.dev_id = cmci.dev_id

    where cmci.ci_name = 'ping'

    order by cmd.dev_name

     



  • 6.  Re: LUA script for net_connect probe

    Posted 10-12-2018 06:23 AM

    Thanks YU . My requirement is to get a report of  inventory of robots in hub and in netconnect probe. This is for checking the servers in ping only monitoring and full monitoring. Can it be done ?



  • 7.  Re: LUA script for net_connect probe

    Posted 10-12-2018 06:40 AM

    Do you have multiple net_connect probes deployed or is there just one on each hub?

    Either way the script can be done, but I don't have anything similar and might take a bit of time to it work out.

    Might be worth employing CA Services for a day to deliver this.



  • 8.  Re: LUA script for net_connect probe

    Posted 10-12-2018 06:43 AM

    Yes Rowan, one netconnect deployed on each hub



  • 9.  Re: LUA script for net_connect probe

    Posted 10-15-2018 10:07 AM

    can someone help to pull up net_connect profiles inventory using LUA script or SQL way ?



  • 10.  Re: LUA script for net_connect probe

    Posted 10-15-2018 12:15 PM

    This should help you out….

     

     

    hublist = nimbus.request("hub","gethubs");

    hubs = hublist.hublist

    args = pds.create()

    for hub_key,hub_table in pairs(hubs) do

       hub = hubs[hub_key]

     

    --   if hub.name == "rc82_phub" then

          hubr = "/"..hub.domain.."/"..hub.name.."/"..hub.robotname.."/net_connect"

          print ("Processing hub: " .. hubr .. "\n")

          profile_list,rc = nimbus.request (hubr,"get_profile_status")

          if profile_list ~= nil then

             profiles = profile_list.Profiles

     

             for profile_key,profile_table in pairs(profiles) do

             profile = profiles[profile_key]

                printf ("profile "..profile.profile_name)

             end

          end

     

    --   end

    end

     

     

     

     



  • 11.  Re: LUA script for net_connect probe

    Posted 10-15-2018 12:28 PM

    This is great. Thanks Rowan. Now all the devices are listing .In my case I have two folders server and network inside net_connect with  devices in these folders Is it possible to arrange  it out and list the devices with these profile names and email it ?



  • 12.  Re: LUA script for net_connect probe

    Posted 10-15-2018 12:57 PM

    If you mean separate them out by group then you will have to change the lua completely to get the whole config with a probe_config_get on the controller, as the group isn't part of the get_profile_status.



  • 13.  Re: LUA script for net_connect probe

    Posted 10-15-2018 01:11 PM

    i saw the below code from the community. Can you help me how to fit it in the current lua code ?

     

     

    probecmd = pds.create()
    pds.putString(probecmd, "name", "net_connect")

     

    response, retcode = nimbus.request("/Path/to/hub/controller", "probe_config_get", probecmd)



  • 14.  Re: LUA script for net_connect probe

    Posted 02-06-2019 07:17 AM

    Can anyone know how to write LUA output for the following code:

     

    probecmd = pds.create()
    pds.putString(probecmd, "name", "net_connect")

     

    response, retcode = nimbus.request("/ESM/ALA/smtools", "probe_config_get", probecmd)

     

     

    The output i am getting only shows :

    Processing hub: /ESM/ALA/smtools/net_connect

     

    ----------- Executing script at 2/6/2019 7:06:16 AM ----------



  • 15.  Re: LUA script for net_connect probe

    Posted 02-07-2019 07:00 AM

    Not sure what you are trying to achieve but this script is similar and works…. Hopefully should help you.

    (the probe_config_get callback is on the controller probe so you need to add that in)

    The script pulls out the logfile name from the probe config…

     

    args = pds.create()

    pds.putString(args,"name","net_connect")

    resp,retcode = nimbus.request("/rc82-dom/rc82_phub/colro22-i147145/controller","probe_config_get",args)

    if resp == nil then

       print("all bad")

    else

       print("all good")

    end

    printf("resp-"..retcode)

    setup = resp["/setup"]

    printf ("name-"..setup.logfile)

     

     



  • 16.  Re: LUA script for net_connect probe

    Posted 02-07-2019 09:08 AM

    Thanks Rowan. Sorry if my question is not clear to you . 

     

    Example: In my case i have two groups manes 'server' and network' which have profiles. I am looking for getting the group list and profiles from netconnect probe and send it via email.I am  a beginner in LUA scripting and looking for this code.



  • 17.  Re: LUA script for net_connect probe

    Posted 02-07-2019 09:46 AM

    Hope this gets you started…

     

     

    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 == "rc82_phub" 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"

          print ("\n".."Processing hub: " .. hubr .. "\n")

          profile_list,rc = nimbus.request (hubr,"get_profile_status")

          if profile_list ~= nil then

             profiles = profile_list.Profiles

             printf ("Group       Profile ")

             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     

                

                printf (cfg_profile.group.."     "..profile.profile_name)

             end

             end

          end

     

    --   end

    end

     



  • 18.  Re: LUA script for net_connect probe

    Posted 02-07-2019 09:51 AM

    Wow . This works like a magic. Thanks Rowan. Can the result be send via email ?



  • 19.  Re: LUA script for net_connect probe

    Posted 02-07-2019 10:49 AM

    It's your lucky day, feeling generous

    It will require emailgtw probe to be setup with an smtp server.

    Put your email address in and give this a try…

     

    buffer = "Net_Connect Profiles \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 == "rc82_phub" 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".."Processing hub: " .. hubr .. "\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")

    --         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 = "assigned.user@mycompany.com"

     

     

     

    subject = " Net Connect Profiles "

     

    print (buffer)

     

    action.email (recipient,subject,buffer)

     

     



  • 20.  Re: LUA script for net_connect probe

    Posted 02-07-2019 12:50 PM

    It works. Thanks Rowan for your time and helping me to get the results. 



  • 21.  Re: LUA script for net_connect probe

    Posted 02-18-2019 10:03 AM

    Hey Rowan,

     

    I know i am disturbing asking for more help, but if you can that will be a great help for me . The current report looks like

     

     

    Group       Profile

    Servers     GPNVMS2OPL2

    Servers     GPNVMS2OPL1

     

    I am in need of  modify the  report  like below . The group column should be in  ascending order 

    No:  Group  Ip addess   Profile 

    1      servers  1.1.1.1    server

    2      network 2.2 2.2     opsw

     

    Can you help me once more ?