I was hoping to get some clarification on some behavior I'm seeing when attempting to add an interface via New-SwisObject.
$newIntUri = New-SwisObject $swis -EntityType "Orion.NPM.Interfaces" -Properties $newIntProps
Here's what the newIntProps looks like:
$newIntProps = @{
NodeID=$NodeID;
InterfaceIndex=[int]$interfaceToAdd.InterfaceIndex;
Status=0;
InterfaceType=$interfaceToAdd.InterfaceType;
InterfaceTypeName=($lookup_interfaceType | Where InterfaceType -eq $interfaceToAdd.InterfaceType).InterfaceTypeName;
InterfaceTypeDescription=($lookup_interfaceType | Where InterfaceType -eq $interfaceToAdd.InterfaceType).InterfaceTypeDescription;
Icon=$([string]$interfaceToAdd.InterfaceType + '.gif');
InterfaceName=$interfaceToAdd.InterfaceName;
ObjectSubType="SNMP";
PollInterval=120;
StatCollection=9;
RediscoveryInterval=30;
NextRediscovery=[DateTime]::UtcNow;
} The $volumeToAdd is coming from the Orion.NPM.DiscoveredInterfaces table, so it's returning the following properties:
- ProfileID, DiscoveredNodeID, InterfaceIndex, InterfaceType, InterfaceAlias, InterfaceName, OperStatus, AdminStatus
I joined it to the pollers table to determine the pollers that would need to be used as well.
foreach ($pollerType in $interfaceToAdd.pollers.PollerType) {
$poller = @{
PollerType=$pollerType;
NetObject="I:"+$IntProps["InterfaceID"];
NetObjectType="I";
NetObjectID=$IntProps["InterfaceID"];
}
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller
}As far as I can tell, it's working (though there's some weird behavior if you mouse over the interface in the manage nodes page before a rediscovery completes, it says 'Error communicating with Orion server'. It makes sense, since the properties it's trying to return on that pop-up aren't yet populated, though it would be nice if they just showed something like: Transmit bps: {Pending} (or something along those lines - a graceful fail, rather than an error). Maybe something for the UI team?
Another other odd thing I noticed was that, in the Orion.NPM.Interfaces table, the properties for Unpluggable and CustomBandwidth show NULL, whereas, when I add the interface using the UI, those show as 'False'. Anything I need to do differently to account for that? Not sure if that has an impact anywhere else or not.
I was hoping to get a list of all possible values for InterfaceType, InterfaceTypeName, and InterfaceTypeDescription. I created my lookup_interfaceType object from our 8000 interfaces with a SELECT DISTINCT, so I think I got most of what would apply to us, but I'm guessing that's missing some stuff and in the future, our script may add an interface without that and cause issues. It's used in the creation of the interface to map the InterfaceType to InterfaceTypeName and InterfaceTypeDescription.
Lastly, I'm not sure if this exists, but is there a place that might document all available properties for the newIntProps, newNodeProps, newVolProps?
Thanks in advance for assistance