DX Unified Infrastructure Management

  • 1.  Install probe package using inst_package

    Posted Sep 27, 2018 10:13 AM

    I am looking for an LUA script where the probe package will be installed when an alarm like below will triggered. I have created a super package which can be used for this installation.

     

    max. restarts reached for probe 'nt services'

     

    Experts- Please let em know if it can achievable. 



  • 2.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 12:31 PM

    The code to invoke the package deployment using distsrv would look something like:

     

    toInstall = pds.create()
    pds.putString(toInstall,"job_id","DeployPackage")
    pds.putString(toInstall,"package","MySuperPackage")
    pds.putString(toInstall,"robot", "/Domain/desthub/destrobot")
    pds.putInt(toInstall,"update",0)
    pds.putInt(toInstall,"start_at",0)

    a,b = nimbus.request("/Domain/Primaryhub/Primaryrobot/distsrv", "job_add",toInstall)

     

    You can search the forums here for the typical AO script structure - probably a search for alarm.get() would be most useful.

     

    -Garin



  • 3.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 12:47 PM

    Thanks Garin.

    Will this code works ?

     

    al = alarm.get ()

    if al ~= nil then
    if al.prid == "controller" then
    if string.match(al.message,"Max. restarts reached for probe") then
    print("message match")
    probe = string.gsub(string.match(al.message,re),"'","")
    print(al.message.."! Probe-> "..probe)

    addr = "/"..al.domain.."/"..al.hub.."/"..al.robot.."/".."controller"
    printf("/"..al.domain.."/"..al.hub.."/"..al.robot.."/".."controller".."<->Probe="..al.prid)


    toInstall = pds.create()
    pds.putString(toInstall,"job_id","DeployPackage")
    pds.putString(toInstall,"package","MySuperPackage")
    pds.putString(toInstall,"robot", "/Domain/desthub/destrobot")
    pds.putInt(toInstall,"update",0)
    pds.putInt(toInstall,"start_at",0)

    a,b = nimbus.request("/Domain/Primaryhub/Primaryrobot/distsrv", "job_add",toInstall)

    pds.delete(args)
    end
    end
    end
    end



  • 4.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 12:59 PM

    I think that you'd need something like:

    al = alarm.get ()

    if al ~= nil then

    if al.prid == "controller" then

    if string.match(al.message,"Max. restarts reached for probe") then

    print("message match")

    probe = string.gsub(string.match(al.message,re),"'","")

    print(al.message.."! Probe-> "..probe)

    addr = "/"..al.domain.."/"..al.hub.."/"..al.robot

    printf(addr.."<->Probe="..al.prid)

    toInstall = pds.create()

    pds.putString(toInstall,"job_id","DeployPackage")

    pds.putString(toInstall,"package","MySuperPackage") -- <<<--- NEED to set your package name here

    pds.putString(toInstall,"robot", addr)

    pds.putInt(toInstall,"update",0)

    pds.putInt(toInstall,"start_at",0)

    a,b = nimbus.request("/Domain/Primaryhub/Primaryrobot/distsrv", "job_add",toInstall) 

    --                                                ^^^^^^^--- NEED to set your central hub path here

    pds.delete(args)

    end

    end

    end



  • 5.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 01:06 PM

    pds.putString(toInstall,"job_id","DeployPackage")  

    pds.putString(toInstall,"robot", addr

     

    Will the robot address take automatically from the alarm ?



  • 6.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 01:21 PM

    Your code included the line:

     

    addr = "/"..al.domain.."/"..al.hub.."/"..al.robot

     

    which assembles the robot address from the alarm message.

     

    That is then subsequently used in the PDS that defines the install job to distsrv.

     



  • 7.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 01:23 PM

    I have tested the code, but the distribution is not happening  . Is there any other way where the probe can updated or installed ?



  • 8.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 01:30 PM

    It would be good if you posted a copy of the code you are testing now as well as a description of how you are testing it. I'd also suggest adding some additional printing to it to identify when the several "if" statements in the code might be detecting a false condition.



  • 9.  Re: Install probe package using inst_package

    Posted Sep 27, 2018 01:36 PM

    al = alarm.get ()

    if al ~= nil then

    if al.prid == "controller" then

    if string.match(al.message,"Max. restarts ") then

    print("message match")

    probe = string.gsub(string.match(al.message,re),"'","")

    print(al.message.."! Probe-> "..probe)

    addr = "/"..al.domain.."/"..al.hub.."/"..al.robot

    printf(addr.."<->Probe="..al.prid)

    toInstall = pds.create()

    pds.putString(toInstall,"job_id","DeployPackage")

    pds.putString(toInstall,"package","NIMDEPLOY-Live-SuperPackage")

    pds.putString(toInstall,"robot", addr)

    pds.putInt(toInstall,"update",0)

    pds.putInt(toInstall,"start_at",0)

    a,b = nimbus.request("/ESM/ISC/nmsapp01/distsrv", "job_add",toInstall)

    pds.delete(args)

    end

    end

    end

     

    This script will run when the alarm "Max. restarts is triggered. In the NAS AO profile i have  created rule based upon 'script' .