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

Exception adding Orion.Container with dynamic query via Python

$
0
0

Below is what i'm using to invoke CreateContainer call and the trace is below it. What am i doing wrong here? I've tried this with both filter:/Orion.Nodes[CustomProperties.Site={0}] and filter:/Orion.Nodes[CustomProperties.Site='{0}'] thinking maybe since the filter is a string that's why it couldn't cast my member definition correctly but it's still bombing with the same error.

 

group_member_def = '''

<ArrayOfMemberDefinitionInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance"

    xmlns="http://schemas.solarwinds.com/2008/Orion">

<MemberDefinitionInfo>

<Name>{0}_Devices</Name>

<Definition>filter:/Orion.Nodes[CustomProperties.Site={0}]</Definition>

</MemberDefinitionInfo></ArrayOfMemberDefinitionInfo>

'''

 

swis.invoke(

    'Orion.Container',

    'CreateContainer',

    'name', #name

    'Core', #owner

    60, #frequency

    0, #statusCalculator

    'description', #description

    'true', #pollingEnable

    group_member_def.format('test') #memberDef

)

 

 

'SolarWinds.InformationService.Verb.VerbExecutorException: Verb Orion.Container.CreateContainer cannot unpackage parameter 6 with type SolarWinds.Data.Providers.Orion.Containers.DataProvider.MemberDefinitionInfo[] ---> Newtonsoft.Json.JsonSerializationException: Error converting value "<ArrayOfMemberDefinitionInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance"    xmlns="http://schemas.solarwinds.com/2008/Orion"><MemberDefinitionInfo><Name>test_Devices</Name><Definition>filter:/Orion.Nodes[CustomProperties.Site=test]</Definition></MemberDefinitionInfo></ArrayOfMemberDefinitionInfo>" to type \'SolarWinds.Data.Providers.Orion.Containers.DataProvider.MemberDefinitionInfo[]\'. Path \'\'. ---> System.ArgumentException: Could not cast or convert from System.String to SolarWinds.Data.Providers.Orion.Containers.DataProvider.MemberDefinitionInfo[].\r\n   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)\r\n   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)\r\n   --- End of inner exception stack trace ---\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.<>c__DisplayClass22_0.<UnpackageParameters>b__0(Int32 index)\r\n   --- End of inner exception stack trace ---\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.<>c__DisplayClass22_0.<UnpackageParameters>b__0(Int32 index)\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.CreateParameters(Func`2 getParameterAt, Int32 parametersCount, Stream stream)\r\n   at SolarWinds.InformationService.Verb.VerbExecutorContext.UnpackageParameters(JArray parameters)\r\n   at SolarWinds.InformationService.Core.InformationService.Invoke[T](String entity, String verb, Action`1 setupParameters, Func`2 extractReturnValue)'


How to set select a custom property field using the SDK

$
0
0

Hello,

I am trying to leverage the example PS script to automate the setting of custom properties of my environment however I have a question about the example.  Here is the example:

 

$nodeId=8# NodeID of a node which custom properties you want to change

 

 

# prepare a custom property value

 

$customProps= @{

 

  Comments="Custom comment";

 

}

 

build the node URI

 

$uri="swis://localhost/Orion/Orion.Nodes/NodeID=$nodeId/CustomProperties";

 

# set the custom property

Set-SwisObject$swis-Uri $uri-Properties $customProps

 

 

However this example doesn't illustrate how to select the custom property column you want to set.  How would I do this?  Thank you!!

 

 

Reference: OrionSDK/CRUD.SettingCustomProperty.ps1 at PowerOrion · solarwinds/OrionSDK · GitHub

SDK Admin Manual

$
0
0

I have just downloaded OrionSDK-1.9.zip and extracted the msi, but there is no trace of pdf file for the documentation.

After installing the msi , I found it in C:\Program Files (x86)\SolarWinds\Orion SDK\Documentation as Orion SDK.pdf.

Just in case anybody is wondering about that.

AddInterfacesOnNode - java or perl

$
0
0

Hi folks,

 

We haven't been having any luck getting the AddInterfacesOnNode verb to work for us. We've tried using the perl examples provided in another thread along with the updated InformationService.pm file there, but we're not getting any response. We've successfully used this user to create nodes before but not interfaces on pollers. Bunch of code snippets below. Any assistance that can be provided is greatly appreciated.

 

I've pasted the relevant content from our script below. We do get a response when we use DiscoverInterfacesOnNode but no response at all from AddInterfacesOnNode and not even any kind of error. However, we're not seeing the interfaces on the node display in the UI, and it doesn't look like the interfaces have wound up in any DB tables, either.

 

my $interfaceList =  $swis->Invoke('Orion.NPM.Interfaces', 'DiscoverInterfacesOnNode', [352]);

my $xmlParser = new XML::LibXML();

my $interfaceXML = $xmlParser->parse_string($interfaceList);

 

my $xpc = new XML::LibXML::XPathContext();

$xpc->registerNs('soap', 'http://schemas.xmlsoap.org/soap/envelope/');

$xpc->registerNs('swis', 'http://schemas.solarwinds.com/2007/08/informationservice');

$xpc->registerNs('sic', 'http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract');

$xpc->registerNs('npm', 'http://schemas.solarwinds.com/2008/NPM');

 

my $requestStatus = $xpc->find('/soap:Envelope/soap:Body/swis:InvokeResponse/swis:InvokeResult/sic:Return/npm:Result', $interfaceXML)->shift()->textContent();

 

my $discoveredInterfaces = $xpc->find('/soap:Envelope/soap:Body/swis:InvokeResponse/swis:InvokeResult/sic:Return/npm:DiscoveredInterfaces', $interfaceXML)->shift();

 

if ($requestStatus eq 'Succeed') {

   my $discoveredInterfacesSoapList = SOAP::Data->type('xml' => $discoveredInterfaces->toStringC14N());

   $swis->Invoke('Orion.NPM.Interfaces', 'AddInterfacesOnNode', [352, $discoveredInterfacesSoapList, 'AddDefaultPollers']);

}

 

Our other integration option is Java, and I've gotten to about the same point here. We're using the classes provided in the SDK and modifying the SwisClient class to try to get it to add the interfaces, and as with perl, I've gotten to the point where we can get the list of discovered interfaces but cannot add them. The current relevant content of that class's main method is below - everything else is unmodified. However, unlike our perl script, this one does provide us with an error. All we're getting is the exception: EDIT: oops. I did change the method that creates the 'swis' object to point at the v3 endpoint so that the verbs are available.

 

AxisFault

faultCode: {http://xml.apache.org/axis/}HTTP

faultSubcode:

faultString: (400)Bad Request

faultActor:

faultNode:

faultDetail:

  {}:return code:  400

 

  {http://xml.apache.org/axis/}HttpErrorCode:400

 

(400)Bad Request

  at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)

  at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)

  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

  at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

  at org.apache.axis.client.Call.invoke(Call.java:2767)

  at org.apache.axis.client.Call.invoke(Call.java:2443)

  at org.apache.axis.client.Call.invoke(Call.java:2366)

  at org.apache.axis.client.Call.invoke(Call.java:1812)

  at org.tempuri.BasicHttpBinding_InformationServiceStub.invoke(BasicHttpBinding_InformationServiceStub.java:496)

  at SwisClient.main(SwisClient.java:70)

 

Code is as follows:

 

InvokeResponseInvokeResult result = swis.invoke("Orion.NPM.Interfaces", "DiscoverInterfacesOnNode", parameterWrapper);

MessageElement[] resultXmlArray = result.get_any();

Element resultXml = resultXmlArray[0];


MapNamespaceContext nsContext = new MapNamespaceContext();

nsContext.addNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");

nsContext.addNamespace("swis", "http://schemas.solarwinds.com/2007/08/informationservice");

nsContext.addNamespace("sic", "http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract");

nsContext.addNamespace("npm", "http://schemas.solarwinds.com/2008/NPM");

XPathFactory factory = XPathFactory.newInstance();

XPath xpath = factory.newXPath();

xpath.setNamespaceContext(nsContext);

NodeList nodes = (NodeList) xpath.evaluate("//npm:DiscoveredInterfaces", resultXml, XPathConstants.NODESET);

Node node = nodes.item(0);

 

parameters = new ArrayOfXmlElementXmlElement();

messageElements = new MessageElement[3];

messageElements[0] = new RPCParam("NodeID", 352);

messageElements[1] = (MessageElement) node;

messageElements[2] = new RPCParam("PollerType", "AddDefaultPollers");

parameters.set_any(messageElements);

parameterWrapper = new ArrayOfXmlElementXmlElement[1];

parameterWrapper[0] = parameters;

 

result = swis.invoke("Orion.NPM.Interfaces", "AddInterfacesOnNode", parameterWrapper);

IPAM + PowerShell

$
0
0

Greetings,

 

Used the following to get an available IP:How to use the IPAM API and get "Free IP Address"

 

Getting an error while trying to update any information:

Set-SwisObject : Operation not supported on IPAM.IPNode

 

While using the following:

 

$ip = Get-SwisData $swis 'SELECT TOP 1 I.DisplayName FROM IPAM.IPNode I WHERE Status=2 AND I.Subnet.DisplayName = ''1.1.0.0/24'''

$ipobject = Get-SwisObject -Uri (Get-SwisData $swis ('SELECT Uri from IPAM.IPNode where IPAddress = ''' + $ip + '''')) -SwisConnection $swis

 

$customProps = @{

  Description="TACOS";

}

 

Set-SwisObject -Uri $ipobject.Uri -SwisConnection $swis -Properties $customProps

 

Anyone trying to reserve IPs???

List Resources By C# Orion SDK?

$
0
0

For example in NMS web console:

1. Go Under Node Management.

2. Click List Resources to get a checklist of interfaces.

 

Can I have same operation from C#?

 

Regards

How to set select a custom property field using the SDK

$
0
0

Hello,

I am trying to leverage the example PS script to automate the setting of custom properties of my environment however I have a question about the example.  Here is the example:

 

$nodeId=8# NodeID of a node which custom properties you want to change

 

 

# prepare a custom property value

 

$customProps= @{

 

  Comments="Custom comment";

 

}

 

build the node URI

 

$uri="swis://localhost/Orion/Orion.Nodes/NodeID=$nodeId/CustomProperties";

 

# set the custom property

Set-SwisObject$swis-Uri $uri-Properties $customProps

 

 

However this example doesn't illustrate how to select the custom property column you want to set.  How would I do this?  Thank you!!

 

 

Reference: OrionSDK/CRUD.SettingCustomProperty.ps1 at PowerOrion · solarwinds/OrionSDK · GitHub

SWQL query timeout

$
0
0

How to increase timeout with error?

Thanks

 

Capture.PNG


Using Powershell to add nodes with Custom Properties for Device Type

$
0
0

Hello,
Running Orion NPM 10.6.0 and SDK 1.7 on Win2k8R2

 

Can anyone help with adding devices into Orion using Powershell?

 

To complete via NPM Web console, select Management, Edit Node.
Select groups, break down the group to a specific node.
Choose node properties, then edit node.
Custom properties show Device_Type:

12-4-2013 3-35-46 PM.png

 

Sample script adding a server fails for the custom properties:
---------------

Add-PSSnapin SwisSnapin

# initialize SWIS connection
$swis = Connect-Swis -Certificate

# add a node
$newNodeProps = @
{
EntityType="Orion.NodesCustomProperties";
DisplayName="servername_here";
Device_Type="Server_Windows";
}

$newNodeUri = New-SwisObject $swis –EntityType "Orion.NodesCustomProperties" –Properties $newNodeProps

$nodeProps = Get-SwisObject $swis -Uri $newNodeUri Orion.Nodes

Output:
PS C:\> $newNodeUri = New-SwisObject $swis -EntityType "Orion.NodesCustomProperties" -Properties $newNodeProps
New-SwisObject : Cannot bind argument to parameter 'Properties' because it is null.
At line:1 char:89
+ $newNodeUri = New-SwisObject $swis -EntityType "Orion.NodesCustomProperties" -Properties <<<<  $newNodeProps
    + CategoryInfo          : InvalidData: (:) [New-SwisObject], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SwisPowerShell.NewSwisObject

PS C:\>


Similar blog = http://thwack.solarwinds.com/message/163190#163190

Orion SDK moving to Github

$
0
0

The Orion SDK is moving to Github at https://github.com/solarwinds/OrionSDK. Currently, that includes SWQL Studio, the PowerShell snapin, and most of the samples from the existing installable SDK package. This code is being made available under the Apache 2.0 license.

 

We will be moving the documentation into the Github wiki for that project. For now there is just one page, https://github.com/solarwinds/OrionSDK/wiki/Alerts, that describes the alerting entities introduced in the 2015 Orion platform releases.

 

Our goal is to update this more continuously and not rely on infrequent numbered releases.

 

Your feedback on this is welcome. How would you like to see this managed?

REST API and AD users/groups

$
0
0

The REST API does not seem to work with SWIS URIs that contain a backslash ("\").  This shows up with Orion users linked to AD users/groups.

 

Using the PowerShell interface, (which apparently relies on SOAP) I can get-swisobject on "swis://x/Orion/Orion.Accounts/AccountID=DOMAIN\USER" (where DOMAIN\USER is an AD domain & user/group that has been granted access to NPM).

 

Using the REST interface, I get a navigation property error.  I've tried this using both Perl REST::Client and Chrome with the same result.  I've tried various combinations of quoting and escaping, but no luck.  It appears that the REST service is incorrectly converting the backslash to a forward slash and interpreting it as a navigation property filter.

 

GET URL: https://solarwinds:17778/SolarWinds/InformationService/v3/Json/swis://x/Orion/Orion.Accounts/AccountID=DOMAIN%5cUSER

 

{"Message":"Navigation property 'USER' does not exist.\u000d\u000aParameter name: uri","ExceptionType":"System.ArgumentException","FullException":"System.ArgumentException: Navigation property 'TEMP' does not exist.\u000d\u000aParameter name: uri\u000d\u000a at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveUri(SwisUri uri, IQueryExecutionContext context)\u000d\u000a at SolarWinds.InformationService.Core.CrudProcessor.Read[T](IServiceHost serviceHost, SwisUri uri, IQueryExecutionContext context)\u000d\u000a at SolarWinds.InformationService.Core.InformationService.Read(String uri)"}

Orion SDK sample script error

$
0
0

Hello,

 

I'm attempting to run a couple sample Python scripts from the Orion SDK.  I have a script I wrote myself and the 2 sample scripts from the SDK that error out with the following:

 

Traceback (most recent call last):

  File "sw-test2.py", line 18, in <module>

    results = swis.query("SELECT TOP 3 NodeID, DisplayName FROM Orion.Nodes")

  File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 24, in query

    {'query': query, 'parameters': params}).json()

  File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 50, in _req

    headers={'Content-Type': 'application/json'})

  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 50, in request

    response = session.request(method=method, url=url, **kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request

    resp = self.send(prep, **send_kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send

    r = adapter.send(request, **kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send

    raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

 

I can telnet to TCP 17778.

 

Here is one of the sample scripts:

 

import requests

from orionsdk import SwisClient

 

 

npm_server = 'X.X.X.X'

username = 'Xuser'

password = 'Xpassword'

 

 

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("Query Test:")

results = swis.query("SELECT TOP 3 NodeID, DisplayName FROM Orion.Nodes")

#results = swis.query("SELECT SysName, FROM Orion.Nodes, WHERE SysName LIKE '%ASRT%'")

 

 

for row in results['results']:

    #print("{NodeID:<5}: {DisplayName}".format(**row))

    print row

 

 

If I use curl:

 

# curl -k -v -u Xuser:Xpassword https://X.x.x.x:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+TOP+5+Caption+FROM+Orion.Nodes

*   Trying X.x.x.x...

* Connected to X.x.x.x (X.x.x.x) port 17778 (#0)

* found 173 certificates in /etc/ssl/certs/ca-certificates.crt

* found 697 certificates in /etc/ssl/certs

* ALPN, offering http/1.1

* gnutls_handshake() failed: Error in the pull function.

* Closing connection 0

curl: (35) gnutls_handshake() failed: Error in the pull function.

 

Can anyone suggest things that I should look at?

 

Thanks,

 

Mike

API works w/ 12.0 but not 12.0.1

$
0
0

I am running a script from the Solarwinds GitHub site for adding groups via API. It works on our instance of Solarwinds 12.0 but not on Solarwinds 12.0.1. In 12.0, the script runs, and returns back the new container ID and there is a new group added. In 12.0.1, the script runs, and returns back the new ContainerID, but the container is not actually added into the web interface or the DB. The Container ID is iterating up though.

 

What is difference between 12.0 and 12.0.1?   Is there a fix for this problem?

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!

Create Discovery Job based on IP ranges for large networks

$
0
0

I'M MIGRATING FROM PRTG TO SOLARWINDS FOR A LARGE NETWORK. I NEED THE ABILITY TO SCAN A /16 NETWORK BUT ONLY 100 THRU 199 IN THE FOURTH OCTET. WE WERE ABLE TO DO THIS WITH PRTG BECAUSE IT ALLOWS OCTET RANGES

For example, this was the prtg scan settings.

10.13.0-255.100-199

 

I've been trying to create a discovery job via SWIS or direct sql but while I can find my discovery profile in the db; it doesn't have the ip networks in the database that I can see

Any idea on how to do this in solarwinds or are we going to have to stay with what we have?


List Resources By C# Orion SDK?

$
0
0

For example in NMS web console:

1. Go Under Node Management.

2. Click List Resources to get a checklist of interfaces.

 

Can I have same operation from C#?

 

Regards

SQL - Bulk update Interface Statistics interval

$
0
0

Hey Guys,

 

I have a requirement to change interface statistics collection to a non global setting based on a custom property on the node level. I have the query where I pull the NodeID that match the criteria and I know the Interface properties to key on, (these are backup interfaces so we don't need the frequency of stats that are global default)

 

I want to know if its simply changing the column value StatCollection in the Orion.NPM.Interfaces table.

 

Something along the lines of

 

update Orion.NPM.Interfaces

set StatCollection = '30'

where NodeID = 'XYZ'

Add pollers and interfaces via SDK

$
0
0

Howdy,

 

  When we add a node manually via the Orion GUI, setting the interfaces and pollers are steps in the process.

I have been able to script adding nodes, but must then go in to set the poller and interfaces via the GUI.

 

Can someone let me know what to send in order to add these two configurations after adding a new node?

 

 

Please advise,

Kev!

Avaya monitored by Solarwinds

$
0
0

I am working on getting solarwinds orion to monitor Avaya ip phones and trunk groups, has any one done this before?

PowerShell or Python ?

$
0
0

Ive taken a few python classes at school a while back and while I enjoyed it I never used it too much in the real world. From doing research and reading various posts I seem to have this feeling that knowing powershell vs python would put me in a much better position to excel as a SolarWinds admin.  Curious on Tdanners and others thoughts. 

Viewing all 3719 articles
Browse latest View live


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