Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce97eab
Initial commit
jamesdreid May 19, 2021
8e27522
Updated action to include the option to pass an optional list of poll…
jamesdreid May 19, 2021
2fe84bc
Merge branch 'StackStorm-Exchange:master' into master
jamesdreid May 19, 2021
35dcc83
Bumped version to reflect addition of new action
jamesdreid May 19, 2021
d49f044
Bumped version to reflect addition of new action
jamesdreid May 19, 2021
b0f8012
Updated text to include description of new action
jamesdreid May 19, 2021
f325b6f
Merge remote-tracking branch 'origin/master'
jamesdreid May 19, 2021
b4f898d
Bumped version to reflect addition of new action
jamesdreid May 19, 2021
9af685d
Bumped version to reflect addition of new action
jamesdreid May 19, 2021
c2dce09
Bumped version to reflect addition of new action
jamesdreid May 19, 2021
b5445c9
Corrected typo
jamesdreid May 19, 2021
008388d
Updated description info
jamesdreid May 19, 2021
09f27da
Added logic to complete lookups for poller ID values, checking to see…
jamesdreid May 19, 2021
cf42eec
Updated parameter name to reflect what is in the code
jamesdreid May 19, 2021
ac2cc24
Updated results dict with correct format
jamesdreid May 19, 2021
a1e1a3b
Fixed spacing on query
jamesdreid May 19, 2021
6171045
Added literal quotes to query string
jamesdreid May 19, 2021
89e11e3
Updated reference to query result data
jamesdreid May 19, 2021
b2a89ca
Removed str() on poller ID data
jamesdreid May 19, 2021
acefd77
Added log data
jamesdreid May 19, 2021
91fc456
Updated query output to select first list entry
jamesdreid May 19, 2021
2a661c4
Added more logging
jamesdreid May 19, 2021
6fb4a99
Updated log syntax
jamesdreid May 19, 2021
9346650
Refactored action to run the query for existing pollers first and the…
jamesdreid May 20, 2021
c428681
Correct source data for log entry
jamesdreid May 20, 2021
8f40f04
Corrected logic for query returning multiple results
jamesdreid May 20, 2021
93614f0
Moved if statement below poller query check to ensure custom poller d…
jamesdreid May 20, 2021
121e75f
Updated logging
jamesdreid May 20, 2021
b71245a
Added note about changes to node_create_snmpv3 action
jamesdreid May 20, 2021
aff4eb2
Corrected typo
jamesdreid May 20, 2021
a1b5576
Corrected typo
jamesdreid Jun 9, 2021
7742903
Corrected typo
jamesdreid Jun 9, 2021
cd018b5
Updated password YAML to make the values secret
jamesdreid Jun 16, 2021
0dcffe8
Added cipher options to auth protocol list
jamesdreid May 18, 2023
749145f
Updated enumerated list options to include high strength ciphers
jamesdreid Jan 25, 2024
e73fb37
Merge branch 'master' of https://github.com/jamesdreid/stackstorm-orion
jamesdreid Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@ ENV/

# Rope project settings
.ropeproject
/.idea/.gitignore
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/stackstorm-orion.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.0.3

- Added Action

- add_custom_poller_to_node

- Updated node_create_snmpv3 action to include the option to specify which default pollers to enable when adding the Node

## 1.0.2

- Fixed small linting error and pushing a new version.
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,29 @@ snmp_internal: "SNMP community to use if internal specified"

## Actions

* `add_custom_pollers_to_node` - Add a list of custom (Universal Device) pollers to a Node
* `add_node_to_ncm` - Add an Orion Node to NCM
* `drain_poller` - Drain nodes from one Orion poller to another.
* `get_discovery_progress` - Get the progress of an SolarWinds Orion Discovery.
* `list_node_custom_properties` - List the custom properties for a SolarWinds Orion nodes
* `list_nodes_by_poller` - List the nodes on a SolarWinds Orion poller
* `list_nodes_by_status` - List the nodes by status
* `list_sdk_verb_args` - List all the arguments for a entity and verb that can be invoked via SolarWinds Orion.
* `list_sdk_verb_args` - List all the arguments for an entity and verb that can be invoked via SolarWinds Orion.
* `list_sdk_verbs` - List all the verbs that can be invoked via SolarWinds Orion
* `ncm_config_download` - Download config(s) from SolarWinds NCM Orion module.
* `ncm_execute_script` - Execute an script on an Orion NCM Node.
* `node_create` - Create an node in SolarWinds Orion.
* `node_create_snmpv3` - Create an node in SolarWinds Orion with SNMPv3.
* `node_create` - Create a node in SolarWinds Orion.
* `node_create_snmpv3` - Create a node in SolarWinds Orion with SNMPv3.
* `node_discover_and_add_interfaces` - Discover and add Interfaces for a SolarWinds Orion node.
* `node_discover_and_add_interfaces_by_name_and_type` - Discover and add Interfaces for a SolarWinds Orion node based upon the ifName, ifType, and (optional) ifAdminStatus
* `node_remanage` - Re-manage a SolarWinds Orion nodes
* `node_status` - Query SolarWinds Orion for a node's status (i.e. Up/Down)
* `node_unmanage` - Unmanage an SolarWinds Orion node
* `node_unmanage` - Unmanage a SolarWinds Orion node
* `nodes_pollnow` - Force multiple polls of a list of SolarWinds Orion nodes.
* `query` - Execute generic SWQL queries.
* `start_discovery` - Create a discovery profile in SolarWinds Orion.
* `update_interface_custom_properties` - Update an the custom properties of an interface on an Orion Node
* `update_interface_properties` - Update an the "standard" properties (e.g. Unpluggable) on an interface of an Orion Nodes
* `update_interface_custom_properties` - Update the custom properties of an interface on an Orion Node
* `update_interface_properties` - Update the "standard" properties (e.g. Unpluggable) on an interface of an Orion Nodes
* `update_node_custom_properties` - Update an Orion Nodes custom properties
* `update_node_poller` - Update an Orion Nodes poller

Expand Down
110 changes: 110 additions & 0 deletions actions/add_custom_pollers_to_node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from lib.actions import OrionBaseAction
from lib.utils import send_user_error


class AddCustomPollersToNode(OrionBaseAction):
def run(self, node, custompollers):
"""
Add list of SNMP Pollers to Node

Args:
- node: The caption in Orion of the node to poll.
- custompollers: The list of Orion Custom SNMP pollers to add to the Node

Returns
- List of custom pollers that were added to the Node, a list of Custom pollers that were
already assigned to the Node, and a list of Custom pollers that were not found in the system

Raises:
- ValueError: When a node is not found.

"""
# Create empty results dict to hold action output data
results = {'added': [], 'existing': [], 'not_found': []}

# Establish a connection to the Orion Server
self.connect()

# Find the Node in the system
orion_node = self.get_node(node)

if not orion_node.npm:
error_msg = "Node not found"
send_user_error(error_msg)
raise ValueError(error_msg)

# Create a query string needed to pull the custom poller data assigned to the Node
# from the Orion DB

self.logger.info('Querying list of custom pollers already configured on Node...')

nodequery = 'SELECT NodeID, CustomPollerID FROM Orion.NPM.CustomPollerAssignmentOnNode ' \
'WHERE NodeID=' + str(orion_node.npm_id)

# Execute the query for the custom Node pollers
nodeassignedpollers = self.query(nodequery)

# Create an empty list of CustomPollerIDs used to hold the ID for each of the pollers
# passed as input to the action

custompollerids = []

# Loop through all the pollers provided as input to the action and query the Orion DB
# for the CustomPollerID.

for entry in custompollers:
pollerquery = 'SELECT CustomPollerID, UniqueName FROM Orion.NPM.CustomPollers where ' \
'UniqueName=\'' + str(entry) + '\''
entrypollerid = self.query(pollerquery)

# Check if the Custom Poller query returned exactly 1 result as expected
if len(entrypollerid['results']) == 1:
# Check if Custom Poller ID is included in the list returned from the existing
# poller query
if any(element for element in nodeassignedpollers['results'] if
element['CustomPollerID'] == entrypollerid['results'][0]['CustomPollerID']):
self.logger.info('Custom Poller {} already assigned to Node. Skipping...'
''.format(entry))
# Update results data with matching poller name
results['existing'].append(entry)
else:
# Add Custom Poller ID to list if not found to have already been assigned to the
# Node
custompollerids.append(entrypollerid['results'][0])

# Check if the Custom poller query returned either 0 or more than the expected 1
if len(entrypollerid['results']) > 1 or len(entrypollerid['results']) == 0:
self.logger.info('Custom poller {} not found in Orion DB or the text query returned'
' multiple entries and will be ignored...'.format(entry))
results['not_found'].append(entry)

# After validating all the pollers have not already been assigned to the Node, loop
# through all the entries and assign them to the Node

for entry in custompollerids:
entrydata = {
"NodeID": str(orion_node.npm_id),
"CustomPollerID": entry['CustomPollerID']
}
response = self.create('Orion.NPM.CustomPollerAssignmentOnNode', **entrydata)
self.logger.info('Custom poller {} successfully assigned to Node: {}'.format(
entry['UniqueName'], response))
# Update results data with matching poller name
results['added'].append(entry['UniqueName'])
return results

17 changes: 17 additions & 0 deletions actions/add_custom_pollers_to_node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
description: "Add custom NPM Universal Device Pollers to a Node in SolarWinds"
enabled: true
entry_point: 'add_custom_pollers_to_node.py'
name: "add_custom_pollers_to_node"
pack: "orion"
runner_type: "python-script"

parameters:
node:
type: "string"
description: The Node which will have the custom pollers assigned to it
required: true
custompollers:
type: "array"
description: List of custom (Universal Device) pollers to be added to Node
required: true
9 changes: 8 additions & 1 deletion actions/node_create_snmpv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def run(self,
privacy_password,
auth_protocol,
auth_password,
status):
status,
additional_pollers):
"""
Create an node in Orion.
"""
Expand Down Expand Up @@ -117,6 +118,12 @@ def run(self,
pollers_to_add['N.ResponseTime.ICMP.Native'] = False
pollers_to_add['N.ResponseTime.SNMP.Native'] = True

# Check to see if any additional pollers were passed as input
if additional_pollers:
# Enable all the pollers passed as input
for entry in additional_pollers:
pollers_to_add[entry] = True

pollers = []
for p in pollers_to_add:
pollers.append({
Expand Down
10 changes: 9 additions & 1 deletion actions/node_create_snmpv3.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: "Create an node using SNMPv3 in Solarwinds Orion."
description: "Create an node using SNMPv3 in SolarWinds Orion."
enabled: true
entry_point: 'node_create_snmpv3.py'
name: "node_create_snmpv3"
Expand Down Expand Up @@ -35,17 +35,21 @@ parameters:
privacy_password:
type: "string"
required: true
secret: true
description: "The SNMPv3 Privacy password used to poll SNMP from remote device."
auth_protocol:
type: "string"
description: "The SNMPv3 Authentication protocol used for SNMP polling."
enum:
- "MD5"
- "SHA1"
- "SHA256"
- "SHA512"
default: "SHA1"
auth_password:
type: "string"
required: true
secret: true
description: "The SNMPv3 Authentication password used to poll SNMP from remote device."
status:
type: "string"
Expand All @@ -54,3 +58,7 @@ parameters:
- "icmp"
description: "Protocol to use for Status and Response Time checks."
default: "snmp"
additional_pollers:
type: "array"
required: false
description: "List of Orion pollers to enable when creating Node. ** Must be specified using the correct Orion DB naming syntax."
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords:
- ncm
- npm
- monitoring
version: 1.0.2
version: 1.0.3
python_versions:
- "3"
author: Encore Technologies
Expand Down