Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all 3719 articles
Browse latest View live

Receiving 403 Forbidden When Using REST API In C#

$
0
0

Receiving 403 Forbidden When Using REST API In C#

 

I was referred to the following C# example of using REST APIs Sample code: OrionSDK/Program.cs at master · solarwinds/OrionSDK · GitHub

 

This looked very promising and I have attempted to implement it for my process. However, all requests are failing with a 403 Forbidden error.

 

I have verified if I used invalid credentials I get a 401 unauthorized error so it appears to be authenticating my request, but I can't get results for a simple query operation.

 

I am basically using the code from the example but I am only calling the query action with the following simple query string and no arguments:

conststring query = @"SELECT nodeid, caption FROM Orion.Nodes";

 

I have output the JSON string created before it is passed to the request and it looks like this:

{"parameters":null,"query":"SELECT nodeid, caption FROM Orion.Nodes"}

 

Is there something wrong with the JSON or my query request?


Python Orion SDK - Q: HowTo discover new device into NPM BUT disabling some standard pollers

$
0
0

I am busy to rewrite my scripts with Python and to move away from SOAP/Perl.

We found some information on the web that advise to add new devices into the auto discovery. As result that each discovered node enabled some resources that I don't want to have like:

* Hardware Health Hardware

* EnergyWise

* VLAN

* Topology: Layer 2

* Topology: Layer 3

 

The idea was to create a profile/template which disabled those items but so far I found was to create/use a template for interfaces and interface types.

 

When the discovery has completed then I found out that this is added into the table [Solarwinds_Dev].[dbo].[Pollers]

Columns : [PollerID],[PollerType],[NetObject],[NetObjectType],[NetObjectID],[Enabled]

The column NetObjectID is actualy the NodeID of our device.

PollerIDPollerType                          NetObject NetObjectType   NetObjectID Enabled

22065   N.ResponseTime.ICMP.Native          N:588     N               588         1

22066   N.Status.ICMP.Native                N:588     N               588         1

22067   N.ResponseTime.SNMP.Native          N:588     N               588         0

22068   N.Status.SNMP.Native                N:588     N               588         0

22069   N.Details.SNMP.Generic              N:588     N               588         1

22070   N.Uptime.SNMP.Generi                N:588     N               588         1

22071   N.Cpu.SNMP.CiscoGen3                N:588     N               588         1

22072   N.Memory.SNMP.CiscoGen3             N:588     N               588         1

22073   N.Topology_Vlans.SNMP.VtpVlan       N:588     N               588         1

22074   N.Topology_Layer2.SNMP.Dot1dTpFdb   N:588     N               588         1

22075   N.Topology_CDP.SNMP.cdpCacheTable   N:588     N               588         1

22076   N.Topology_LLDP.SNMP.lldpRemoteSystemsData  N:588   N         588         1

22077   N.Topology_PortsMap.SNMP.Dot1dBase  N:588     N               588         1

22078   N.Topology_Layer3.SNMP.ipNetToMedia N:588     N               588         1

22079   N.EnergyWise.SNMP.Cisco             N:588     N               588         1

22080   N.SwitchStack.SNMP.Cisco            N:588     N               588         1

22081   N.HardwareHealthMonitoring.SNMP.NPM.Cisco   N:588   N         588         1

 

On THWACK I have found a solution to create pollers for a Node but this creates additional entries on the table [Solarwinds_Dev].[dbo].[Pollers] for that Node.

It doesn't update or delete unselected PollerTypes but only adding the same pollers with a different Enabled value.

This creates duplicate PollerTypes for the same Node but with a different Enabled value.

As result it keeps using the old settings.

 

Updating entries directly on the database is something I don't like to do but I did a test.

Change the entries on the Enabled column to value seems to work for :

 

                    : N.Topology_CDP.SNMP.cdpCacheTable

                    : N.Topology_LLDP.SNMP.lldpRemoteSystemsData

Topology Layer 3    : N.Topology_Layer3.SNMP.ipNetToMedia

Topology Layer 2    : N.Topology_Layer2.SNMP.Dot1dTpFdb

EnergyWise          : PollerType N.EnergyWise.SNMP.Cisco

 

But it doesn't seems to work for which I conclude that there some other hidden entries somewhere on the database.

Hardware Health Hardware    : N.HardwareHealthMonitoring.SNMP.NPM.Cisco

VLAN                        : N.Topology_Vlans.SNMP.VtpVlan

 

 

##### script discover.py #####

import sys

import time

from orionsdk import SwisClient

from pprint import pprint

 

def solarwindsDiscovery(hosts):

    # Init SWIS API

    npm_server = 'solarwinds-dev.example.com'

    username = 'scripting'

    password = 'somesecretpassword'

 

    verify = False

    if not verify:

        from requests.packages.urllib3.exceptions import InsecureRequestWarning

        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

    swis = SwisClient(npm_server, username, password)

 

    bulkList_hosts = []

    for host in hosts:

        bulkList_hosts.append({'Address': host})

   

    snmpv3_credential_id = 12

    snmpv2_credential_id = 6

    snmpv2_oldcredential_id = 3

 

    # make Discovery Profile

    orion_engine_id = 2

    corePluginContext = {

        'BulkList':  bulkList_hosts,

        'Credentials': [

            {

                'CredentialID': snmpv3_credential_id,

                'Order': 1

            },

            {

                'CredentialID': snmpv2_credential_id,

                'Order': 2

            },

            {

                'CredentialID': snmpv2_oldcredential_id,

                'Order': 3

            }

        ],

        'WmiRetriesCount': 0,

        'WmiRetryIntervalMiliseconds': 1000,

        'IsDiscoveryForVimEnabled': False

    }

    corePluginConfig = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration', corePluginContext)

 

    interfacesPluginContext = {

        'AutoImportStatus': [],  # Also available: Down, Shutdown, Up

        'AutoImportVlanPortTypes': ['Trunk', 'Access', 'Unknown'],

        'AutoImportVirtualTypes': ['Physical', 'Virtual'],  # Also available: Unknown

        'AutoImportExpressionFilter':

                                   [{'Prop': 'Descr', 'Op': '!Any', 'Val': 'null'},

                                   {'Prop': 'Descr', 'Op': '!Any', 'Val': 'vlan'},

                                   {'Prop': 'Descr', 'Op': '!Any', 'Val': 'loopback'},

                                   {'Prop': 'Alias', 'Op': '!Regex', 'Val': '^$'},

                                   {'Prop': 'Name', 'Op': '!Regex', 'Val': '^t1'}]

        # Available values for Prop: Type, Name, Descr, Alias, Node, All, Vlan

        # Available values for Op: All, !All, Any, !Any, Equals, !Equals, Regex, !Regex, #All, !#All, #Any, !#Any

        # Val is the literal value to compare Prop to

        # If more than one expression is provided, the interface must match all of the expressions to be imported

        # To specify more than one number or string for the All and Any operators (including variants), separate them by spaces

    }

    interfacesPluginConfig = swis.invoke('Orion.NPM.Interfaces', 'CreateInterfacesPluginConfiguration', interfacesPluginContext)

 

    discoveryProfile = {

        'Name': 'discover_one_node.py',

        'EngineID': orion_engine_id,

        'JobTimeoutSeconds': 3600,

        'SearchTimeoutMiliseconds': 5000,

        'SnmpTimeoutMiliseconds': 5000,

        'SnmpRetries': 2,

        'RepeatIntervalMiliseconds': 1800,

        'SnmpPort': 161,

        'HopCount': 0,

        'PreferredSnmpVersion': 'SNMP3',

        'DisableIcmp': False,

        'ImportDownInterface': False,

        'ImportUpInterface': False,

        'ImportShutdownInterface': False,

        'AllowDuplicateNodes': False,

        'IsAutoImport': True,

        #  'IsHidden" set to True will remove the discovery profile after it completes

        'IsHidden': True,

        'PluginConfigurations': [{'PluginConfigurationItem': corePluginConfig}, {'PluginConfigurationItem': interfacesPluginConfig}]

    }

 

    # Start Discovery

    print("Running discovery...")

    discoveryProfileID = swis.invoke('Orion.Discovery', 'StartDiscovery', discoveryProfile)

    print("Returned discovery profile id {}".format(discoveryProfileID))

 

    '''

        discoveryStatusState = {0: "Unknown", 1: "InProgress", 2: "Finished", 3: "Error", 4: "NotScheduled", 5: "Scheduled",

                            6: "NotCompleted", 7: "Canceling", 8: "ReadyForImport"}

    '''

    # Wait until it's done with discovery before we start assigning custom pollers or populating custom properties

    running = True  # InProgress

    while running:

        sys.stdout.write('.')

        sys.stdout.flush()

        query = "SELECT Status FROM Orion.DiscoveryProfiles WHERE ProfileID = " + str(discoveryProfileID)

        result = swis.query(query)

        # pprint(result)

        # Example output .{'results': [{'Status': <discoveryStatusState>}]}

 

        if len(result['results']) < 1:

            # When we don't have any records from the Orion.DiscoveryProfiles

            # This will results to an empty list

            running = False

        else:

            time.sleep(5)       # wait 5 seconds

 

    print(' ')

    print('Done with discovery')

 

    query = "SELECT Result, ResultDescription, ErrorMessage, BatchID FROM Orion.DiscoveryLogs WHERE ProfileID = '" + str(discoveryProfileID) + "' "

    discovered = swis.query(query)

 

    if (discovered['results'][0]['Result']) != 2:

        print(discovered['results'][0]['ResultDescription'])

        print(discovered['results'][0]['ErrorMessage'])

    else:

        # Import finished

        print(discovered['results'][0]['ResultDescription'])

 

requests.packages.urllib3.disable_warnings()

 

if __name__ == '__main__':

    hosts = [ '192.168.0.1' , '192.168.0.2']

    solarwindsDiscovery(hosts)

 

##### end script discover.py #####

 

 

##### script add_poller.py #####

from __future__ import print_function

import re

import requests

from orionsdk import SwisClient

from pprint import pprint

 

def main():

# Init SWIS API

    npm_server = 'solarwinds-dev.example.com'

    username = 'scripting'

    password = 'somesecretpassword'

    nodeid = '588'

 

    verify = False

    if not verify:

        from requests.packages.urllib3.exceptions import InsecureRequestWarning

        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

    swis = SwisClient(npm_server, username, password)

    print("Add pollers into node:")

 

    pollers_enabled = {

        'N.Status.ICMP.Native': True,

        'N.Status.SNMP.Native': False,

        'N.ResponseTime.ICMP.Native': True,

        'N.ResponseTime.SNMP.Native': False,

        'N.Details.SNMP.Generic': True,

        'N.Uptime.SNMP.Generic': True,

        'N.Cpu.SNMP.HrProcessorLoad': True,

        'N.Memory.SNMP.NetSnmpReal': True,

        'N.AssetInventory.Snmp.Generic': True,

        'N.Topology_CDP.SNMP.cdpCacheTable': False,

        'N.Topology_LLDP.SNMP.lldpRemoteSystemsData': False,

        'N.Topology_Layer3.SNMP.ipNetToMedia': False,

        'N.Routing.SNMP.Ipv4CidrRoutingTable': False,

        'N.Routing.SNMP.Ipv4RoutingTable': False,

        'N.EnergyWise.SNMP.Cisco': False,

        'N.Topology_Vlans.SNMP.VtpVlan': False,

        'N.Topology_PortsMap.SNMP.Dot1dBaseNoVLANs': False,

        'N.HardwareHealthMonitoring.SNMP.NPM.Cisco': False,

        'N.EnergyWise.SNMP.Cisco' : False,

        'N.Topology_Layer2.SNMP.Dot1dTpFdb' : False,

        'N.Topology_Layer3.SNMP.Dot1dTpFdb' : False

    }

 

    pollers = []

    for k in pollers_enabled:

        pollers.append(

        {

        'PollerType': k,

        'NetObject': 'N:' + nodeid,

        'NetObjectType': 'N',

        'NetObjectID': nodeid,

        'Enabled': pollers_enabled[k]

        }

    )

 

    for poller in pollers:

        print(" Adding poller type: {} with status {}... ".format(poller['PollerType'], poller['Enabled']), end="")

        response = swis.create('Orion.Pollers', **poller)

        print("DONE!")

 

 

    response = swis.invoke('Orion.Nodes', 'PollNow', 'N:' + nodeid)

 

requests.packages.urllib3.disable_warnings()

 

if __name__ == '__main__':

    main()

 

 

##### end script add_poller.py #####

 

If this is possible, can you some provide me how I can do this ?

403 with rest api call

$
0
0

I;ve seen a few other people with this issue, and some where resolved, but nowhere is a solution to be found.

 

The code:

 

$VLANNAAM = "Somevlan"

$cred = get-credential

$invoked = Invoke-RestMethod -Uri ("https://"+$Hostname+":17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT GroupId,VLAN_Naam FROM IPAM.GroupNodeAttr WHERE (VLAN_Naam='$VLANNAAM')") -method Get -credential $cred

 

For the credentials I've used a windows account, local account, database user.

Nothing works, Always the 403 error.

 

2015-08-27 07_33_58-Pool 06 - ICT Services Windows 8 Werkplek.png

Receiving 403 Forbidden When Using REST API In C#

$
0
0

Receiving 403 Forbidden When Using REST API In C#

 

I was referred to the following C# example of using REST APIs Sample code: OrionSDK/Program.cs at master · solarwinds/OrionSDK · GitHub

 

This looked very promising and I have attempted to implement it for my process. However, all requests are failing with a 403 Forbidden error.

 

I have verified if I used invalid credentials I get a 401 unauthorized error so it appears to be authenticating my request, but I can't get results for a simple query operation.

 

I am basically using the code from the example but I am only calling the query action with the following simple query string and no arguments:

conststring query = @"SELECT nodeid, caption FROM Orion.Nodes";

 

I have output the JSON string created before it is passed to the request and it looks like this:

{"parameters":null,"query":"SELECT nodeid, caption FROM Orion.Nodes"}

 

Is there something wrong with the JSON or my query request?

API Network Discovery

$
0
0

Following the instructions on GitHub (Discovery · solarwinds/OrionSDK Wiki · GitHub ) I am attempting to create a very basic network scan where IP address's between 10.X.0.1-10.X.31.254 are scanned with the credential ID's provided.   I am assuming the 3 separate plugin configuration are all actually part of the same script ?  Assuming this is correct, when I run the script now, the system is expecting an argument at the line below

 

#Error expecting argument

PS C:\Users\nsd000.QACMA> C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Discovery.ps1

 

cmdlet Invoke-SwisVerb at command pipeline position 1

 

Supply values for the following parameters:

 

Arguments[0]:

 

Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration requires 1 parameters not 0

 

At C:\Discovery.ps1:73 char:34

 

+ $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

 

+                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

 

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

 

 

 

#The error above is referencing the line directly below

$InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

 

#Complete Script Below, Everything above this line is describing the problem

#CONNECTION TO SWIS

$ErrorActionPreference = 'Stop'

#Add the snapin
Add-PSSnapin SwisSnapin

#create a connection to solarwinds

$hostname = 'X.X.X.X'
$username = 'X'
$password = 'X'

#swis = Connect-Swis -Hostanme $hostname -Trusted
$swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

 

 

#Core Plugin Configuration

$CorePluginConfigurationContext = ([xml]"
<CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
        <IpAddressRange>
            <StartAddress>10.X.0.1</StartAddress>
            <EndAddress>10.X.31.254</EndAddress>
        </IpAddressRange>
    <Credentials>
        <SharedCredentialInfo>
            <CredentialID></CredentialID>
            <CredentialID>1</CredentialID>
         <CredentialID>2</CredentialID>
         <CredentialID>11</CredentialID>
            <CredentialID>13</CredentialID>
            <CredentialID>20</CredentialID>
            <CredentialID>21</CredentialID>
         <CredentialID>47</CredentialID>
         <CredentialID>71</CredentialID>
            <CredentialID>89</CredentialID>
            <CredentialID>110</CredentialID>
            <CredentialID>156</CredentialID>
            <CredentialID>163</CredentialID>
            <CredentialID>170</CredentialID>
         <CredentialID>197</CredentialID>
            <CredentialID>198</CredentialID>
            <CredentialID>202</CredentialID>
            <Order>1</Order>
        </SharedCredentialInfo>
    </Credentials>
    <WmiRetriesCount>1</WmiRetriesCount>
    <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
</CorePluginConfigurationContext>
").DocumentElement

 

#Interface Plugin Configuration

$CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext

$InterfacesPluginConfigurationContext = ([xml]"
<InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                  xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
    <AutoImportStatus>
        <a:string>Up</a:string>
        <a:string>Down</a:string>
        <a:string>Shutdown</a:string>
    </AutoImportStatus>
    <AutoImportVirtualTypes>
        <a:string>Virtual</a:string>
        <a:string>Physical</a:string>
    </AutoImportVirtualTypes>
    <AutoImportVlanPortTypes>
        <a:string>Trunk</a:string>
        <a:string>Access</a:string>
        <a:string>Unknown</a:string>
    </AutoImportVlanPortTypes>
    <UseDefaults>false</UseDefaults>
</InterfacesDiscoveryPluginContext>
").DocumentElement

$InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

 

#Discovery Plugin Configuration

$EngineID = 1
$DeleteProfileAfterDiscoveryCompletes = "false"

$StartDiscoveryContext = ([xml]"
<StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
    <Name>Script Discovery $([DateTime]::Now)</Name>
    <EngineId>$EngineID</EngineId>
    <JobTimeoutSeconds>3600</JobTimeoutSeconds>
    <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>
    <SnmpTimeoutMiliseconds>2000</SnmpTimeoutMiliseconds>
    <SnmpRetries>1</SnmpRetries>
    <RepeatIntervalMiliseconds>1500</RepeatIntervalMiliseconds>
    <SnmpPort>161</SnmpPort>
    <HopCount>0</HopCount>
    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
    <DisableIcmp>false</DisableIcmp>
    <AllowDuplicateNodes>false</AllowDuplicateNodes>
    <IsAutoImport>true</IsAutoImport>
    <IsHidden>$DeleteProfileAfterDiscoveryCompletes</IsHidden>
    <PluginConfigurations>
        <PluginConfiguration>
            <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
            <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
        </PluginConfiguration>
    </PluginConfigurations>
</StartDiscoveryContext>
").DocumentElement)

 

#Running The Discovery ( I get the error noted at the top regardless of the line below.  To be honest, I guessed this would be at the bottom of the script.

$DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

Node Resource Discovery Via JSON API

$
0
0

So the configuration seems to be properly set.

 

The community is being properly set and I get a completed discovery profile status but the polling and interface discovery isnt automatically working using the JSON api.

 

It will only work if I manually click in the UI to poll and list resources, then it will find everything.

 

CONFIG DATA

 

[{"Name": "app1.phx1",

   "EngineID": 1,

   "JobTimeoutSeconds": 3600,

   "SearchTimeoutMiliseconds": 2000,

   "SnmpTimeoutMiliseconds": 2000,

   "SnmpRetries": 3,

   "RepeatIntervalMiliseconds": 1500,

   "SnmpPort": 161,

   "HopCount": 0,

   "PreferredSnmpVersion": "SNMP2c",

   "DisableIcmp": "false",

   "AllowDuplicateNodes": "false",

   "IsAutoImport": "true",

   "IsHidden": "true",

   "PluginConfigurations": [  

       {"PluginConfigurationItem":"<?xml version='1.0' encoding='utf-16'?><PluginItems><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery'><DiscoveryPluginConfigurationBase xmlns:d2p1='http://schemas.solarwinds.com/2008/Orion' i:type='d2p1:CoreDiscoveryPluginConfiguration'><d2p1:ActiveDirectoryList /><d2p1:AddressRange /><d2p1:AgentsAddresses xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays' /><d2p1:AutoImportVolumeTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Common.Snmp' i:nil='true' /><d2p1:BulkList xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><d3p1:string>IP_HIDDEN</d3p1:string></d2p1:BulkList><d2p1:Credentials><d2p1:credentials><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays' /></knownTypes><pluginItem><d2p1:ArrayOfCredential xmlns:i='http://www.w3.org/2001/XMLSchema-instance' /></pluginItem></d2p1:credentials></d2p1:Credentials><d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes><d2p1:PreferredPollingMethod>SNMP</d2p1:PreferredPollingMethod><d2p1:SharedCredentials xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><d3p1:KeyValueOfintint><d3p1:Key>1</d3p1:Key><d3p1:Value>3</d3p1:Value></d3p1:KeyValueOfintint></d2p1:SharedCredentials><d2p1:SubnetList /><d2p1:WMICredentials /><d2p1:WmiRetries>2</d2p1:WmiRetries><d2p1:WmiRetryInterval>PT1S</d2p1:WmiRetryInterval></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"},

       {"PluginConfigurationItem":"<?xml version='1.0' encoding='utf-16'?><PluginItems><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><string>SolarWinds.Interfaces.Common.Models.Discovery.InterfacesDiscoveryPluginConfiguration,SolarWinds.Interfaces.Common</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery'><DiscoveryPluginConfigurationBase xmlns:d2p1='http://schemas.solarwinds.com/2008/Interfaces' i:type='d2p1:InterfacesDiscoveryPluginConfiguration'><d2p1:AutoImportExpressionFilter xmlns:d3p1='http://schemas.datacontract.org/2004/07/' i:nil='true' /><d2p1:AutoImportStatus xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Interfaces.Common.Enums'><d3p1:IfAutoImportStatus>Up</d3p1:IfAutoImportStatus><d3p1:IfAutoImportStatus>Down</d3p1:IfAutoImportStatus><d3p1:IfAutoImportStatus>Shutdown</d3p1:IfAutoImportStatus></d2p1:AutoImportStatus><d2p1:AutoImportVirtualTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/System'><d3p1:boolean>true</d3p1:boolean><d3p1:boolean>false</d3p1:boolean></d2p1:AutoImportVirtualTypes><d2p1:AutoImportVlanPortTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Enums'><d3p1:VlanPortType>Trunk</d3p1:VlanPortType><d3p1:VlanPortType>Access</d3p1:VlanPortType><d3p1:VlanPortType>Unknown</d3p1:VlanPortType></d2p1:AutoImportVlanPortTypes><d2p1:DiscoverVLANs>false</d2p1:DiscoverVLANs></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"}    

   ]

  }]

 

This works fine.

 

This is the details of the Node after creation.

 

NODE DATA

 

Array

(

    [NodeID] => ID_HIDDEN

    [ObjectSubType] => SNMP

    [SNMPVersion] => 2

    [Community] => publ1c15

    [IP] => IP_HIDDEN

    [IPAddressType] => IPv4

    [Caption] => UT_app1.phx1_11-14_07:42

    [NodeDescription] => app1.phx1

    [Description] =>

    [Status] => 1

    [SystemUpTime] =>

    [PercentMemoryAvailable] =>

    [MemoryAvailable] =>

    [MemoryUsed] => -2

    [TotalMemory] =>

    [CPULoad] => -2

    [EngineID] => 1

    [UnManaged] =>

    [UnManageFrom] => 1899-12-30T00:00:00.0000000Z

    [UnManageUntil] => 1899-12-30T00:00:00.0000000Z

    [Uri] => NODE_URL

    [Division] => PremierWest

    [Delimiter] => |

    [VIP] => No

    [SystemsGrouping] => SystemsGrouping

    [NetcoolNotify] => Yes

    [SmartWan] => Yes

    [CustomerName] => TELE : PHX1

    [CustomerID] => 30848

)

 

It just simply wont poll and detect resources automatically only manually. Can you let me know what I need to do.

 

It wont detect the machine type, memory, all those things automatically.

 

Thank you.

Query nodes based on custom property

$
0
0

Hello,

 

Is there any way to query the Orion nodes with all the custom properties?

 

Thanks.

CluM09

Orion SDK with PowerShell - manage/unmanage multiple nodes

$
0
0

I've been able to script unmanaging and managing nodes in powershell. However, for 400+ nodes, this ends up taking quite a while. Via script, it takes about 7 minutes to unmanage the nodes and over 10 minutes to remanage them. Doing this from the website takes about 25 seconds and no more than a minute, respectively. My guess is that the website somehow group updates the database instead of doing it one at a time. Anyone else seen this or have any idea how to do more than one node at a time? Below is sample code for how I am unmanaging a single node:

 

Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N:$nodeid",$start,$end,"false")

 

Thanks for any advice you have!


No snap-ins have been registered for Windows PS v. 5.0

$
0
0

Hi Thwack,

 

As I was trying to unmanage whole groups at a time I stumbled upon OrionSDK and with that, PowerOrion.

I have installed OrionSDK and copied the PowerOrion directory to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\.

Whenever I try to either Import-Module PowerOrion or Add-PSSnapin SwisSnapin I get this:

 

PS C:\Company> Add-PSSnapin SwisSnapin 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At line:1 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

 

 

PS C:\Company> Import-Module PowerOrion

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerOrion\PowerOrion.psm1:5 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

I've tried running the following without success: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'

 

Any help is greatly appreciated.

 

Glad Regards,

Frederik Bruun

Node Resource Discovery Via JSON API

$
0
0

So the configuration seems to be properly set.

 

The community is being properly set and I get a completed discovery profile status but the polling and interface discovery isnt automatically working using the JSON api.

 

It will only work if I manually click in the UI to poll and list resources, then it will find everything.

 

CONFIG DATA

 

[{"Name": "app1.phx1",

   "EngineID": 1,

   "JobTimeoutSeconds": 3600,

   "SearchTimeoutMiliseconds": 2000,

   "SnmpTimeoutMiliseconds": 2000,

   "SnmpRetries": 3,

   "RepeatIntervalMiliseconds": 1500,

   "SnmpPort": 161,

   "HopCount": 0,

   "PreferredSnmpVersion": "SNMP2c",

   "DisableIcmp": "false",

   "AllowDuplicateNodes": "false",

   "IsAutoImport": "true",

   "IsHidden": "true",

   "PluginConfigurations": [  

       {"PluginConfigurationItem":"<?xml version='1.0' encoding='utf-16'?><PluginItems><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery'><DiscoveryPluginConfigurationBase xmlns:d2p1='http://schemas.solarwinds.com/2008/Orion' i:type='d2p1:CoreDiscoveryPluginConfiguration'><d2p1:ActiveDirectoryList /><d2p1:AddressRange /><d2p1:AgentsAddresses xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays' /><d2p1:AutoImportVolumeTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Common.Snmp' i:nil='true' /><d2p1:BulkList xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><d3p1:string>IP_HIDDEN</d3p1:string></d2p1:BulkList><d2p1:Credentials><d2p1:credentials><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays' /></knownTypes><pluginItem><d2p1:ArrayOfCredential xmlns:i='http://www.w3.org/2001/XMLSchema-instance' /></pluginItem></d2p1:credentials></d2p1:Credentials><d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes><d2p1:PreferredPollingMethod>SNMP</d2p1:PreferredPollingMethod><d2p1:SharedCredentials xmlns:d3p1='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><d3p1:KeyValueOfintint><d3p1:Key>1</d3p1:Key><d3p1:Value>3</d3p1:Value></d3p1:KeyValueOfintint></d2p1:SharedCredentials><d2p1:SubnetList /><d2p1:WMICredentials /><d2p1:WmiRetries>2</d2p1:WmiRetries><d2p1:WmiRetryInterval>PT1S</d2p1:WmiRetryInterval></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"},

       {"PluginConfigurationItem":"<?xml version='1.0' encoding='utf-16'?><PluginItems><knownTypes><ArrayOfstring xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><string>SolarWinds.Interfaces.Common.Models.Discovery.InterfacesDiscoveryPluginConfiguration,SolarWinds.Interfaces.Common</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery'><DiscoveryPluginConfigurationBase xmlns:d2p1='http://schemas.solarwinds.com/2008/Interfaces' i:type='d2p1:InterfacesDiscoveryPluginConfiguration'><d2p1:AutoImportExpressionFilter xmlns:d3p1='http://schemas.datacontract.org/2004/07/' i:nil='true' /><d2p1:AutoImportStatus xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Interfaces.Common.Enums'><d3p1:IfAutoImportStatus>Up</d3p1:IfAutoImportStatus><d3p1:IfAutoImportStatus>Down</d3p1:IfAutoImportStatus><d3p1:IfAutoImportStatus>Shutdown</d3p1:IfAutoImportStatus></d2p1:AutoImportStatus><d2p1:AutoImportVirtualTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/System'><d3p1:boolean>true</d3p1:boolean><d3p1:boolean>false</d3p1:boolean></d2p1:AutoImportVirtualTypes><d2p1:AutoImportVlanPortTypes xmlns:d3p1='http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Enums'><d3p1:VlanPortType>Trunk</d3p1:VlanPortType><d3p1:VlanPortType>Access</d3p1:VlanPortType><d3p1:VlanPortType>Unknown</d3p1:VlanPortType></d2p1:AutoImportVlanPortTypes><d2p1:DiscoverVLANs>false</d2p1:DiscoverVLANs></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"}    

   ]

  }]

 

This works fine.

 

This is the details of the Node after creation.

 

NODE DATA

 

Array

(

    [NodeID] => ID_HIDDEN

    [ObjectSubType] => SNMP

    [SNMPVersion] => 2

    [Community] => publ1c15

    [IP] => IP_HIDDEN

    [IPAddressType] => IPv4

    [Caption] => UT_app1.phx1_11-14_07:42

    [NodeDescription] => app1.phx1

    [Description] =>

    [Status] => 1

    [SystemUpTime] =>

    [PercentMemoryAvailable] =>

    [MemoryAvailable] =>

    [MemoryUsed] => -2

    [TotalMemory] =>

    [CPULoad] => -2

    [EngineID] => 1

    [UnManaged] =>

    [UnManageFrom] => 1899-12-30T00:00:00.0000000Z

    [UnManageUntil] => 1899-12-30T00:00:00.0000000Z

    [Uri] => NODE_URL

    [Division] => PremierWest

    [Delimiter] => |

    [VIP] => No

    [SystemsGrouping] => SystemsGrouping

    [NetcoolNotify] => Yes

    [SmartWan] => Yes

    [CustomerName] => TELE : PHX1

    [CustomerID] => 30848

)

 

It just simply wont poll and detect resources automatically only manually. Can you let me know what I need to do.

 

It wont detect the machine type, memory, all those things automatically.

 

Thank you.

How can i Import exported IPAM Subnets in bulk?

$
0
0

I have approximately 2,000 .csv files from an IPAM subnet export, which generates a spreadsheet per subnet.  I know the IPAM API has the ability to Create subnets, with the 'New-SwisObject' command, however, I don't have enough PowerShell experience to know how to put all the pieces together.  

My idea is to Target the folder the subnet documents are in (C:\ips) and populate the Address, FriendlyName, and CIDR Property variables in the script, from each file the folders.  The Addresses, and CIDR values would come from the Excel columns, "Subnet Address", and "Subnet CIDR", and the FriendlyName would be the name of the file itself.

 

However, what i'm not sure is, how can i say in the script that the address, friendlyname variables, and cidr are in each of the of the document , and how does the foreach statement work to go through each item in the folder?

 

Address= variable comes from Subnet Address column in csv

FriendlyName= variable comes from the file name of the csv

CIDR= variable comes from the Subnet CIDR of the csv

 

Here's what i have so far, but it's just a start.

 

$folder = get-childitem \ips

foreach ($file in $folder)

{

New-SwisObject $swis -EntityType 'IPAM.Subnet' -Properties @{Address='$subnet_Address'; FriendlyName='$filename of csv'; CIDR='24';}

}



I feel like this can't be that hard, i just don't know how to use PowerShell well enough to get all the pieces working together, or even if this is the right direction to go down.  It's unrealistic to do all these manually, and i understand that any custom entries we had entered before would be lost, as we're not doing a full Subnet Import via a csv, but recreating the Subnet by referencing some data in the .csv.

Thoughts?

 

Thanks!

Acknowledge Alerts with a curl

$
0
0

I have seen a bunch of ways to acknowledge an alert using various methods but so far none of it seems to work. Below is a screen shot from Postman. I get the true, but in the end the alert is not acknowledged.

 

Call AddDNSARecord via REST api

$
0
0

I'm trying to run AddDNSARecord from the REST api.

 

Attempt:

https://solarwinds:17778/SolarWinds/InformationService/v3/Json/swis://localhost/Orion/IPAM.IPAddressManagement/AddDNSARe…

{

"recordName":""

"nodeIPv4Address":""

"dnsIPAddress":""

"dnsZoneName":""

}

 

Response:

{

    "Message": "Invalid SWIS uri at character 60: Filter property name not specified for primary filter.\r\nParameter name: uri",

    "ExceptionType": "System.ArgumentException",

    "FullException": "System.ArgumentException: Invalid SWIS uri at character 60: Filter property name not specified for primary filter.\r\nParameter name: uri\r\n   at SolarWinds.Data.Utility.SwisUriParser.ParsingError(String message)\r\n   at SolarWinds.Data.Utility.SwisUriParser.HandleFilterPropertyName(Char c)\r\n   at SolarWinds.Data.Utility.SwisUriParser.ParseInternal()\r\n   at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)"

}

How do I add CPU, RAM, and Disk pollers to a new SNMP node via the Python API?

$
0
0

I am attempting to add nodes via SNMP using python.  I have previously been using ICMP to add the nodes only for Status and response time polling, but would like to expand further and gather more information automatically.  Is there a good way to try to authenticate over SNMP using the SNMP string, and if the string verifies, add the node?  I currently am using this snippet of code, and it does successfully add an SNMP node, but the only statistics that show up on the node page are for Average Response Time and Packet Loss, but CPU load, Memory, and any disks are not detected.  I may not be fully understanding the polling aspect and how it works in regards to the API, but I would like to essentially recreate what happens when I "List Resources" on a node and select which disks, CPU, RAM, and other properties to monitor.  If someone could take a look at my poller options and let me know if I am making a mistake somewhere that would be great.


Also, can I use some sort of try/catch exception handling when adding SNMP nodes, in case the string does not authenticate, I can revert back to adding the node via simply ICMP?


Thanks!


uri = swis.create(EntityType,   IPAddress = IP_input,   IPAddressGUID = ip_to_guid(IP_input),   Caption = str(IP_input),   DynamicIP = False,   EngineID = 1,   Status = 1,   UnManaged = False,   Allow64BitCounters = True,   ObjectSubType = "SNMP",   MachineType = "",   VendorIcon = "",   RediscoveryInterval = 30,   PollInterval = 60,   StatCollection = 1,   City = "REDACTED",   Managed_Monitored = "REDACTED",     Node_Type = "TBD",   ALERT_CPU = 90,   ALERT_RAM = 90,   Community = 'REDACTED',   SNMPVersion=2   )  # Get all object properties for new node added  obj = swis.read(uri)  snmpDetailsUri = swis.create("Orion.Pollers", PollerType = "N.Details.SNMP.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpUptimeUri = swis.create("Orion.Pollers", PollerType = "N.Uptime.SNMP.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpCpuUri = swis.create("Orion.Pollers", PollerType = "N.Cpu.SNMP.HrProcessorLoad", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpMemoryUri = swis.create("Orion.Pollers", PollerType = "N.Memory.SNMP.NetSnmpReal", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpAssetInventoryUri = swis.create("Orion.Pollers", PollerType = "N.AssetInventory.Snmp.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpResponseTimeUri = swis.create("Orion.Pollers", PollerType = "N.ResponseTime.SNMP.Native", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpStatusUri = swis.create("Orion.Pollers", PollerType = "N.Status.SNMP.Native", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpTopologyUri = swis.create("Orion.Pollers", PollerType = "N.Topology_Layer3.SNMP.ipNetToMedia", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])

No snap-ins have been registered for Windows PS v. 5.0

$
0
0

Hi Thwack,

 

As I was trying to unmanage whole groups at a time I stumbled upon OrionSDK and with that, PowerOrion.

I have installed OrionSDK and copied the PowerOrion directory to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\.

Whenever I try to either Import-Module PowerOrion or Add-PSSnapin SwisSnapin I get this:

 

PS C:\Company> Add-PSSnapin SwisSnapin 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At line:1 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

 

 

PS C:\Company> Import-Module PowerOrion

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerOrion\PowerOrion.psm1:5 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

I've tried running the following without success: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'

 

Any help is greatly appreciated.

 

Glad Regards,

Frederik Bruun


groups not nesting

$
0
0

I have a Powershell script that runs nightly, and has been doing so successfully for a while until recently.

 

When the script runs it creates groups, and then also does nesting of subgroups and nodes.

 

When it run now, it won't nest the groups properly under the one 'master group' I have created.

 

Looking at the database tables and comparing it to a second instance of NPM that was a clean install, I see there are indexes on the new instance database that aren't in the one I'm working.

 

I've opened a support ticket to cover my bases, but want to ask here if any one else has had experience with this.

How do I add CPU, RAM, and Disk pollers to a new SNMP node via the Python API?

$
0
0

I am attempting to add nodes via SNMP using python.  I have previously been using ICMP to add the nodes only for Status and response time polling, but would like to expand further and gather more information automatically.  Is there a good way to try to authenticate over SNMP using the SNMP string, and if the string verifies, add the node?  I currently am using this snippet of code, and it does successfully add an SNMP node, but the only statistics that show up on the node page are for Average Response Time and Packet Loss, but CPU load, Memory, and any disks are not detected.  I may not be fully understanding the polling aspect and how it works in regards to the API, but I would like to essentially recreate what happens when I "List Resources" on a node and select which disks, CPU, RAM, and other properties to monitor.  If someone could take a look at my poller options and let me know if I am making a mistake somewhere that would be great.


Also, can I use some sort of try/catch exception handling when adding SNMP nodes, in case the string does not authenticate, I can revert back to adding the node via simply ICMP?


Thanks!


uri = swis.create(EntityType,   IPAddress = IP_input,   IPAddressGUID = ip_to_guid(IP_input),   Caption = str(IP_input),   DynamicIP = False,   EngineID = 1,   Status = 1,   UnManaged = False,   Allow64BitCounters = True,   ObjectSubType = "SNMP",   MachineType = "",   VendorIcon = "",   RediscoveryInterval = 30,   PollInterval = 60,   StatCollection = 1,   City = "REDACTED",   Managed_Monitored = "REDACTED",     Node_Type = "TBD",   ALERT_CPU = 90,   ALERT_RAM = 90,   Community = 'REDACTED',   SNMPVersion=2   )  # Get all object properties for new node added  obj = swis.read(uri)  snmpDetailsUri = swis.create("Orion.Pollers", PollerType = "N.Details.SNMP.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpUptimeUri = swis.create("Orion.Pollers", PollerType = "N.Uptime.SNMP.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpCpuUri = swis.create("Orion.Pollers", PollerType = "N.Cpu.SNMP.HrProcessorLoad", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpMemoryUri = swis.create("Orion.Pollers", PollerType = "N.Memory.SNMP.NetSnmpReal", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpAssetInventoryUri = swis.create("Orion.Pollers", PollerType = "N.AssetInventory.Snmp.Generic", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpResponseTimeUri = swis.create("Orion.Pollers", PollerType = "N.ResponseTime.SNMP.Native", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpStatusUri = swis.create("Orion.Pollers", PollerType = "N.Status.SNMP.Native", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])  snmpTopologyUri = swis.create("Orion.Pollers", PollerType = "N.Topology_Layer3.SNMP.ipNetToMedia", NetObject="N:" + str(obj["NodeID"]), NetObjectType="N", NetObjectID=obj["NodeID"])

groups not nesting

$
0
0

I have a Powershell script that runs nightly, and has been doing so successfully for a while until recently.

 

When the script runs it creates groups, and then also does nesting of subgroups and nodes.

 

When it run now, it won't nest the groups properly under the one 'master group' I have created.

 

Looking at the database tables and comparing it to a second instance of NPM that was a clean install, I see there are indexes on the new instance database that aren't in the one I'm working.

 

I've opened a support ticket to cover my bases, but want to ask here if any one else has had experience with this.

Receiving 403 Forbidden When Using REST API In C#

$
0
0

Receiving 403 Forbidden When Using REST API In C#

 

I was referred to the following C# example of using REST APIs Sample code: OrionSDK/Program.cs at master · solarwinds/OrionSDK · GitHub

 

This looked very promising and I have attempted to implement it for my process. However, all requests are failing with a 403 Forbidden error.

 

I have verified if I used invalid credentials I get a 401 unauthorized error so it appears to be authenticating my request, but I can't get results for a simple query operation.

 

I am basically using the code from the example but I am only calling the query action with the following simple query string and no arguments:

conststring query = @"SELECT nodeid, caption FROM Orion.Nodes";

 

I have output the JSON string created before it is passed to the request and it looks like this:

{"parameters":null,"query":"SELECT nodeid, caption FROM Orion.Nodes"}

 

Is there something wrong with the JSON or my query request?

PowerShell Module based on the SDK

$
0
0

Hi All,

 

I started working on a PowerShell module, converting existing code examples in the SDK to “Cmdlets” Functions.  The ultimate goal is to just make it easier to re-use code. My own use case in particular arose from just wanting to simplify automating primarily working with SAM & NPM nodes, but I thought this may be of interest to others, so I’m going to share it on Codeplex as well. By posting it there not only can you can get a copy of the current code, but it also allows you to submit any changes you may make back in to the main code, which will ultimately lead to more functionality, and faster ( this is just a personal project, and not a SolarWinds one, so the code is offered as-is. Plus as I'm just doing this in free-time, so it may not get updated as frequently or as often as I would ).


Why A Module?

Converting this code into a module has several benefits:

  • By creating Cmdlets, actions can be performed much faster. For example, to add nodes, rather than editing a script and calling that, you can now just call something like

$swis=Connect-Swis-UserNameadmin-Password""-Hostname10.160.5.75

New-OrionNode-SwisConnection$swis-IPAddress10.160.5.10             

What this boils down to is when writing your own scripts, these can now be much smaller in size, and faster to develop, as a lot of the “plumbing” is already done (instead of having to copy and paste a 75 line script, you can now achieve the same in a couple of lines).    

  • It’s more intuitive, and fits conventional PowerShell Verb-Noun naming conventions. Plus, the  documentation is built-in, so calling the Get-Help command can return help and examples, the same as standard Cmdlets.

PowerOrionGet-Help Example.jpg

  • By building in error handling, and through the use of defaults and parameter sets, there is less chance for user error. For example, when building statements in either the console or the IDE it can prompt on possible options for parameters.

PowerOrion Parameters Populated.jpg


What functionality is available at present? 
At the moment it’s very much version 0.0.1, and contains a few helper Cmdlets, plus the ability to Add ICMP Nodes, Remove Nodes, and retrieve properties. Next on the to-do list is (and this is just a wishlist, so depending on time, these may or may not be completed)

  1. Adding in SNMP nodes
  2. Adding in volumes and interfaces
  3. Adding in WMI nodes
  4. Managing applications
  5. Setting custom properties

 

EDIT: Technically these are "advanced functions" and not "Cmdlets". From a users perspective they are essentially the same, the only difference being in how the code is written: Cmdlets are written in C#, advanced functions are written in PowerShell

Viewing all 3719 articles
Browse latest View live


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