Closed Andyjb8 closed 4 months ago
Absolutely! Those are likely all Pollers, Topology: Layer 3 for sure is and there is an example for that poller specifically in the Examples of the orion_node_poller module. To find the names of the pollers, I would manually add a node, then query the Orion.Pollers table for that node.
This is exactly a candidate for a Role also, which I started a discussion on, so its easier for people to add nodes without having to look up that type of stuff.
Ok, yes, I am able to add the "Topology: Layer 3" with the orion_node_poller module using "N.Topology_layer3.SNMP.ipNetToMedia" poller name that I got from the module documentation example. The "N.Memory.SNMP.NetSnmpReal" also from the documentation worked for CPU&Memory. However how do I find the name for the Routing poller? Also other network nodes that I have include "Hardware Health Sensors" that I want to monitor and I don't know the poller name for that either.
Here's the query I use to find the poller names from the Orion database in SWQL Studio. You can do the query before then after you manually check the box in the web interface to see which one gets added on the back end to be 100% sure you have the right one.
select nodes.caption, pollers.PollerType
from orion.Nodes as nodes
join (SELECT NetObjectID, PollerType from Orion.Pollers) as pollers on nodes.nodeid = pollers.NetObjectID
where nodes.caption = 'YOUR_NODE_NAME_HERE'
the routers we use don't have the OSPF neighbors, but the other two looks like could be: N.Routing.SNMP.Ipv4CidrRoutingTable N.RoutingNeighbor.SNMP.BGP
Ok, I was created a query python script:
from orionsdk import SwisClient
import getpass
import os
# Get the current system username
username = getpass.getuser()
# Prompt for server details
server = input("Enter your Orion server (e.g., 'localhost'): ")
# Inform the user of the username being used
print(f"Using the system username: {username}")
# Prompt for password
password = getpass.getpass("Enter your password: ")
# Prompt for the node name to search for
node_name = input("Enter the node name you are looking for: ")
# Initialize the SWIS client
swis = SwisClient(server, username, password)
# SWQL Query with the user input for node name
query = f"""
select nodes.caption, pollers.PollerType
from orion.Nodes as nodes
join (SELECT NetObjectID, PollerType from Orion.Pollers) as pollers on nodes.nodeid = pollers.NetObjectID
where nodes.caption = '{node_name}'
"""
# Execute the query
results = swis.query(query)
# Print the results
for row in results['results']:
print(row)
I get the following poller list as output:
{'caption': 'FW-01', 'PollerType': 'N.Status.ICMP.Native'}
{'caption': 'FW-01', 'PollerType': 'N.Status.SNMP.Native'}
{'caption': 'FW-01', 'PollerType': 'N.ResponseTime.ICMP.Native'}
{'caption': 'FW-01', 'PollerType': 'N.ResponseTime.SNMP.Native'}
{'caption': 'FW-01', 'PollerType': 'N.Details.SNMP.Generic'}
{'caption': 'FW-01', 'PollerType': 'N.Uptime.SNMP.Generic'}
{'caption': 'FW-01', 'PollerType': 'N.Routing.SNMP.Ipv4CidrRoutingTable'}
{'caption': 'FW-01', 'PollerType': 'N.Topology_Layer3.SNMP.ipNetToMedia'}
{'caption': 'FW-01', 'PollerType': 'N.Memory.SNMP.NetSnmpReal'}
I tested with the following playbook task:
tasks:
- name: Add Poller
solarwinds.orion.orion_node_poller:
<<: *solarwinds_info
name: "{{ inventory_hostname }}"
state: present
poller: "{{ item.name }}"
enabled: "{{ item.enabled }}"
loop:
- name: N.Status.SNMP.Native
enabled: true
- name: N.ResponseTime.SNMP.Native
enabled: true
- name: N.Routing.SNMP.Ipv4CidrRoutingTable
enabled: true
- name: N.Topology_Layer3.SNMP.ipNetToMedia
enabled: true
- name: N.Status.ICMP.Native
enabled: true
- name: N.ResponseTime.ICMP.Native
enabled: true
- name: N.Details.SNMP.Generic
enabled: true
- name: N.Uptime.SNMP.Generic
enabled: true
And here are the playbook output/results:
TASK [Add Poller] *****************************************************************************************************
Friday 10 November 2023 16:55:54 +0000 (0:00:00.077) 0:00:00.077 *******
changed: [FW-01 -> localhost] => (item={'name': 'N.Status.SNMP.Native', 'enabled': True})
changed: [FW-01 -> localhost] => (item={'name': 'N.ResponseTime.SNMP.Native', 'enabled': True})
changed: [FW-01 -> localhost] => (item={'name': 'N.Routing.SNMP.Ipv4CidrRoutingTable', 'enabled': True})
changed: [FW-01 -> localhost] => (item={'name': 'N.Topology_Layer3.SNMP.ipNetToMedia', 'enabled': True})
ok: [FW-01 -> localhost] => (item={'name': 'N.Status.ICMP.Native', 'enabled': True})
ok: [FW-01 -> localhost] => (item={'name': 'N.ResponseTime.ICMP.Native', 'enabled': True})
ok: [FW-01 -> localhost] => (item={'name': 'N.Details.SNMP.Generic', 'enabled': True})
ok: [FW-01 -> localhost] => (item={'name': 'N.Uptime.SNMP.Generic', 'enabled': True})
But these two were the only ones that seem to make noticeable changes.
changed: [FW-01 -> localhost] => (item={'name': 'N.Routing.SNMP.Ipv4CidrRoutingTable', 'enabled': True})
changed: [FW-01 -> localhost] => (item={'name': 'N.Topology_Layer3.SNMP.ipNetToMedia', 'enabled': True})
it only added the monitoring of the routing and Topolgy Layer 3. It also changed routing and response time to SNMP, but I actually want to leave that as ICMP.
However when I added these two that were not in my original query list, but I ran across somewhere else, it added monitoring for CPU and Memory.
I still haven't figured out how to add the "Hardware Health Sensors".
Oh right, on the SNMP status and reponse time, Solarwinds adds those pollers to nodes when you create them, but it sets them as disabled. If you modify your query to also select Enabled from Orion.Pollers, you can get which ones are disabled from your query.
Do you think this process is difficult enough that there should be an info module orion_node_pollers_info? Then it would be possible to get that info in a playbook or role if needed.
- name: Get existing pollers for an existing node
solariwnds.orion.orion_node_poller_info:
- name: Add pollers to newly created node
solarwinds.orion.orion_node_poller:
I just need to be able to enable monitoring on the items on the "List Resources" for nodes that I add, so if creating a module to get the available pollers and then using that list to enable them is the best way to do that, then that might be the way to go.
Released 1.3.0 with a module "orion_node_poller_info" which can get a list of assigned pollers from an existing node and their enabled/disabled status. Hopefully this can help others get info from that query I shared, even though we couldn't 100% solve your questions for that one custom poller you have. I'll leave that other issue open for now.
Is there a way I can select monitoring for Routing, CPU & Memory and Topology via Ansible/Orion API?
What I am trying to do is automate device onboarding, so that once a new node is connected to network, Ansible can configure SNMPv3 and then add it to Solarwinds with all the appropriate monitoring.