cancel
Showing results for 
Search instead for 
Did you mean: 

Python run script for specific devices

Python run script for specific devices

Dan15
Contributor

I was playing around with python to pull the Alarm Database from the VSPs and send it per email. So far good, but I don’t want to choose the devices where to run the workflow but to handle that in the script. I know when removing the device variable, XMC does not ask to choose a device. I was trying do achieve something with emc_vars[“family”], but had no success. Anybody a hint for that?

4 REPLIES 4

rbrt
Contributor

If you need sample code feel free to have a look at https://gitlab.com/bell-computer-netzwerke/xmc-nbi-clients/blob/master/Python/DeviceLister/DeviceLis... or the fork at https://github.com/rbrt-weiler/xmc-nbi-clients/blob/master/Python/DeviceLister/DeviceLister.py - this is a simple script that connects to the NBI, pulls a list of all devices and prints them to the CLI along with up/down information. The query that is included in the script should also suffice for looping over all VSP devices by using the device family for the loop.

Zdeněk_Pala
Extreme Employee

There is no such query = “give me all VSP devices”.

but you can ask for all devices IP+family and process the answer in the loop.

Regards Zdeněk Pala

Dan15
Contributor

Thanks for your example, I’m trying the opposite to get the IP’s from all VSP Series devices. I found the https://<xmc server>:8443/nbi/graphiql/index.html  which is very helpful, but I’m still not able to create the right query.

Zdeněk_Pala
Extreme Employee

here is your query:

{
network {
device(ip: "192.168.130.1") {
deviceDisplayFamily
}
}
}

here is how response look like:

{
"data": {
"network": {
"device": {
"deviceDisplayFamily": "Summit Series"
}
}
}
}

check the similar request here.

Regards Zdeněk Pala
GTM-P2G8KFN