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

Permissions required for CRUD operations

$
0
0

So I am trying to use the CRUD operations (New-SwisObject, Set-SwisObject, Remove-SwisObject) to add and modify custom properties for IPNodes.  So far to do this it seems that full Orion Admin is required, in addition to IPAM Admin.

 

Can anyone confirm the permission levels needed for the CRUD operations to work and if there is any way to use them without full Orion Admin access.


Did SWQL subqueries break in npm 12.2?

$
0
0

All,

Did SWQL subqueries change in NPM 12.2?  I recently upgraded and noticed I had some reports not working.  This looks for sites that dont have some devices in them.  But its not returning the List of sites that it should:

 

Select NC.City

FROM Orion.NodesCustomProperties NC

WHERE City NOT IN (

SELECT

NC.City

FROM Orion.Nodes 

INNER JOIN Orion.NodesCustomProperties NC ON (Nodes.NodeID = NC.NodeID)

WHERE (Nodes.MachineType LIKE '%36%')

AND (Nodes.Status <> '2')

)

Device Reachability Information from the Orion Schema

$
0
0

Hi Team,

 

I am interested to know how can I measure the device reachability using the SWIS API. Basically I am looking for a specific table and corresponding attribute which can directly help me calculate the device reachability .

 

My initial thinking was to use Percent Loss value from Orion.ResponseTime table. But this does not seem to be give me the reachability value directly. Any help is appreciable?

 

Existing SWIS Query:

https://localhost:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID,PercentLoss,DateTime+FROM+Orion.ResponseTime+WHERE+NodeID=8+AND+

 

NameTypeNotes
NodeIDSystem.Int32
DateTimeSystem.DateTime
ArchiveSystem.Byte
AvgResponseTimeSystem.Int16
MinResponseTimeSystem.Int16
MaxResponseTimeSystem.Int16
PercentLossSystem.Int16
PercentDownSystem.Double
AvailabilitySystem.Double
ObservationTimestampSystem.DateTime
ObservationFrequencySystem.DateTime
WeightSystem.Double          Default='1.0'.        
DisplayNameSystem.String
DescriptionSystem.String
InstanceTypeSystem.Type
UriSystem.String
InstanceSiteIdSystem.Int32          Default='0'.        
NodeOrion.Nodes                 Defined by relationship Orion.NodesHostsResponseTime (System.Hosting

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

Server count KPIs group by

$
0
0

Hi, can someone assist please.


I am trying to create custom SWQL report that will count all my current OS and group them by the BusinessUnit.  Both fields are custom properties.

However, when I group by the BusinessUnit custom properties, only the 'Windows OS Count' is group, whereas, the others show the total count.

 

Header 1

select  cp.os_cbu as [Customer Business Unit], count(cp.MachineType_Pool) as [Windows OS Count],

 

 

(select Count(cp.MachineType_Pool) as [Linux OS Count]

from orion.nodes n

left join orion.NodesCustomProperties cp on n.NodeID = cp.NodeID

where cp.Asset_Type = 'server' and cp.MachineType_Pool = 'Linux' ) as [Linux OS Count],

 

 

(select Count(cp.MachineType_Pool) as [Solaris OS Count]

from orion.nodes n

left join orion.NodesCustomProperties cp on n.NodeID = cp.NodeID

where cp.Asset_Type = 'server' and cp.MachineType_Pool = 'Solaris' ) as [Solaris OS Count]

 

 

from orion.nodes N

left join orion.NodesCustomProperties cp on n.NodeID = cp.NodeID

where cp.asset_type = 'server' and cp.MachineType_Pool = 'windows'

 

 

group by cp.OS_CBU

 

Results

 

 

Can you help in getting all of the OS Count to sort by the Customer Business Unit.  Applying the same 'Windows OS Count' to the 'Linux and Solaris OS Count', and not displaying the full total.


Thanks much!

Device Reachability Information from the Orion Schema

$
0
0

Hi Team,

 

I am interested to know how can I measure the device reachability using the SWIS API. Basically I am looking for a specific table and corresponding attribute which can directly help me calculate the device reachability .

 

My initial thinking was to use Percent Loss value from Orion.ResponseTime table. But this does not seem to be give me the reachability value directly. Any help is appreciable?

 

Existing SWIS Query:

https://localhost:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID,PercentLoss,DateTime+FROM+Orion.ResponseTime+WHERE+NodeID=8+AND+

 

NameTypeNotes
NodeIDSystem.Int32
DateTimeSystem.DateTime
ArchiveSystem.Byte
AvgResponseTimeSystem.Int16
MinResponseTimeSystem.Int16
MaxResponseTimeSystem.Int16
PercentLossSystem.Int16
PercentDownSystem.Double
AvailabilitySystem.Double
ObservationTimestampSystem.DateTime
ObservationFrequencySystem.DateTime
WeightSystem.Double          Default='1.0'.        
DisplayNameSystem.String
DescriptionSystem.String
InstanceTypeSystem.Type
UriSystem.String
InstanceSiteIdSystem.Int32          Default='0'.        
NodeOrion.Nodes                 Defined by relationship Orion.NodesHostsResponseTime (System.Hosting

Custom SWQL resource

Powershell scripts to automatically unmanage\remanage a node using the Orion SDK

$
0
0

First, I'll share the script. Then, I'll explain why we need it and how it helps us in our environment.

To use the script you must have the Orion SDK installed on the monitored node.

 

Take the text below, paste in Powershell ISE and save it as a PS1.

------------------------------------ Start PS1 -----------------------------------------------------------------

 

# 2014-07-21 Node Unmanage script for SolarWinds SDK Powershell

# by Joe Dissmeyer | Thwack - @JoeDissmeyer | Twitter - @JoeDissmeyer | www.joedissmeyer.com

# This script will unmanage a single node in the Orion database. First, it finds the node number in the Orion database, then it will unmanage it for 99 years.

# This script assumes you are running it LOCALLY from an already managed node AND that the machine has the Orion SDK v1.9 installed on it.

# If the machine is not already managed in SolarWinds this script will fail without warning.

# Replace ORIONSERVERNAME with the appropriate values.

# ORIONSERVERNAME = Your Orion poller instance. (Ex. 'SOLARWINDS01.DOMAIN.LOCAL'). Single quotes are important.

 

# Load the SolarWinds Powershell snapin. Needed in order to execute the script. Requires the Orion SDK 1.9 installed on the machine this script is running from.

Add-PSSnapin SwisSnapin

 

 

# SolarWinds user name and password section. Create an Orion local account that only has node management rights. Enter the user name and password here.

$username = "SWnodemanagement"

$password = "MyP@44w0$d"

 

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

$secstr = New-Object -TypeName System.Security.SecureString

$password .ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secstr

 

# The actual job

$ORIONSERVERNAME = 'SWServer1.domain.local'

$nodename = $env:COMPUTERNAME

 

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

$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"

$now =[DateTime ]:: Now

$later =$now.AddYears(99)

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

 

------------------------------------ End PS1 -----------------------------------------------------------------

 

 

 

And now the Remanage script. Again, save as a .PS1 file.

------------------------------------ Start PS1 -----------------------------------------------------------------

 

# 2014-07-21 Node Remanage script for SolarWinds SDK Powershell

# by Joe Dissmeyer | Thwack - @JoeDissmeyer | Twitter - @JoeDissmeyer | www.joedissmeyer.com

# This script will remanage a single node in the Orion database.

# This script assumes you are running it LOCALLY from an already managed node AND that the machine has the Orion SDK v1.9 installed on it.

# If the machine is not already managed in SolarWinds this script will fail without warning.

# Replace ORIONSERVERNAME with the appropriate values.

# ORIONSERVERNAME = Your Orion poller instance. (Ex. 'SOLARWINDS01.DOMAIN.LOCAL'). Single quotes are important.

 

 

# Load the SolarWinds Powershell snapin. Needed in order to execute the script. Requires the Orion SDK 1.9 installed on the machine this script is running from.

Add-PSSnapin SwisSnapin

 

 

# SolarWinds user name and password section. Create an Orion local account that only has node management rights. Enter the user name and password here.

$username = "SWnodemanagement"

$password = "MyP@44w0%d"

 

 

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

$secstr = New-Object -TypeName System.Security.SecureString

$password .ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secstr

 

 

# The actual job

$ORIONSERVERNAME = 'SWServer1.domain.local'

$nodename = $env:COMPUTERNAME

 

 

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

$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"

$now =[DateTime ]:: Now

$later =$now.AddYears(99)

Invoke-SwisVerb $swis Orion.Nodes Remanage @("N: $nodeid ", $now ,$later , "false")

 

------------------------------------ End PS1 -----------------------------------------------------------------

 

Explanation:

My company had a very unique need to monitor our enterprise Windows application that runs not only on standard desktop PCs, but also runs on mobile tablets connected to WiFi access points. These tablets run the standard Windows 7 Professional OS so it makes it easy to set up application monitoring in SolarWinds SAM for these machines. However, the problem comes at the end of the day when these tablets are turned off and placed in their charging docks for the night. As you can imagine, this creates an administrative nightmare (not to mention an email alert flood) in SolarWinds when this happens.

 

SolarWinds Orion NPM and SAM is designed to always keep an eye on a node or application that is entered in it's database. It is not designed to monitor an application or node only "part of the time" --- well, at least it isn't designed for this purpose out of the box. So instead, we have to create a workaround that will suit our needs. What we needed to do was figure out how to automatically "unmanage" these Windows tablet PCs in SolarWinds when they are shut down for the night, but also automatically "re-manage" them once they boot up. This is where the script comes into play.

 

The idea is to take the Unmanage script and apply it as a shut down script in Group Policy, then take the Remanage script and apply it as a boot up script in Group Policy.

Here is why this works for us:

The business is supposed to gracefully shut down the tablet by clicking Start > Shut down. If not, then an email alert triggers that informs us that the application is down on the machine.

If the tablet goes offline in the middle of the day for any reason, we will receive an email alert about that node.

When the machine is shut down properly, the node is automatically unmanaged in SolarWinds.

When the machine boots up and someone logs into the machine, the node is automatically remanaged in SolarWinds.

 

But here is an even better use for these scripts --- Scheduled Server Maintenance! How many times have we, server administrators, had to patch Windows Servers during scheduled maintenance hours? Normally you would have to go into SolarWinds and unmanage the node first BEFORE rebooting as not to trigger an email alert. Well with these scripts you wouldn't have to worry about that as much since this would be automatic.

 

Final notes:

Of course, this is just one way to go about auto-managing nodes in SolarWinds. There are some alternatives to doing this using the Orion SDK and Powershell which is to, instead, use the built-in .NET properties in Powershell 2.0 to access the Orion SQL database directly, find the node ID, and unmanage it in that manner. For those that are interested in how do to this without the Orion SDK, let me know and I'd be happy to elaborate.


Difference between SWQL Studio and SWQL in EOC

$
0
0

The new EOC makes heavy use of SWQL to report on multiple Orion instances at once, but I've stumbled over what appears to be a major difference (of which I'm sure the issue is on the EOC side and have posted in their forum:

 

Using just a simple SWQL query, even against a single Orion from the EOC, it appears that there is an error where two values with the same column name cannot be selected, even if they are renamed:

 

select NodeID, v.Node.Caption, VolumeID, v.Caption, VolumeType, VolumeSize   
from Orion.Volumes v 

Any thoughts on what could cause this difference in behavior?

Invoking Orion.Views - AddViewToGroup

$
0
0

Hello Orion SDK Community,

 

I'm Invoking the following verb as an attempt to join two pages together into a viewgroup with a tabbed interface (the same as if you customized a view, enabled the tabbed interface option, and added a new tab)

I'm not sure why this isn't working, as I believe I am setting the properties correctly.

 

As a test, I create two separate views, and then use SWQL studio to invoke the AddViewToGroup verb setting the parameters as follows:

 

viewID: (viewID of the first resource)

targetViewID: (viewID of the second resource)

viewIcon: Overview.png

viewCondition: (not a required property, I've tried leaving this empty or setting to true)

 

The result is that when this is submitted, and you browse to the targetViewID, two pages are not seen, only one.

Customizing the page reveals the tabbed interface is enabled and the pages are both seen grouped together in the customize view, yet they only one page appears.

Reviewing the database, values all seem correct (ViewGroupID is the same, ViewGroupPostions are 1 and 2) yet the page does not display the tabbed interface.

 

Is there something I am missing here? Perhaps I'm setting values incorrectly?

Any help is greatly appreciated.

 

Thank you,

 

=swql

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

Solarwinds Orion.Accounts

$
0
0

How can i pass values to Orion.Accounts to Create an Account using powershell?

 

$groupId = (Invoke-SwisVerb $swis "Orion.Accounts" "CreateAccount"  @(

   ([xml]@(   

          "<AccountType>System</AccountType>","<dictionary></dictionary>"),([xml]@( 

   "<dictionary xmlns='http://schemas.solarwinds.com/2007/08/informationservice/propertybag'>$newNodeProps</dictionary>")).DocumentElement).InnerText 

 

Also, How to pass property parameter to dictionary element?

SWIS v3 Rest API calls not working as domain user

$
0
0

I have this powershell script:

 

      $server = "server"

      $credential = Get-Credential

      $query = "https://"+$server+":17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT nodeid FROM orion.nodes"

      $results = Invoke-RestMethod -method Get -Uri $query -Credential $credential -DisableKeepAlive

 

If I use an orion account with NCM privileges it works fine.  If I use a domain account, I get a 403 forbidden.  I've tested in both production and development and it's occurring.  I've changed the account the service runs under to a domain service account, but I still get the same error.

 

Any thoughts?

Custom SWQL resource

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?


Updating properies of IPAM object with Powershell

$
0
0

I have found bits and pieces of information regarding this in the forums, on sdk pdfs, etc.  So far I have had no luck.

 

Is it possible to update properties of an object in IPAM using Powershell?

 

Is it possible to update custom properties of an object in IPAM using Powershell?

 

Can I do either of these without my user being a full Orion administrator?

Set node custom properties using PowerShell Rest API

$
0
0

Hello,

 

I was able to add Orion node using the below per Re: SWIS REST/JSON API

$url = "https://server:17778/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes"

 

Invoke-RestMethod -Uri $url -Method POST -Body $body -Credential $Credential -ContentType application/json

 

But when I attempted to set the custom properties for the node per the link PowerShell script to modify a NODE Custom Property via Rest API/JSON

using the code below,

 

$swisUri = "swis://server/Orion/Orion.Nodes/NodeID=$($NodeID)/CustomProperties"

$url = "https://server:17778/SolarWinds/InformationService/v3/Json/$swisUri"

 

$customProp = @{

    AssignmentGroup='Supportgroup';

    Category='Physical';

    NodeApplication='Application';

    Comments='Application server';

}

 

$body = ConverTo-Json $customProp

Invoke-RestMethod -Uri $url -Method POST -Body $body -Credential $Credential -ContentType application/json

 

I did not get any error, but the custom properties of the node were not set.

 

Per the link Re: SWIS REST/JSON API , there is a work-around using:

 

POST https://servername:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.Reporting/ExecuteSQL

["Insert into NodesCustomProperties (NodeID) VALUES (13)"]

 

How can I construct the Insert statement in the json body above?

 

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

Updating properies of IPAM object with Powershell

$
0
0

I have found bits and pieces of information regarding this in the forums, on sdk pdfs, etc.  So far I have had no luck.

 

Is it possible to update properties of an object in IPAM using Powershell?

 

Is it possible to update custom properties of an object in IPAM using Powershell?

 

Can I do either of these without my user being a full Orion administrator?

Solarwinds Orion.Accounts

$
0
0

How can i pass values to Orion.Accounts to Create an Account using powershell?

 

$groupId = (Invoke-SwisVerb $swis "Orion.Accounts" "CreateAccount"  @(

   ([xml]@(   

          "<AccountType>System</AccountType>","<dictionary></dictionary>"),([xml]@( 

   "<dictionary xmlns='http://schemas.solarwinds.com/2007/08/informationservice/propertybag'>$newNodeProps</dictionary>")).DocumentElement).InnerText 

 

Also, How to pass property parameter to dictionary element?

Viewing all 3719 articles
Browse latest View live