Forum Discussion

pperreault's avatar
4 years ago

download multiple device configs

Anyone know of or have a scipt to download multiple device configurations at once? I'm thinking of writing a script that will identify resources within a group and then download their configurations for a specific configsource instance. I can't be the first one to want this though so thought I'd check here.

16 Replies

  • Worked it out. By default a list of 50 stored config results will be returned. Had to update the Get Devices queryParams= '?size=1000&offset=0'

  • On 6/25/2021 at 4:25 AM, Herin said:

     

    Hi @pperreault

    I am new to scripting so trying to get my head around this. We are in the same boat where we have download configs for multiple devices, how to go about utilising this script ? 

    Let me know.

    Thank you

    Thanks for the script, could you please help me with Jason file template to pass the credentials required to authenticate?

    Appreciate your help . 

  • On 8/12/2020 at 8:51 AM, pperreault said:

    I put this together.

    https://github.com/peteperreault/lm

    Script is getGroupConfigs. It's working for Cisco and Palo Alto devices, potentially only a subset of each. I'm sure there are additional devices that can be added as well as additional functionality. @Stuart Weenig You'll recognize some bits from connectwise_manage. You know what they say, imitation (and outright thievery) is the sincerest form of flattery. ?

    Thanks for the script, could you please help me with Jason file template to pass the credentials required to authenticate?

    Appreciate your help . 

  • Should look something like this:

    {
    	"lm_id": "HKLASUEKGYAKGJASJ",
    	"lm_key": "1383270q9845092834759823409762",
    	"lm_company": "yourportalname"
    }
  • It is not JSON, it is YAML.  Example:

    ---
    companies:
        PORTALNAME:
            access_id: 'ACCESS-ID'
            access_key: 'ACCESS-KEY'

    I probably should sync up to our current version -- we've had to add exceptions regularly to keep from being inundated with fake changes due to inadequate error handling in the LM code.  Wish we could just integrate Oxidized sometimes.  At least there if problems are found, people generally fix them.

  • 1 minute ago, mnagel said:

    It is not JSON, it is YAML.  Example:

     

    Are you sure?

    keyFileJson = json.loads(fileText)
    AccessId = keyFileJson['lm_id']
    AccessKey = keyFileJson['lm_key']
    Company = keyFileJson['lm_company']