DX NetOps Manager

 View Only

Enable/Disable polling for multiple interfaces in CAPM - Python code 

Aug 27, 2018 05:30 AM

Dear All,

 

In CAPM 3.6 there is a new feature introduced to enable/disable interface polling. Using the attached python code, one can do the same in bulk for multiple interfaces. The Input required is the oData Interface ID for the said interface.

 

There are two inputs required. The Odata Device Ids in text file as below and if they need to be enabled/disabled.

 

inter.txt is sample file attached.

 

The script will summarise the status when it runs fully as below.

 

$python3 Update_Polling_CA-Community.py

Type input file which has interface ids : inter.txt

Do you want to enable or disable polling : disable

Type output file to log : test.txt

Total Interfaces to be Updated :  2

Successfully done :  2

Failed to Update :  0

Details logged to file :  test.txt

 

Since the API only returns success/failure, in case of failure, most probably the id is incorrect.

 

please leave a comment in case you face difficulties in running the script.

 

Rgds,

Chetan

Statistics
0 Favorited
17 Views
2 Files
0 Shares
11 Downloads
Attachment(s)
zip file
Update_polling_CA-Community.py.zip   1 KB   1 version
Uploaded - May 29, 2019
zip file
inter.txt.zip   152 B   1 version
Uploaded - May 29, 2019

Tags and Keywords

Comments

Aug 29, 2018 09:47 PM

Hi Fernando,

 

Assuming that you have created a group for those devices/interfaces, you can use below oDATA Query to get the interface ids in one go for all the interfaces which are part of a particular group.

 

http://<DA IP>:8581/odata/api/interfaces?$top=20000&$skip=0&$select=DeviceItemID,ID,DisplayName,IsPolled,Name,RetireTime,Alias,AlternateName&$filter=((tolower(groups/Name) eq tolower('<Groupname>')))

 

Replace the <DAIP> and <group name> to the one that you have and it will return the parameters specified.

 

Hope this helps. 

 

Thanks,

Chetan

Aug 29, 2018 04:19 PM

Hello Chetan,
It's just what I needed.
By chance do not you have another script to get the ID interfaces?

 

I was checking
http://performance:8181/pc/center/webservice/devices/deviceItemId/131/interfaces
But there are only the interfaces of that specific device.


I have to use your script in 50mil interfaces.

 

Regards!

Related Entries and Links

No Related Resource entered.