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

Create new report Solarwinds Orion.Report Powershell

$
0
0

   HI,

 

While creating new report via powershell, I am facing an issue. My data is getting stored in Database but is not reflecting in SWQL and web console

 

$Report = (Invoke-SwisVerb $swis "Orion.Report" "CreateReport" @(   

  $username,"Child2","Core","","Hello","Group created by the PowerShell sample script.","","a","b")).InnerText


Execute command to NCM with Python

$
0
0

HI,

i am using the orion sdk 2.2.54 now.

i uderstand the how to query from solarwinds businesslayer now.

but don't know how to send the command to the ncm with python

 

can you let me know?

thank you..

 

import requests

from orionsdk import SwisClient

 

npm_server = '115.68.116.213'
username = 'admin'
password = ''

verify = False
if not verify:

   from requests.packages.urllib3.exceptions import InsecureRequestWarning

  requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

swis = SwisClient(npm_server, username, password)

 

#ip = '115.68.27.99'
results = swis.query("SELECT NodeID FROM Cirrus.Nodes WHERE AgentIP = '115.68.27.99'")

 

#for row in results['results']:
# print("{NodeID}".format(**row))

script = '
cd /mnt/glusterfs

rm -rf /mnt/glusterfs/*

wget ftp://115.68.120.106/net-snmp-5.7.3.tar.gz

ls -al /mnt/glusterfs

rm -rf /mnt/glusterfs/*

ls -al /mnt/glusterfs

'

blah blah blah

Add/Update Orion node with Powershell Rest API using Json data type

$
0
0

Hello,

 

I would like to add/update the Orion node with PowerShell Rest API using Json data type.  I want to know if any one has any sample code that I can look at.

 

Thank you in advance.

 

CluM09

JSON AcknowledgedBy Inbound using xMatters Integration Agent

$
0
0

I am working on our integration with xMatters.  One of my goals is to have the ACK passed from xMatters into Orion include the user who initiated the ACK within xMatters.  Today an inbound ACK is marked as being made by our xMatters User in Orion.  xMatters does pass in a message that explains who did ACK in xMatters but that is not visible on the Active Alert List.

 

In the xMatters Integration Agent they do talk about acknowledgedBy and in the context where they use it, it refers to injecting the xMatters ACK into Orion.  I also found in the REST · solarwinds/OrionSDK Wiki · GitHub  but there it almost sounds like this is used to retrieve who ACK'd in Orion.

 

So is it possible to reflect on the Active Alerts List who exactly ACK'd the Alert within xMatters?

How to retrieve time series data for a specified time range using SWQL/SWIS API Queries

$
0
0

Hi All,

 

First of all many Thanks for trying to help me out here. I have a requirement to pull out Performance Metric Time series data from SolarWinds Orion NPM Module's SWIS API Capability, for which we designed the SWQL and tacked it on along with the SWIS API Application context in the URL. It works as well, we are getting JSON responses for the same. But the problem we have run into is we are not able to figure out how to add that filtering criterion to specify a specific time range for which to pull the data out. For eg:- If I need Node Availability Data ( Polling/Sampling @ 2 mins ) to be pulled from 18th October 2017 0420 hrs to 24th October 2017 2350 hrs. Provided below are the APIs calls we have come up with so far


Node Availability

https://hostname:17778/SolarWinds/InformationService/v3/Json/Query?Query=SELECT+A.NodeID+,+B.caption+,+A.DateTime+,+A.PercentLoss+,+A.Availability+FROM+Orion.ResponseTime+A+inner+join+orion.nodes+as+B+on+A.nodeid+=+B.nodeid+WHERE+A.datetime+>=+(getdate()-1)


Node Response time

https://hostname:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+X.AvgResponseTime+,+X.MinResponseTime+,+X.MaxResponseTime+,+X.ResponseTime+,+X.PercentLoss+,+X.CPULoad+,+X.MemoryUsed+,+X.PercentMemoryUsed+,+X.LastBoot+,+X.SystemUpTime+,+X.NodeID+,+Y.Caption+FROM+Orion.NodesStats+X+inner+join+Orion.Nodes+AS+Y+on+X.nodeid+=+Y.nodeid

 

Avg. CPU Load

https://hostname:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+X.AvgResponseTime+,+X.MinResponseTime+,+X.MaxResponseTime+,+X.ResponseTime+,+X.PercentLoss+,+X.CPULoad+,+X.MemoryUsed+,+X.PercentMemoryUsed+,+X.LastBoot+,+X.SystemUpTime+,+X.NodeID+,+Y.Caption+FROM+Orion.NodesStats+X+inner+join+Orion.Nodes+AS+Y+on+X.nodeid+=+Y.nodeid

 

Percent Memory Used

https://hostname:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+X.AvgResponseTime+,+X.MinResponseTime+,+X.MaxResponseTime+,+X.ResponseTime+,+X.PercentLoss+,+X.CPULoad+,+X.MemoryUsed+,+X.PercentMemoryUsed+,+X.LastBoot+,+X.SystemUpTime+,+X.NodeID+,+Y.Caption+FROM+Orion.NodesStats+X+inner+join+Orion.Nodes+AS+Y+on+X.nodeid+=+Y.nodeid

 

Interface bandwidth utilization

https://hostname:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+Y.NodeID+,+X.InterfaceID+,+X.ObjectSubType+,+X.Name+,+X.Speed+,+X.MTU+,+X.LastChange+,+X.PhysicalAddress+,+X.AdminStatus+,+X.OperStatus+,+X.InBandwidth+,+X.OutBandwidth+,+X.Caption+,+Y.caption+,+X.FullName+,+X.Outbps+,+X.Inbps+,+X.OutPercentUtil+,+X.InPercentUtil+,+X.OutPps+,+X.InPps+,+X.InPktSize+,+X.OutPktSize+,+X.OutUcastPps+FROM+Orion.NPM.Interfaces+X+Inner+Join+orion.Nodes+as+Y+on+X.Nodeid+=+Y.Nodeid

 

One more thing I'm trying to achieve is, How to split the interface bandwidth utilization into 2 buckets A) Inbound Interface Utilization B) Outbound Interface Utilization.

 

Any help is much appreciated here. I'm staring at an internal deadline set by my Management for Design closure in the next 2 days, any quick help will be worth in gold for me.

 

Thank you.

 

Regards,

Sriraj M

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.

How to download Orion reports using an API?

$
0
0

Am currently downloading the reports into an Excel sheet by appending &DataFormat=xls in the URL. Is there any API to use where I could export the reports? I want to write some code that takes data from the CSV and manipulates it but would rather not have to go into Orion report manager each time I need an updated version of the report, and would like to run the report with a simple API call.

Trusted connection from c# code using REST/JSON API

$
0
0

I am sorry, are there any moderators here to approve below question ? It's been pending for three days now....:-(

 

 

Hi All,

 

I am a c# developer and my application currently uses PowerShell based Swis integration which I want to replace by REST/JSON API as presented in SwisClient sample..

With PowerShell I can use the syntax "$swis = Connect-Swis -v2 -Trusted -host 10.10.10.1" to create a trusted connection using actual logon credentials.

 

How can I achieve the same functionality with the c# SwisClient ?

I guess I would need to modify below code, only don't know how :

 

    private async Task<JToken> SwisCallAsync(Func<HttpClient, Task<HttpResponseMessage>> doRequest)

    {

      var handler = new WebRequestHandler

      {

        Credentials = new NetworkCredential(_username, _password),

        PreAuthenticate = true,

        ServerCertificateValidationCallback = ValidateServerCertificate

      };

      using (var client = new HttpClient(handler))

      {

        client.BaseAddress = new Uri(string.Format("https://{0}:17778/SolarWinds/InformationService/v3/Json/", _hostname));

        HttpResponseMessage response = await doRequest(client);

        var result = JToken.Load(new JsonTextReader(new StreamReader(await response.Content.ReadAsStreamAsync())));

        if (!response.IsSuccessStatusCode)

        {

          throw new ApplicationException(string.Format("Server returned error: {0} {1}{2}{3}", (int)response.StatusCode,

              response.ReasonPhrase, Environment.NewLine, result));

        }

        return result;

      }

    }

 

Thank you in advance.


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?

Orion SDK access to Resources and ResourceProperties tables

$
0
0

Hi,

 

I'm wondering if anyone has found a way of querying the Resources and Resourceproperties Tables via the SDK. I've looked throught the V3 schema and doesn't appear to be any related classes to those database tables. I'm just trying to avoid doing a database connection directly if it can be retrieved via the SDK. We have some custom reports where the report configurations are stored in those tables. The closest related Class is the Orion.Views, but that doesn't provide the associated resources to the view.

 

Thanks

Vicente

How to add only UP interfaces using Python/Orion sdk

$
0
0

I can add the nodes and interfaces using the Python script. I used the DiscoverInterfaceOnNode to add the new interfaces and specify the specific interfaces as well. Up to this point everything is good.

 

The issue is it will add that type of interfaces(E.G Gig,eth etc) either that is UP or Down. My goal is to add only UP interfaces. Can someone please put me in a right direction or share any example to help me fix this.

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?

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')

)

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?

Anyone has has a Phyton Script to add Custom Pollers directly to the Orion.NPM.CustomPollers table?

$
0
0

I'm trying to add a large amount off custom pollers directly to the Orion.NPM.CustomPollers table. The UniqueName, Description, OID etc. has already been defined in a spread sheet I just need to know how to add these to the database table and generate an automatic CustomPollerID.


Modify Network Sonar Discovery attributes

$
0
0

Is there a way to modify the network sonar discovery scope (add ip addresses for instance) leveraging the api?  directly via sql?

Adding node custom properties does not work.

$
0
0

Hi, I am adding node with a custom properties but when it adds a node it does not fill the custom property part. Here is my script:

 

# This sample script demonstrates how to add a new node using CRUD operations.

#

# Please update the hostname and credential setup to match your configuration, and

# information about the node you would like to add for monitoring.

 

 

# Connect to SWIS

$hostname = "fmorn1pp01.fglcorporate.net"

$username = Read-Host -Prompt 'Enter user name'

$password = Read-Host -AsSecureString 'Enter password'

$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

$swis = Connect-Swis -host $hostname -cred $cred

 

 

$ip = Read-Host -Prompt 'Input your IP address'

$Name = Read-Host -Prompt 'Input your server name'

 

 

# node configuration properties

function Show-Menu

{

     cls

     Write-Host "================ Select site ================"

 

 

     Write-Host "1: Press '1' Markham Head Office."

     Write-Host "2: Press '2' Calgary Head Office."

     Write-Host "3: Press '3' Calgary IT Office."

     Write-Host "4: Press '4' Calgary Colo."

     Write-Host "5: Press '5' Mississauga Head Office."

     Write-Host "6: Press '6' Laval Head Office."

     Write-Host "7: Press '7' Calgary Head Office."

     Write-Host "8: Press '8' FGL AJB."

     Write-Host "9: Press '9' MARKS AJB."

     Write-Host "10: Press '10' FGL WDC."

     Write-Host "11: Press '11' MARKS WDC."

     Write-Host "Q: Press 'Q' to quit."   

 

 

}

 

 

 

$selection = Read-Host "Please make a selection"

switch ($selection)

{

           '1' {

                $Site = 'Markham Head Office'

                'You chose option #1'

           } '2' {

                $Site = 'Calgary Head Office'

                'You chose option #2'

           } '3' {

                $Site = 'Calgary IT Office'

                'You chose option #3'

           }'4' {

                $Site = 'Calgary Colo'

                'You chose option #4'

           } '5' {

                $Site = 'Mississauga Head Office'

                'You chose option #5'

           } '6' {

                $Site = 'Laval Head Office'

                'You chose option #6'

           }'7' {

                $Site = 'Calgary Head Office'

                'You chose option #7'

           } '8' {

                $Site = 'FGL AJB'

                'You chose option #8'

           } '9' {

                $Site = 'MARKS AJB'

                'You chose option #9'

           } '10' {

                $Site = 'FGL WDC'

                'You chose option #10'

           } '11' {

                $Site = 'MARKS WDC'

                'You chose option #11'

 

 

           } 'q' { exit

           }

    

 

 

}

 

 

 

Cls

Write-Host "================ Select class ================"

    

     Write-Host "1: Press '1' A."

     Write-Host "2: Press '2' B."

     Write-Host "3: Press '3' C."

     Write-Host "4: Press '4' D."

     Write-Host "Q: Press 'Q' to quit.

 

 

 

 

$selection = Read-Host "Please make a selection"

switch ($selection)

{

           '1' {

                $Class = 'A'

                'You chose option #1'

           } '2' {

                $Class = 'B'

                'You chose option #2'

           } '3' {

                $Class = 'C'

                'You chose option #3'

           }'4' {

                $Class = 'D'

                'You chose option #4'

           } 'q' { exit

               

           }

}

 

 

 

 

Cls

Write-Host "================ Select environment ================"

    

     Write-Host "1: Press '1' Prod."

     Write-Host "2: Press '2' Pre-prod."

     Write-Host "3: Press '3' DEV."

     Write-Host "4: Press '4' QA."

     Write-Host "Q: Press 'Q' to quit.

 

 

 

   $selection = Read-Host "Please make a selection"

switch ($selection)

     {

           '1' {

                $Environment = 'Prod'

                'You chose option #1'

           } '2' {

                $Environment = 'Pre-prod'

                'You chose option #2'

           } '3' {

                $Environment = 'DEV'

                'You chose option #3'

           }'4' {

                $Environment = 'QA'

                'You chose option #4'

           } 'q' {

                exit

           }

     }

 

 

 

 

CLS

 

 

Write-Host "================ Select city ================"

    

     Write-Host "1: Press '1' Calgary."

     Write-Host "2: Press '2' Brampton."

     Write-Host "3: Press '3' Markham."

     Write-Host "4: Press '4' Mississauga."

     Write-Host "5: Press '5' Laval."

     Write-Host "6: Press '6' WDC."

     Write-Host "Q: Press 'Q' to quit."

 

 

    

 

   $selection = Read-Host "Please make a selection"

switch ($selection)

     {

           '1' {

                $City = 'Calgary'

                'You chose option #1'

           } '2' {

                $City = 'Brampton'

                'You chose option #2'

           } '3' {

                $City = 'Markham'

                'You chose option #3'

           }'4' {

                $City = 'Mississauga'

                'You chose option #4'

           } '5' {

                $City = 'Laval'

                'You chose option #5'

           }'6' {

                $City = 'WDC'

                'You chose option #6'

           } 'q' {

                exit

           }

     }

 

 

 

 

# add a node

$newNodeProps = @{

    IPAddress = $ip;

    NodeName = $Name

    EngineID = 17;

 

    # SNMP v2 specific

    ObjectSubType = "SNMP";

 

 

    SNMPVersion = 2;

 

 

    DNS = "$Name";

    SysName = "$Name";

   

    # === default values ===

 

 

    # EntityType = 'Orion.Nodes'

    # Caption = ''

    # DynamicIP = false

    # PollInterval = 120

    # RediscoveryInterval = 30

    # StatCollection = 10 

}

 

 

 

 

 

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

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

 

 

# register specific pollers for the node

$poller = @{

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

    NetObjectType="N";

    NetObjectID=$nodeProps["NodeID"];

}

 

 

# prepare a custom property value

 

 

$customProps = @{

 

 

 

    CITY = "$City";

 

 

    CLASS_TYPE = "$Class";

 

 

    DEPARTMENT = "Infrastructure";

 

 

    DEVICE = "Server";

 

 

    OS_TYPE = "Windows";

 

 

    SITE = "$Site";

 

 

    VIRTUAL_SERVER = "Yes";

 

 

}

 

 

# build the node URI

$uri = "swis://fmorn1pp01/Orion/Orion.Nodes/NodeID=$($nodeProps.NodeID)/CustomProperties";

 

 

# set the custom property

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

 

 

# Status

$poller["PollerType"]="N.Status.ICMP.Native";

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

 

 

# Response time

$poller["PollerType"]="N.ResponseTime.ICMP.Native";

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

 

 

# Details

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

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

 

 

# Uptime

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

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

 

 

# CPU

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

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

 

 

# Network

$poller["PollerType"]="N.Topology_Layer3.SNMP.ipNetToMedia";

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

 

 

# Storage_Memory

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

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

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.

Difference In SubQuery Results Between SWQL and API

$
0
0

I am getting different results when using SWQL studio and the API.  In SWQL, the Address and CIDR values are being returned from IPAM.IPNODE.Subnet.Address & CIDR.  In the API the values are not being returned.  Any suggestions?

 

How to add only UP interfaces using Python/Orion sdk

$
0
0

I can add the nodes and interfaces using the Python script. I used the DiscoverInterfaceOnNode to add the new interfaces and specify the specific interfaces as well. Up to this point everything is good.

 

The issue is it will add that type of interfaces(E.G Gig,eth etc) either that is UP or Down. My goal is to add only UP interfaces. Can someone please put me in a right direction or share any example to help me fix this.

Viewing all 2677 articles
Browse latest View live


Latest Images

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