We are automating the hydration of assets in Orion, and after adding a node, we know how to discover the interfaces, but how do we programmatically discover the non-interface properties and enable them like the sample below?
Thanks,
Scott F.
We are automating the hydration of assets in Orion, and after adding a node, we know how to discover the interfaces, but how do we programmatically discover the non-interface properties and enable them like the sample below?
Thanks,
Scott F.
for all except hardware health you add the right set of pollers for the device.
$swis->Create("Orion.Pollers", {
'PollerType'=>$poller,
'NetObject'=>"N:$node",
'NetObjectType'=>'N',
'NetObjectID'=>$node
});
Here's a list of the (current) pollers.
N.MulticastRouting.SNMP.MulticastRoutingTable
N.Routing.SNMP.Ipv4CidrRoutingTable
N.Routing.SNMP.Ipv4RoutingTable
N.Routing.SNMP.Ipv6RoutingTable
N.RoutingNeighbor.SNMP.BGP
N.RoutingNeighbor.SNMP.OSPF
N.RoutingNeighbor.SNMP.OSPFv3
N.RoutingNeighbor.SNMP.OSPFv3Juniper
N.Topology_CDP.SNMP.cdpCacheTable
N.Topology_Layer2.SNMP.Dot1dTpFdb
N.Topology_Layer2.SNMP.Dot1dTpFdbNoVLANs
N.Topology_Layer2.SNMP.Dot1qTpFdbNoVLANs
N.Topology_Layer3.SNMP.ipNetToMedia
N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter
N.Topology_Layer3_IpRouting.SNMP.rolesRouter
N.Topology_LLDP.SNMP.lldpRemoteSystemsData
N.Topology_PortsMap.SNMP.Dot1dBase
N.Topology_PortsMap.SNMP.Dot1dBaseNoVLANs
N.Topology_PortsMap.SNMP.Dot1qVlanEgressPorts
N.Topology_PortsMap.SNMP.JuniperExVlan
N.Topology_STP.SNMP.Dot1dStp
N.Topology_Vlans.SNMP.Dot1q
N.Topology_Vlans.SNMP.JuniperExVlan
N.Topology_Vlans.SNMP.VmMembershipSummary
N.Topology_Vlans.SNMP.VtpVlan
N.VRFRouting.SNMP.JuniperObsolete
N.VRFRouting.SNMP.JuniperStandard
N.VRFRouting.SNMP.MPLSVPNObsolete
N.VRFRouting.SNMP.MPLSVPNStandard
[I haven't found a way to determine which pollers should be added, I turn up what I need for a node, then look to see what pollers got added]
Wow, do I have to add each one of those in a separate call?
Also, can you show me what that looks like as a REST call? (What the json body/data needs to look like.)
Actually, I went back to the PDF docs and I see body data that looks like this: {"PollerType":"hi from curl 2", "NetObject":"N:123", "NetObjectType":"N", "NetObjectID":123} Although, "hi from curl 2" doesn't make much sense if I'm trying to specify one of the pollers in the list. Can I assume that "$poller" in your example somehow represents, for instance, "N.Routing.SNMP.Ipv4CidrRoutingTable" ? And if so, is that the string that goes in there, or... ?
Oh, also, in the documentation it appears that if my poller addition is successful, I get back the swis:// uri of the poller along with it's ID number. Is that correct? And if my call fails, what should I be looking for as a return value?
Thanks again,
Scott Fraley
[I use perl + SWIS because the API just works, I've been writing perl code for over 20 years, ]
yes, separate calls. :-(
$poller is one of the strings
I've never had AddPoller fail -- it feels like there is no error checking on the server-side for Create operations given a valid nodeid.
I seem to remember that it will add duplicate pollers, and pollers that do not actually exist.
In my code, this is called immediately after Creating a Node, so I know that there are no node-pollers assigned yet.
I have a chunk of code that matches the OID of the device, and adds the pollers to it.
e.g.
if (index($oid,"1.3.6.1.4.1.2636")==0) {
&add_poller($AddedNode,"N.Cpu.SNMP.JuniperJunOS");
&add_poller($AddedNode,"N.Memory.SNMP.JuniperJunOS");
&add_poller($AddedNode,'N.Topology_Layer3.SNMP.ipNetToMedia') if (index($oid,'1.3.6.1.4.1.2636.1.1.1.2.18')==0);
&add_poller($AddedNode,'N.Topology_Layer3.SNMP.ipNetToMedia') if (index($oid,'1.3.6.1.4.1.2636.1.1.1.2.24')==0);
&add_poller($AddedNode,'N.Topology_Layer3.SNMP.ipNetToMedia') if (index($oid,'1.3.6.1.4.1.2636.1.1.1.2.25')==0);
&add_poller($AddedNode,'N.Topology_Layer3.SNMP.ipNetToMedia') if (index($oid,'1.3.6.1.4.1.2636.1.1.1.2.57')==0);
};
In another universe I'd pass an array of pollers to the system and it would do that for me, or have an asynchronous API where I just stream requests a-la-SNMP and match the replies up with them...
We use something like this SQL Query to programmatically turn off pollers we do not want to use. We flag devices to apply this script against based on their membership in a group that uses a dynamic query. You could use this to do the opposite I think. However, if the node/pollers have not been discovered yet then you will have to work with the discovered nodes. I am just beginning to look at the schema for the discovery tables, so if you have gain insights into how they work, please post. thanks
UPDATE Pollers SET Enabled = 0
WHERE (NetObjectType = 'N') AND
(PollerType LIKE '%Routing%'
OR PollerType LIKE '%Topology%'
OR PollerType LIKE '%VRFRouting%')
AND (Enabled = 1)
AND
(EXISTS (SELECT S.EntityID
FROM [ContainerMemberSnapshots] S
JOIN [Containers] C ON S.ContainerID = C.ContainerID
WHERE S.EntityDisplayName = 'Node' AND C.IsDeleted = '0' AND S.ContainerID = '8'))
AND
(NetObjectID IN (SELECT S.EntityID
FROM [ContainerMemberSnapshots] S
JOIN [Containers] C ON S.ContainerID = C.ContainerID
WHERE S.EntityDisplayName = 'Node' AND C.IsDeleted = '0' AND S.ContainerID = '8'))
After talking with the boss, the question we're really trying to ask is, when I hit the List Resources button from the Management pane of a Node Details screen, what's going on in the background, and more importantly, do we have the ability, via the SDK/API, to do the same thing(s) ?
For instance, we don't want to add 58+ pollers to any one device just because we don't know which ones go with said device. It seems like List Resources knows how to get just those interfaces/VLANs/etc. that go with the selected Node/device.
Thanks!
This is a SQL Query. We have only used the SDK in limited instances at this point but are trying to migrate to it.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.