04-19-2016 01:16 PM
Shadowdirectory IS NATIVELY AVAILABLE in PI 3.1.3 (look for Background Task 'Device Config Backup-External')
Sometimes functionality that is missing from the GUI still is available through the API as a workaround. A good example is the Shadow Directory, which was available in Cisco Prime LMS and is not yet available in Prime Infrastructure. However still through the API configurations can get pulled and stored in a directory to mimic this. This functionality is often requested by customers hence I putted together this short example.
Zip File contains 2 folders 'prime' & 'clitools'. The folder 'prime' contains the files 'PrimeBasicTools', 'PrimeShadowDirectory' and 'UserTrackingUtility'. In 'clitools' you will find 'PrimeShadowDirectoryRunner' and 'UserTrackingUtilityRunner'.
|
Disclaimer: Use at your own risk / no support offered
07-12-2016 03:13 AM
Hello Stefan,
Thank you very much for such important topic.
But can you please share step by step guide to upload those codes on the prime infrastructure, as I am not familiar with python programming.
Thanks in advance.
07-12-2016 11:59 PM
Hello Mahmoud,
actually it is not meant to run this directly on PI. Basically you can run this on any PC/Workstation/Server you like. You would only need to have IP connectivity from this station to PI and install Python 3 on it. After that, you can then execute those commands above manually or also schedule a cron job to do it regularly to back up your configs.
Hope that helps, if anything unclear, just let me know.
regards,
stefan
01-09-2019 11:50 PM
Hello Stefan,
first, I would like to thank you for your work. It has elimented a real problem for me in recent years.
Since yesterday I did an inline update to Prime Infrastructure 3.5 and unfortunatly your tool is not working anymore.
Maybe you can help me:
C:\Tools>"C:\Program Files\Python\Python37\python.exe" "C:\Program Files\Python\clitools\PrimeShadowDirectoryRunner.py" -d D:\ConfigBackup\PrimeConfigExport -u <user> -p <password> <servername>
Start executing...
ERROR:root:Error: <class 'UnicodeEncodeError'> Details: 'charmap' codec can't encode characters in position 0-2: character maps to <undefined> StackTrace: Traceback (most recent call last):
File "C:\Program Files\Python\clitools\prime\PrimeShadowDirectory.py", line 247, in writeLatestConfigOfAllDevices
f.write(configs[dev])
File "C:\Program Files\Python\Python37\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-2: character maps to <undefined>
...something went wrong!
C:\Tools>
with kind regards,
Bernd
01-10-2019 09:09 AM
Hi Bernd,
unfortunately it seems that the API now returns the data not in 'string' format but in a different one, which leads to problems when writing it into a file.
Example from my PI3.5
...
<fileData>SE�U��+A�ܼRa�0m!5Dם"�й#L�,�Z�Pxʚ��V|�����3��n�|����ǶSL��m��Ʈ�x�V�Y�Dƌ�ˑ#�2������~+`yd��]�u������{�"�@e�
���/�m����`�ޯ���v;���=V�...
I have to check if I can get this solved. In the meantime I would recommend to use the build in function under Administration > Job Dashboard > System Jobs > Infrastructure > Device Config Backup-External
Click the checkmark on the left side of the Job, and select the Pencil at the top, that allows you to configure the Destination and schedule.
regards,
stefan
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide