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

Not able to insert the node details through script

$
0
0

Hello,

 

I am running this below powershell script. But the device never shows the node details like the Machine type, Vendor icon, IOS version in Solarwinds, also it is always shown as unknown device group.

 

How can we ensure that the node is added as a Cisco vendor device and shows all the Node details after the first polling.

 

$newNodeProps = @{

EntityType="Orion.Nodes";

IPAddress="10.0.0.1";

Caption="CORE-SWITCH-0001";

DynamicIP=$False;

EngineID=1;

Status=1;

UnManaged=$False;

Allow64BitCounters=$False;

SysObjectID="";

MachineType="Cisco";

VendorIcon="9.gif";

ObjectSubType="SNMP";

SNMPVersion=2;

Community="public";

Brand="Retail";

City="California";

Country="US";

LocationID="22";

StoreName="California";

}

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

$nodeProps = Get-SwisObject $swis -Uri $newNodeUri

$poller = @{

NetObject="N:"+$nodeProps["NodeID"];

NetObjectType="N";

NetObjectID=$nodeProps["NodeID"];

}

$poller["PollerType"]="N.Details.SNMP.Generic";

$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

$poller["PollerType"]="N.Uptime.SNMP.Generic";

$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

$poller["PollerType"]="N.Cpu.SNMP.CiscoGen3";

$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

$poller["PollerType"]="N.Memory.SNMP.CiscoGen3";

$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller


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”.  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

UDT SQL Query: Get user device switch by MAC or host name

$
0
0

We have need to perform SQL query to UDT tables database which could find nearest switch where user device is connected currently.

Any advice what tables to use for query?

Somethings changed...

$
0
0

So, I've written an application quite a while ago that has been working for a while now in production within my environment.  Its just a small helper application to quickly identify those machines in maintenance mode and to also set maintenance mode on existing nodes within Solarwinds.  I just realized today that it's no longer setting maintenance mode on the devices.    It's querying the systems no problem for those under maintenance.

 

I stepped through the code and the swis is returning the proper results but the function is setting maintenance mode.

 

So, question is.. Anyone else seen something similar lately with updates?  When I developed the application we were on SDK 1.6 and I've done no updates to the SDK.  Is this a problem?

 

Thanks for any help in advanced.

Get-SwisObject : An error occurred when verifying security for the message.

$
0
0


I am trying to connect to SolarWinds server from a different server and run a powershell script.  My ultimate goal is mark an IP address as available.  I can get the connection established, but as soon as I do a Get-SwisObject I get a security message.

 

Get-SwisObject : An error occurred when verifying security for the message.

 

If I put in a bogas password, I get the same message, so I guess I am not convinced that I am actually getting connected to my solarwinds server.

 

Here is my script:

 

If (!(Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) {
    Add-PSSnapin "SwisSnapin"
}

 

$hostname = "solar.mycompany.com"
$username="admin"
$password="1234567"

 

$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))

 

#Connect to the System
$target = Connect-Swis -v2 -Credential $cred -Hostname $hostname

 

#Get all URIs of Nodes in the System
$UriBasket = Get-SwisData $target "SELECT Uri FROM Orion.Nodes"

 

I searched high and low and I can not find what this error means (An error occurred when verifying security for the message.).

 

FYI, I am able to log on with the same account via a web browser, so I know the account has access.

 

Any help would be greatly appreciated.

 

Not sure I put this in the right group either.

 

Thanks, Jon

SDK 1.8 Powershell snapin installation problem

$
0
0

I have used SDK 1.6 earlier.

Now I have updated to 1.8 but I cannot load SWIS snapin.

On PowerShell I get following error when trying to perform Add-PSSnapin SwisSnapin:

******************

Add-PSSnapin : Cannot load Windows PowerShell Snap-In swisSnapin because of the following error: The Windows PowerShell Snap-In module C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll does not have required Windows PowerShell Snap-In strong name SwisPowerShell, Version=1.6.54.0, Culture=neutral, PublicKeyToken=null.

******************

 

I also tried to install 1.8 to clean machine which didn't have 1.6, but error there is:

******************

Add-PSSnapin : The Windows PowerShell snap-in 'SwisSnapin' is not installed on this machine.

******************

 

Documentation says that snapin is automatically registered, but now it seems that that doesn't work.

Getting NTA 4's Top Conversations via REST or SOAP API

$
0
0

I've been searching a bit for how to construct a query for Top Conversations in SWQL Studio, or even just via curl, but haven't been too successful. I did find this thread discussing NTA 3:

Problem getting data using SWQL studio from Orion.Netflow.ConversationsTop NTA 3.11

 

Is NTA 4 still only using the SOAP interface? Does anyone have pointers for getting data out using a simple tool like curl? Even just getting the Top 5 Conversations over all devices would be a good start.

UDT SQL Query: Get user device switch by MAC or host name

$
0
0

We have need to perform SQL query to UDT tables database which could find nearest switch where user device is connected currently.

Any advice what tables to use for query?


Using the SDK powershell snap in - some newbie questions

$
0
0

Hi all,

Just getting started doing an integration between Orion and some of our other tools. Have been through the SDK 1.3 and found some useful stuff in there especially around the kind of things we're looking to do like:

- create/remove a new node

- Add pollers

- Get a list of nodes

 

So I have some questions and please excuse me if these are trivial, but I think it's important we get this right at the outset. To set the scene my plan is to use the powershell cmdlets to do my integrations. So to the questions:

1. The Connect-Swis cmdlet - can it take the user/pw as parameters? If so how? eg:

     $swis = Connect-Swis -user myuser -pw mypassword

 

2. To create a node, i can use the New-SwisObject cmdlet. There are basically 2 instances where I'd want to do this: creating a server or a network device like a switch etc. In either case, is it necessary to add one or more interfaces for that Orion.Node object or will Orion discover the interfaces when it polls it and add them itself?

3. Follow on from Q2 - can I force Orion to poll the device once I've added it?

4. Is it always necessary to use the NodeID when querying for a Orion.Node object? I've tried to use a select statement to do a query using "where Caption='myhost'" but it doesn't seem to like that.

Powershell cmdlet Extensions for Solarwinds SDK

Somethings changed...

$
0
0

So, I've written an application quite a while ago that has been working for a while now in production within my environment.  Its just a small helper application to quickly identify those machines in maintenance mode and to also set maintenance mode on existing nodes within Solarwinds.  I just realized today that it's no longer setting maintenance mode on the devices.    It's querying the systems no problem for those under maintenance.

 

I stepped through the code and the swis is returning the proper results but the function is setting maintenance mode.

 

So, question is.. Anyone else seen something similar lately with updates?  When I developed the application we were on SDK 1.6 and I've done no updates to the SDK.  Is this a problem?

 

Thanks for any help in advanced.

JSON query against NCM returns no results

$
0
0

This query against the NPM data works.

 

https://10.10.10.10:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT%20NodeID%20FROM%20Orion.Nodes

 

Neither of these queries return any results.

 

https://10.10.10.10:17778/SolarWinds/InformationService/v2/Json/Query%3Fquery%3DSELECT+NodeID+FROM+NCM.Nodes

https://10.10.10.10:17778/SolarWinds/InformationService/v2/Json/Query?query=SELECT%20NodeID%20FROM%20NCM.Nodes

 

I suspected that I might have had a permissions issue, but I tried it with the Orion admin account and got the same results. I don't get a "you're doing it wrong" type message or anything.

 

I'm sure there's something glaringly obvious that I'm missing so if someone would point that out, I'd appreciate it.

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!

SDK 1.8 Powershell snapin installation problem

$
0
0

I have used SDK 1.6 earlier.

Now I have updated to 1.8 but I cannot load SWIS snapin.

On PowerShell I get following error when trying to perform Add-PSSnapin SwisSnapin:

******************

Add-PSSnapin : Cannot load Windows PowerShell Snap-In swisSnapin because of the following error: The Windows PowerShell Snap-In module C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll does not have required Windows PowerShell Snap-In strong name SwisPowerShell, Version=1.6.54.0, Culture=neutral, PublicKeyToken=null.

******************

 

I also tried to install 1.8 to clean machine which didn't have 1.6, but error there is:

******************

Add-PSSnapin : The Windows PowerShell snap-in 'SwisSnapin' is not installed on this machine.

******************

 

Documentation says that snapin is automatically registered, but now it seems that that doesn't work.

Using sample.pl to create simple nodes

$
0
0

All,

I’m new to SolarWinds and Orion and using your API with Perl.  I can query the CMDB for existing node information using the sample.pl program so I know I have connectivity. Now I’m trying to add a node and am a little confused.  As directed, I checked the “Orion SDK.pdf” document for details on adding a node, and that pointed me to a table titled “Required Properties by Protocol”.  I’m trying to simply add a device for ICMP monitoring and according to the table, the minimum information I need to supply is the following;

 

EntityType – “Orion.Nodes”

IPAddress - <Simple IPv4 address>

IPAddressGUID - <?????????>

Caption - <Node/device name>

DynamicIP – “False”

EngineID – “1” (I assume)

Status – “1”

UnManaged – “False”

Allow64BitCounter – “False”

ObjectSubType – “ICMP”

 

Can someone tell me where I get an IPAddressGUID?  Is it necessary?

Thanks.


Queries regarding Orion SDK

$
0
0

Hi,

 

I am a newbie to Orion SDK . we actually want to implement/deploy SDK in our production environment. I had some queries..maybe some one can help me out..:

- we are running NPM v10.3 and soon gonna be using Orion FoE(Failover engine),I hope SDK's latest version is compatible with it.

- we have a inhouse developed CMDB, can SDK connect to that ?

- also can you please redirect me to some release note or installation guide, to better understand Orion SDK

 

Many thanks in advance.

 

Regards,

mohit

Need Help Converting SQL Report Writer Code to SWQL - Down Time Duration

$
0
0

Here is Report Writer SQL code that produces the duration of down time for a node.  I need to be able to convert this to SWQL and populate the 'hours down' time into a custom property field.  I want to use the 'hours down' time custom property field in conjunction with changing Google map Icon colors once time frame meets specified thresholds.   I'm not very savvy with SQL or coding so all suggestions are welcome.  Thanks everyone.  

 

SELECT     DATEDIFF(hh, T1.DownTime, CURRENT_TIMESTAMP) AS HoursDown, Nodes.Caption, Nodes.IP_Address,

T1.DownTime, Nodes.NodeID

FROM         (SELECT     MAX(EventTime) AS DownTime, NetObjectID, NetworkNode

                       FROM          Events

                       WHERE      (EventType = 1) AND (NetObjectType = 'N')

                       GROUP BY NetObjectID, NetworkNode) AS T1 INNER JOIN

                      Nodes ON T1.NetworkNode = Nodes.NodeID

WHERE     (Nodes.Status = '2') AND (Nodes.Owner = 'RHD')

ORDER BY HoursDown DESC, Nodes.Caption, T1.DownTime DESC, Nodes.NodeID

 

Output from this Query:

HoursDownNodeIP AddressDownTimeNode ID
139rtr.316864.ph.us.tgr.net10.165.4.111/2/2012 14:1818188
131rt2.023675.ph.us.tgr.net10.180.119.211/2/2012 22:1316384
120rt2.013146.ph.us.tgr.net10.81.4.211/3/2012 9:5615487
63rt2.013426.ph.us.tgr.net10.250.112.211/5/2012 18:1315560
42rtr.023040.ph.us.tgr.net10.80.164.111/6/2012 15:4816194
41rt2.012626.ph.us.tgr.net10.81.76.211/6/2012 16:5515348
39rt2.013236.ph.us.tgr.net10.7.34.211/6/2012 18:2215534
39rtr.023016.ph.us.tgr.net10.80.141.111/6/2012 18:0116174
36rt2.008384.ph.us.tgr.net10.74.64.211/6/2012 21:1314776
24rt2.026530.ph.us.tgr.net10.76.43.211/7/2012 9:4617140
17rt2.013122.ph.us.tgr.net10.81.94.211/7/2012 16:1115475
17rt2.013139.ph.us.tgr.net10.81.103.211/7/2012 16:1815484
16rtr.012934.ph.us.tgr.net10.82.80.111/7/2012 17:4815429
15rt2.006231.ph.us.tgr.net10.13.12.211/7/2012 18:2814567

How to create array of arguments for Unmanage/Remanage? (C#)

$
0
0

I am trying to write a method for Unmanaging and Remanaging nodes in Orion, in C#. Using the CSClient example, I've been able to write a query Orion for a NodeID based on sysname. However, when I want to Invoke("Orion.Nodes", "Unmanage", args) I don't know how to correctly create the ArrayOfXMLElement that the method seems to want. I tried modifying the code used for the alert example, but it gives me "FaultException`1" when I try it. I created the data object to store the arguments based on the column names in the Nodes table. I am using VS2010, .net 4.0, Orion 2012.2.0, and SDK 1.6. I am very new at this so please be gentle :-) The portion of the code that gets the NodeID based on sysname works fine.

 

This is what my code looks like:

 

using System;

using System.Net;

using System.Runtime.Serialization;

using System.Xml;

using System.Linq;

using System.Xml.Linq;

using System.Xml.XPath;

using CSClient.SWIS;

 

namespace CSClient

{

    class Program

    {

        static void Main()

        {

            const string hostname = "myorionserver";

            const string username = @"myuser";

            const string password = "mypassword";

           

            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;

 

            var client = new InformationServiceClient("BasicHttpBinding_InformationService", string.Format("https://{0}:17778/SolarWinds/InformationService/v3/OrionBasic", hostname));

            client.ClientCredentials.UserName.UserName = username;

            client.ClientCredentials.UserName.Password = password;

            client.Open();

            var nodeIDInfo = client.QueryXml("SELECT TOP 1 NodeID from Orion.Nodes WHERE sysname like 'targetserver' RETURN XML AUTO", null);

            nodeIDInfo.Save(@"c:\temp\orionoutput.xml");

            var nodeID = nodeIDInfo.XPathSelectElement("//*[local-name()='NodeID']").Value;

            Console.WriteLine("Node ID is " + nodeID.ToString());

 

            string unmanageFrom = DateTime.Now.ToString();

            string unmanageUntil = DateTime.Now.AddHours(6).ToString();

 

            var unmanageInfo = new UnmanageInfo

            {

                NodeID = nodeID,

                UnManageFrom = unmanageFrom,

                UnManageUntil = unmanageUntil

            };

            var unmanaged = new[] { unmanageInfo };

 

            var dcs = new DataContractSerializer(unmanaged.GetType());

            var doc = new XmlDocument();

            using (var writer = doc.CreateNavigator().AppendChild())

            {

                dcs.WriteObject(writer, unmanaged);

            }

 

            var arguments = new ArrayOfXmlElement { XDocument.Load(new XmlNodeReader(doc)).Root };

            var result2 = client.Invoke("Orion.Nodes", "Unmanage", arguments);

            Console.Write(result2);

            Console.Read();

        }

 

        [DataContract(Name = "UnmanageInfo", Namespace = "http://schemas.solarwinds.com/2008/Orion")]

        public class UnmanageInfo

        {

            [DataMember(Order = 1)]

            public string NodeID;

 

            [DataMember(Order = 2)]

            public string UnManageFrom;

 

            [DataMember(Order = 3)]

            public string UnManageUntil;

 

        }

 

    }

}

How to query the SWIS JSON interface using curl?

$
0
0

I thought I'd try curl before implementing it in the client, but all queries end in

curl: (7) Failed connect to 192.168.0.101:17778; Connection timed out

 

I've read the "SWIS REST/JSON API" thread, but can't figure out, why it doesn't work.

 

This is what I tried on a laptop in the server network:

curl --user myuser:mypass https://192.168.0.101:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.Nodes

 

I can connect in and run the query from SWQL Studio (same user, pass) just fine. Does the user have to have a special permission or is there a special setting to enable the query-interface, maybe?

 

Update:

If I try to connect to https://192.168.0.101:17778/SolarWinds/InformationService in a Browser, I get "The connection has timed out, The server at 192.168.0.101 is taking too long to respond.", but both SWIS and SWIS V3 Services are running.

 

Solution:

It was a firewall issue, had to create an exception for port 17778 in the Windows Firewall on the server (see Open a port in Windows Firewall - Microsoft Windows Help ) or just disable it.

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

Viewing all 3719 articles
Browse latest View live


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