Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all 2677 articles
Browse latest View live

After running powershell script to add group and members, the members do not show up

$
0
0

I am using a powershell script to add a group and a dynamic query to add members to that group.  The group is added, but no members show up.  If it edit the group, I can see the dynamic query was created.  I edit the dynamic query and I can see that the query is accurate.  If I hit save, then the members show up now.  It seems like the script adds the config in correctly, but doesn't "apply" it.  I am using the standard script I found online that everyone else says works.  I am on 2018.4 and was wondering if there is a bug in the latest version that is causing this.  Here is my script to add just one group/members.

 

import-module SwisPowerShell

# Connect to SWIS

$hostname = <Removed>

$swis = Connect-Swis -host $hostname

$GroupName = <Removed>

#

# CREATING A NEW GROUP

#

$members = @(

    @{ Name = $GroupName; Definition = "filter:/Orion.Nodes[CustomProperties.NMS_Role=$GroupName]" }

)

 

 

$groupId = (Invoke-SwisVerb $swis "Orion.Container" "CreateContainer" @(

    # group name

    "Building - $GroupName",

 

 

    # owner, must be 'Core'

    "Core",

 

 

    # refresh frequency

    60,

 

 

    # Status rollup mode:

    # 0 = Mixed status shows warning

    # 1 = Show worst status

    # 2 = Show best status

    0,

 

 

    # group description

    "Devices that are located in building $GroupName",

 

 

    # polling enabled/disabled = true/false (in lowercase)

    "true",

 

 

    # group members 

    ([xml]@( 

       "<ArrayOfMemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>", 

       [string]($members |% { 

         "<MemberDefinitionInfo><Name>$($_.Name)</Name><Definition>$($_.Definition)</Definition></MemberDefinitionInfo>" 

         } 

       ), 

       "</ArrayOfMemberDefinitionInfo>" 

    )).DocumentElement 

  )).InnerText 


Adding multiple filters to the group member definition ?

$
0
0

We are creating Groups using REST Api and Powershell. The groups are getting created but there is a problem.@@

 

How can i include 2 conditions in a single dynamic query. I know that i can include multiple dynamic queries, but when i include multiple queries they become OR condition.

Like when i create member as this snippet

$members = @(

                    @{ Name = "$city City Node"; Definition = "filter:/Orion.Nodes[CustomProperties.City='Austin']" },

                    @{ Name = "$city Node Dependency"; Definition = "filter:/Orion.Nodes[CustomProperties.Dependency_BreakDown='Edge_Parent']" }                    

    )

 

It will create two different dynamic queries.

But i want to create a single dynamic query such as the City for the Node must be Austin AND Dependency_BreakDown must be Edge_Parent

 

Any help would be appreciated

tdannermesverrum

NCM - DOWNLOAD THE LATEST CONFIG INFO FOR ALL DEVICES

$
0
0

Hello,

I would like to be able to find a way where i can download all the latest config file for all devices of the same type. Eg latest config file for all cisco devices.

I was hoping if i can pull all the information and provide one output separating each device by IP or node name. I wanted to be able to do a monthly or weekly audit for all the config information for these devices.

For each devices i want to get the Interface name, interface description, vlans, rate limit, switchport info that is in the config file for each IP address or node name in a tabular Format.

 

Is it possible the SDK can do this?

I'm new to NCM and also the ORION SDK.tdanner

 

Something like the example below

IP Address          interface name       interface description       rate limit          switchport

10.xx.xx.xx          gigabitethernet1     Internet Link                     510000          access vlan 704   

 

 



Nodes Filter Variable Usage

$
0
0

I am trying to understand if it is possible to use variables, like ${Caption} in the Nodes Filter. I got this idea from writing custom resources for groups, similar to the ones in this thread Useful group custom SWQL query: Events on group members

 

Now I am wondering if I can use the same variables in other widgets in their filters.

Like below:

 

 

Thank you !

Created dependencies dont work using python SDK

$
0
0

I am attempting to create a dependency using the python SDK and when I run the automated script it creates the dependency but it does not make the child unreachable when the parent node is down.

Below I have the example code as well as a screenshot of the GUI showing that the child is down when the parent is down on 2 of my dependencies. Please help, I am creating close to 6800 dependencies in this project so using the GUI is simply not an option.

 

     depUri = swis.create('Orion.Dependencies',

 

        Name=name,

        ParentUri=parent['DetailsUrl'],

        ChildUri= child['DetailsUrl'],

        AutoManaged=False,

        IncludeInStatusCalculation=True,

        EngineID=0,

        Category=0,

        ParentEntityType=parent['EntityType'],

        ParentNetObjectID=parent['NodeId'],

        ChildEntityType=child['EntityType'],

        ChildNetObjectID=child['NodeId'],

        Description='Node To Node Dependency')

 

I have called solar winds about it and they suggested that I change the engine id but that did not work either.

If anyone has any ideas let me know. I really appreciate the help!

SWQL and IPAM.Subnet in Python

$
0
0

Hi,

 

Could someone explain why i get empty result when using object (IPAM.Subnet ) in Python? I'm unable to figure it out, some object's works properly but not this one.

There is no problem with this query once using SWQL Studio:

FixOrionVolume.ps1

Report for switch edge interfaces down - grouping, sorting & limiting

$
0
0

I have created a report using DQB that shows the last time that an interface on an edge switch port last changed  and the number of days. The report is grouped by the Node caption (i.e. switch host name) and sorted by 'Last Change - Interfaces'  then by 'Interface Index - Interfaces' both ascending. This works, except that I would prefer that the grouped nodes are sorted by caption - as they are named for the room they are located. We use the report to determine which patched ports can be re-patched, in a given LAN room.

 

This is not really an issue for the smaller sites, but for our main site the report is currently 82 pages, so it needs to have the report ordered. In addition, we don't need to know the duration that all of the ports have been down for, just the top 5 is enough - as the report will be run daily and we rarely need more than half a dozen to be re-patched. I have two questions:

1. How do I order the grouped nodes?

2. How can i select the top (i.e. oldest) 5 interface last change dates?

 

I have tried using SWQL (in SWQL Studio) which gives me the data (but not the number of days). However iI couldn't get the grouping to work (or hide the Interface Index). The code is:

 

SELECT

  n.Caption,

  n.Interfaces.InterfaceIndex,

  n.Interfaces.InterfaceName,

  n.Interfaces.InterfaceLastChange

 

FROM Orion.Nodes n

 

WHERE

  n.interfaces.OperStatus ='2'

  AND

  n.interfaces.InterfaceName NOT LIKE '%A%'

  AND

  n.interfaces.InterfaceAlias = ''

  AND 

  n.CustomProperties.TechnicalService = ',Edge Network,'

  AND

  n.CustomProperties.Campus LIKE 'Cant%'

 

Order By n.Caption,

         n.Interfaces.InterfaceLastChange,

         n.Interfaces.InterfaceIndex,

         n.Interfaces.InterfaceName

 

The 'All active Alerts'  has the type of layout that I want, but was too complicated for me to copy and change to my requirement.

 

Any assistance with this would be much appreciated. There are currently 171 nodes at the main site, so if the report was limited to 5 interfaces per node, this would significantly reduce the report size.

 

Thanks

David


Clone the new Map tab onto all your custom details views

$
0
0

So for those of you who run heavily customized environments you may have noticed that the new maps view only gets added to the default node details view.  I wrote this script that looks through all the views, figures out which ones could have a Maps tab and clones it in for you.  All you need to do is run the below powershell on your Orion server under a Windows account with view customizing permissions and in 2 seconds it will add the maps tab to all your custom versions of the details views.  I've tested it pretty extensively in my lab but as always take a backup of your db before you run any scripts and let me know if you get any unexpected results.

 

 

 

<#------------- CONNECT TO SWIS -------------#>

# load the snappin if it's not already loaded (step 1)

if (!(Get-PSSnapin|Where-Object { $_.Name -eq"SwisSnapin" })) {

    Add-PSSnapin"SwisSnapin"

}

 

#define host, credentials, and sql connection string

 

$hostname='localhost'

#$user = "user"

#$password = "pass"

# create a connection to the SolarWinds API

#$swis = connect-swis -host $hostname -username $user -password $password -ignoresslerrors

$swis=Connect-Swis-Hostname$hostname-Trusted

 

 

<#------------- ACTUAL SCRIPT -------------#>

 

 

# get list of all views types with a map option

$viewkeys=get-swisdata$swis"SELECT distinct ViewKey FROM Orion.Views where viewtitle = 'map' and viewkey like '%StaticSubview' "

 

foreach ($viewkeyin$viewkeys)

    {

"Working on $viewkey"

 

        #get the viewgroup to use for our parent clone

$mapviewgroup=get-swisdata$swis"select top 1 viewgroup from orion.views where viewkey = '$viewkey'"

 

        #this will be the viewid of the parent of our clones

$cloneviewparent=get-swisdata$swis"select viewid, uri from orion.views where viewgroup = '$mapviewgroup' and viewkey = '$viewkey'"

" View to clone is $($cloneviewparent.viewid)"

 

#get the correct viewkey

$viewkeytoadd=get-swisdata$swis"select viewkey from orion.views where viewgroup = '$mapviewgroup' and (viewgroupposition = 1 or viewgroupposition is null)"

 

#find any instances of that viewtype that don't already have a map

$viewgrouptoadd=get-swisdata$swis"select viewgroup, viewgroupname, viewkey, viewtype, viewgroupposition from orion.views where viewkey = '$viewkeytoadd' and viewgroup not in (select viewgroup from orion.views where viewkey like '$viewkey%')"

"Number of view groups to clone into is $($viewgrouptoadd.viewgroup.count)"

 

foreach ($vgin$viewgrouptoadd.viewgroup )

{

$vieworder=get-swisdata$swis"select viewgroupname, max(viewgroupposition)+1 as position from orion.views where viewgroup = '$vg' group by viewgroupname "

"  Cloning map to $($vieworder.viewgroupname) position $($vieworder.position)"

              

               $newview=Invoke-SwisVerb$swisOrion.ViewsCloneView @($cloneviewparent.viewid ,"Map")

"   New Viewid is $($newview.'#text')"

$newviewuri=get-swisdata$swis" select uri from orion.views where viewid = $($newview.'#text')"

"   New view Uri is $newviewuri"

Set-SwisObject$swis-Uri"$newviewuri"-Properties @{"ViewGroupName"="$($vieworder.viewgroupname)"; “ViewGroup”="$vg"; "ViewGroupPosition"="$($vieworder.position)" }

            }

 

    }

 

 

 

-Marc Netterfield

    Loop1 Systems: SolarWinds Training and Professional Services

Report for switch edge interfaces down - grouping, sorting & limiting

$
0
0

I have created a report using DQB that shows the last time that an interface on an edge switch port last changed  and the number of days. The report is grouped by the Node caption (i.e. switch host name) and sorted by 'Last Change - Interfaces'  then by 'Interface Index - Interfaces' both ascending. This works, except that I would prefer that the grouped nodes are sorted by caption - as they are named for the room they are located. We use the report to determine which patched ports can be re-patched, in a given LAN room.

 

This is not really an issue for the smaller sites, but for our main site the report is currently 82 pages, so it needs to have the report ordered. In addition, we don't need to know the duration that all of the ports have been down for, just the top 5 is enough - as the report will be run daily and we rarely need more than half a dozen to be re-patched. I have two questions:

1. How do I order the grouped nodes?

2. How can i select the top (i.e. oldest) 5 interface last change dates?

 

I have tried using SWQL (in SWQL Studio) which gives me the data (but not the number of days). However iI couldn't get the grouping to work (or hide the Interface Index). The code is:

 

SELECT

  n.Caption,

  n.Interfaces.InterfaceIndex,

  n.Interfaces.InterfaceName,

  n.Interfaces.InterfaceLastChange

 

FROM Orion.Nodes n

 

WHERE

  n.interfaces.OperStatus ='2'

  AND

  n.interfaces.InterfaceName NOT LIKE '%A%'

  AND

  n.interfaces.InterfaceAlias = ''

  AND 

  n.CustomProperties.TechnicalService = ',Edge Network,'

  AND

  n.CustomProperties.Campus LIKE 'Cant%'

 

Order By n.Caption,

         n.Interfaces.InterfaceLastChange,

         n.Interfaces.InterfaceIndex,

         n.Interfaces.InterfaceName

 

The 'All active Alerts'  has the type of layout that I want, but was too complicated for me to copy and change to my requirement.

 

Any assistance with this would be much appreciated. There are currently 171 nodes at the main site, so if the report was limited to 5 interfaces per node, this would significantly reduce the report size.

 

Thanks

David

 

Edit: I am able to sort the grouped nodes via DQB, but I would like to list the oldest 'n' interfaces - where 'n' would be say 5. That is, the 'n' would be be specified in DQB or SWQL, not interactive. 

powershell script to search node and delete

$
0
0

Please note that this script was based on this thwack message.

All I did was to change the swsql query used to get the URI and to search and delete a node via PowerShell

 

# This script will search for  node and delete it if exists

#

################################## Attention ###############################################

# You must have Orion SDK installed and set-execution policy must be set to unrestricted!!#

#Before running you must setup your hashed encrypted password using the line below.       #

###########################################################################################

 

#### Prerequisites ###

#  run the line below save credentials to be used by this script on a encrypted file

#GET-CREDENTIAL –Credential "EnterTheOrionUserNamehere” | EXPORT-CLIXML C:\Scripts\SecureCredentialsSAM.xml

## Load the SolarWinds Powershell snapin.

##Needed in order to execute the script.

##Requires the Orion SDK 2.0 installed on the machine this script is running from.

Add-PSSnapinSwisSnapin

# SolarWinds username and password section.

# It is recommended to use a local account create within SAM with only. I strongly recommend that you don't use a MS local account or domain account.

# This section allows the password to be embedded in this script. Without it, the script will not work.

#This is using the hashed encrypted password

$MyCredentials=IMPORT-CLIXMLC:\Scripts\SecureCredentialsSam.xml

$ORIONSERVERNAME= 'yourserver.domain.com'

#This is connecting to SAM to pull the info we need need with the info given

$swis=Connect-Swis-Credential$MyCredentials-host$orionservername

$nodename=read-host"Enter node Name"

$nodeuri=Get-SwisData$swis"SELECT Uri FROM Orion.Nodes WHERe NodeName LIKE '%$nodename'"

if (!$nodeuri) {Write-Host"node does not exist on SAM"}

if ($nodeuri) {

Write-Host"node exist, uri: $nodeuri"

Remove-SwisObject$swis$nodeUri

Write-Host"node has been removed"

}

How to add a node to an existing Orion group using the Python SDK

$
0
0

Hey guys! I am trying to see if anyone knows of a way to add a node to an existing group in Orion. I need this for a script I am writing to sort newly added nodes to the respective groups they belong to. Please help! Any suggestions are welcome but the answer has to be something I can code because the scope of the project is vast and will need automation using the SDK.

Thanks!

Add node with additional resources OrionSDK

$
0
0

Hi,

 

I've been exploring OrionSDK to automate some of the tasks related to SolarWinds. I looked at python-sdk and used some of the basic scripts to add, delete, and query nodes. When I add node using the script in here: orionsdk-python/add_node.py at master · solarwinds/orionsdk-python · GitHub

I get only these resources:

Is there a way to automatically add Volume utilization including some (not all) volume/memory. Likewise, is there a way to add SAM app monitoring to nodes using API? I read GitHub - solarwinds/orionsdk-python: Python client for interacting with the SolarWinds Orion API this page as well as these pages: About SWIS · solarwinds/OrionSDK Wiki · GitHub  but I'm still not able to figure out how I can do a bit more advanced tasks with API.

 

Any help is greatly appreciated!

Cannot add or edit node

$
0
0

Hi Solarwinds fellas,

 

Just wondering if you encounter issue in adding or editing nodes, when adding, it just freezes and nothing happens after SNMP test is successful. While in editing node, it will return a certain error. We have 9 pollers, this issue is happening to 3 pollers only. Already consulted Solarwinds but the last recommendation is to rebuild the server. We already followed that .Net framework version should be the same on NPM and poller and Windows patches updated, restarted Orion services, even performed system reboot as well as diagnostics and configurations wizard but still the issue is the same. Thanks in advance.

Cannot connect SWQL Studio remotely

$
0
0

Hello all,

 

I have version 2018.4 HF3. Whenever I use SWQL studio or query the information service locally from the main polling engine, it works just fine. Whenever I attempt this remotely I get a multitude of errors. I am connecting to my domain which is NAT'd to the IP of the main polling engine via SSL. I have a wildcard cert bound to the Solarwinds website. I have port 17778 allowed both inbound and outbound.

 

When I connect with SWQL studio remotely, for address I put in our main domain name. I choose "Orion (v3) over HTTPS" and use a local Orion user.

 

Upon first connection attempt, I get a SOAP error stating that the info service isn't listening.

 

I try again and get this error:

 

"An item with the same key has already been added"

 

I have a feeling it has something to do with my wildcard certificate, but I can't confirm.

 

Has anyone else seen this kind of behavior?


API discovery using subnets

$
0
0

We have Python scripts that launch a network discovery using BulkList, but we'd like to expand it to use Subnets as well. I have not found anything regarding this in my online searching, but hoping I'm just missing something obvious. Is this possible via API?

 

Here's a snippet:

 

corePluginContext = {    'BulkList': bulklist_hosts,    'Credentials': snmp_discovery_creds,    'WmiRetriesCount': 0,    'WmiRetryIntervalMiliseconds': 1000,    'IsDiscoveryForVimEnabled': False
}

 

I'm hoping it's just a matter of having something like 'Subnets': (subnets or Python variable)

 

I'm sure this must be documented somewhere, and I'm just not finding it.

 

Thanks in advance!!

Nodes Filter Variable Usage

$
0
0

I am trying to understand if it is possible to use variables, like ${Caption} in the Nodes Filter. I got this idea from writing custom resources for groups, similar to the ones in this thread Useful group custom SWQL query: Events on group members

 

Now I am wondering if I can use the same variables in other widgets in their filters.

Like below:

 

 

mesverrum, tdanner  Any insight into this?

 

Thank you!!

Question about granting rights for SolarWinds IPAM API

$
0
0

We received a request to grant Full Admin rights to the SolarWinds IPAM application for two internal accounts in my firm.  These two accounts would be used for SolarWinds API calls to do the following:

 

create, list, and delete subnets within supernet in Solarwinds IPAM via API call to the application

 

Unfortunately, I do not know anything about the SolarWinds APIs, so I do not know how to do this -- nor if Full Admin rights are truly needed to perform the actions listed above.  I read the Orion SDK documentation but I still do not understand. 

 

Bottom line, I very much would appreciate guidance concerning the rights issue and how to go about it.  Thanks!!! 

SWQL: Linking SRM FileShare to Volume to Node

$
0
0

Hi,

I am trying to create a query to show the Node to Volume to Fileshare.  Can someone help share how to obtain the mapping from the Node to the Fileshares in SRM?

 

When I run this query I'm not getting the correct tables; am I not liking the correct 'srm.fileshares.volumeID = n.volumes.volumeID ??

 

SELECT top 2000 n.NodeID, n.Caption, n.Volumes.VolumeID as [Node VolumeID], n.volumes.DisplayName as [Volume], fs.ID as [FileShare ID], fs.DisplayName as [Fileshare Name], fs.Path as [FileShare Path], fs.Quota as [Fileshare Quota], fs.free as [FileShare Free], fs.Used as [FileShare Used]

FROM Orion.nodes n

 

 

left join orion.srm.FileShares FS on FS.VolumeID = n.Volumes.VolumeID

 

Definition of "Status" field in "Orion.Nodes" table

$
0
0


Dear Sir or Madam -

 

Would you please document the possible values that may appear in the  "Status"  field of the  "Orion.Nodes"  table ?

 

I know that value "1"  means "up"  and value  "2"  means  "down".   What other values may appear and what do they mean ?

 

Thank you.

 

James Troy

Viewing all 2677 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>