Setup for Python 3.x to Query LM looking at Arista Voltage Sensors - Just PowerSupply
Looking for examples to setup Python 3.x usage of the API for v2 - Perhaps in GitHub?
I learn best by example and I'm looking for examples that others have done for successful setup and use of Python 3.x API V2.
I'm looking for device information on Arista devices, Arista Voltage Sensors - but just the ones that have PowerSupply (could have multiple entries).
We discovered that some of the dual power supplies were not connected to power supplies and did not have any alerts on that fact.
There is a Voltage Alert - but that also alerts on the on the POE and other power items besides just the PowerSupply marker.
Any help and points would be welcome.
Of course when this is done- I need to check all the other vendor device types and create queries for those as well.
Thanks for your help and pointers to learn from examples that others have done.
I have upload a picture of both one that shows good values and one that shows bad values.
Henry Steinhauer -


LM User
·4 years agoI'm not seeing a max on the datapoint definition nor on the axis in any of the graph definitions. Normally, if you don't set a max, it just auto adjusts to a decent height so everything is visible on the graph. You can hard code that, or leave it automatic.
Henry Steinhauer
OP4 years agoOK - thanks for helping me understand the process. I see that I also have the ability to set the alert.
As an aside -
I noticed that the allowed ranges were 0 to 207 volts. - - I'm seeing actual voltage values higher than 207 though - it is a 240 volt source.
In rolling through the devices - I see some at 210 for instance.
LM User
·4 years agoIt will add more datasources to the same device, not add more devices.
Before (top) and after (bottom). You are licensed by device, not by instance. We count the number of devices your collector talks to, not how much data we gather from that device. Besides, the total number of instances isn't actually changing.
Henry Steinhauer
OP4 years agoI think I understand .
But - this will duplicate the devices that are being monitored - adding more devices to our license -
One of the devices will be able to alert on the powersupply voltage if it is low -
The other would have everything else being monitored.
We still need the other objects being monitored - like the traffic on the interfaces and other items like BGP etc. All the normal stuff.
If I do the RegexNotMatch - then won't it exclude all the other items from being monitored?
LM User
·4 years agook, easy peasy.
The strategy mentioned before is still the recommended way. You'd clone the datasource and modify the new datasource to include a discovery filter where the sensor_owner (which is the attribute that determines instance group membership) starts with "PowerSupply". There's not a "starts with" option, but there's a "RegexMatch" option. So it would look like this:
This should result is basically the same datasource as you had before, but will only discover the instances where the sensor_owner is a power supply. Use the "Test Active Discovery" button to make sure you're getting the right instances. You might not need the "auto." at the beginning, i can't test without an arista device.
Once you've got that new clone working, set your threshold on the volt datapoint.
Once that's all working, there's no need to monitor those instances with the old datasource, so go add a filter that filters them out of that one. Something like this:
Henry Steinhauer
OP4 years agoYou were able to re-state the problem perfectly - - Yes- I am only looking for those instances that start with PowerSupply -
LM User
·4 years agoThe leading dot is optional in OID addresses. It used to be required by RFC1213 standards IIRC, but newer software libraries have accounted for people leaving off the dot. Ours is also one that tolerates omitting the leading dot. This is otherwise known as a "fortunate typo".
Let's lay down some terminology so we make sure we're all talking about the same things:
Arista_Voltage_Sensors <- this is the name of the datasource.
Arista Voltage Sensors <- this is the display name of the datasource. It shows up directly under the device in the resource tree.
PowerSupply1 (or 2) <- this is the instance group. In this case, the group is created based on the value of auto.sensor_owner on the instance.
Input Voltage Sensor (100711104) <- this is the instance, you'll have one instance per sensor.
Voltage Sensor Overview <- this is an "overview" graph, meaning that it shows data from all sensors on the device. In this case, one line per instance.
Volts <- this is technically the overview graph datapoint name, which in this case is the same as the datasource's datapoint name.
As I understand your ask: you want to put a custom threshold on the volts datapoint, but only have that threshold apply to instances where the instance group starts with "PowerSupply". There may be other sensors, but they may not be in an instance group called "PowerSupply" and you don't want those sensors to generate an alert when the voltage is 0. Is that correct?
Henry Steinhauer
OP4 years agoIn answer to the 'is there a way to programmaticly' find that.
I'm not sure - - an example is for one of the Arista devices - it has an item in
Arista_Voltage_Sensors -> PowerSupply1 (or 2)
Within that is then the Voltage Sensor Overiew which has the Input Voltage Sensor (100711104) Volts and Status - -I want Volts.
I would assume it is in the MIB - but I have not explored to find the actual MIB OID yet.
When I click to look at the DataSources -
That takes me to the DataSource - Arista_Sensor_Voltage,
it looks like it is in the OID_MAP .1.3.6.1.2.1.47.1.1.1.1.2 for the description
and .1.3.6.1.2.1.47.1.1.1.1.4 for the Contained_in
I used to use GetIF for the SNMPWALK - and to use the MIB OID mapping to explore Tables.
As an Aside - why does the oid_map have mappings that for some start with '.1.3.6.1.' and yet the 'description' entry does not start with '.1' but with '1.' ?
If this is really an OID - I would expect to see them all have the same form - all start with a '.' and then follow the OID chain to the actual value.
LM User
·4 years agoOk, i'm getting a better picture of your problem (not clear but getting there). You need the threshold to apply to some instances but not others. And that means setting the threshold manually on each instance, which is not scalable.
The traditional way of handling this is to split the datasource into two copies: one for the instances with one threshold and one for instances with the other. You limit the discovery of each datasource to include only the instances in that group (discovery filters are easiest). That way you have one datasource that is doing what it's doing now, except not monitoring the instances that need the different threshold. The new datasource is only monitoring the instances that need the new threshold. This lets you set the threshold globally, but have it only apply to certain objects.
Is there a way to programmatically (i.e. querying the device during discovery) determine which ones need the other threshold?
Henry Steinhauer
OP4 years agoThe standard way to put an alert on this does not appear to be able to only put this on the PowerSupply items, but all the Volt reporting widgets for Arista.
That is not what we wanted to have happen as that appears to also be setting the POE Voltage settings as well.
If I would limit it to just the PowerSupply item that would be great. We have 133 of these devices at present and still refreshing the enterprise. So more are coming. Setting all of these by a manual process is not the desired way to do this alerting.
Now that I've been looking at them by hand, I am also noticing that some are in the 220 Volt area and some are in the 110 Volt area. Surprise not all of our facilities have 220 as a source of power.
I would love it if this could be enabled for alerting on low power on the PowerSupply widget once a device is created / discovered.
LM User
·4 years agoYeah, my repo had to come down.
FWIW: why not just set a threshold of 0 on that datapoint? If you already have a threshold, create a complex datapoint that uses that datapoint as its expression. Then you can set a specific threshold of 0 on that datapoint.
Henry Steinhauer
OP4 years agoWill do - - I have looked at that in the past, but I was looking for more examples like you have in your tag - links.
I did notice that something changed in your tag link for the first link - >>My personal library of LogicModules is here.<<
For me, the tag 'here' did not find a page.
Your other links worked though.
Thanks for the pointers - I'll review and start building my library of examples.
LM User
·4 years agoOk, in that case, I recommend the Python SDK. Documentation and examples.
Henry Steinhauer
OP4 years agoStuart, Yes I am looking to use the LM API to cycle through the configuration and find these devices that need further insight.
Else I look at these by hand by looking for Arista Voltage Sensor - and then looking through the Search Results list one by one.
Making a note about each device that has an issue so we can do follow up with the Facility the device resides in and verify the Power Cords, etc.
LM User
·4 years agoI'm not sure how Python/LM API and some of the data not showing up are related. Are you looking to use the LM API to figure out where these situations exist?