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

Events - Difference between SWIS API and SWQL

$
0
0

Hello,

 

I have written an application to read events using SWIS API on regular interval(e.g every 30 seconds) and pass it to ticketing system from other vendor.

 

API Query is :

https://<<SERVERIP>>:<<PORT>>/SolarWinds/InformationService/v3/Json/Query?query=SELECT n.IP_Address, e.Message, e.NetObjectID,n.EntityType, n.Description, n.DetailsUrl, n.Caption, n.DetailsUrl, e.EventTime,et.Name, e.Message FROM Orion.Events e INNER JOIN Orion.Nodes n ON e.NetworkNode = n.NodeID INNER JOIN Orion.EventTypes et ON e.EventType = et.EventType WHERE et.EventType NOT IN (506,504,11,519,529,524) and e.EventTime>='2019-05-27 18:30:00'

 

Note: I am using Orion.Events.EventTime in where condition to get only differential events.

 

Issue :The number events is very less compare to the below query executed in SWQL. I have tried many times and there is difference in all the time

 

SELECT n.IP_Address, e.Message, e.NetObjectID,n.EntityType, n.Description, n.DetailsUrl, n.Caption, n.DetailsUrl, e.EventTime,et.Name, e.Message FROM Orion.Events e INNER JOIN Orion.Nodes n ON e.NetworkNode = n.NodeID INNER JOIN Orion.EventTypes et ON e.EventType = et.EventType WHERE et.EventType NOT IN (506,504,11,519,529,524) and e.EventTime>='2019-05-27 18:30:00'

 

Support Expected:How to ensure that my application does not miss any events generated in SolarWinds


Can anyone provide an example of how to supress alerts using the rest API, I've stumbled around but I can't seem to get it to work.

How to pass in parameter to PS script

$
0
0

I have a PS script that will delete msi files that are older than 1 year. I set up an alert to trigger if there's less than 2gb of space left on the C:\ drive. I want this script to execute against the triggered node. How do i pass in the node that was triggered to the script?

 

Here's my code:

$DeleteOlderThan = (Get-Date).AddDays(-365) #files older than a year

$Destination = "C:\Windows\Installer\" #path

 

Get-ChildItem $Destination -File | Where-Object { $_.LastWriteTime -lt $DeleteOlderThan } | Remove-Item -Include "*.msi" -Force #delete msi files

TopN application custom chart of NTA

$
0
0

Hello,

 

I want to make TopN application custom chart of NTA.

Because I want to make this graph for any interfaces pair, I am trying this by custom graph with following SWQL query.

Graph is shown on NTA dashboard. (Attached image file).

But, all application are shown on graph.

I want to make TopN graph to configure condition in SWQL query.

Can i do this using SWQL query ?

 

-----

SELECT

F.TimeStamp As Time,

A.Name AS ApName,

SUM(F.Bytes)*8/60 AS DataBytes

FROM Orion.Netflow.Flows As F Inner Join Orion.Netflow.Applications As A ON F.ApplicationID = A.ApplicationID

WHERE (F.TimeStamp > GETUTCDATE() - 7) AND ((F.InterfaceIDRx =  500 AND F.InterfaceIDTx = 501)  OR (F.InterfaceIDRx = 501 AND F.InterfaceIDTx = 500))

GROUP BY F.TimeStamp, A.Name

Order By Time, DataBytes DESC

----

 

Best regards,

 

KH

SEND DATA TO SOLARWINDS USING PYTHON

$
0
0

Hello!

 

I Would like to know if it's possible send data to SolarWinds using API-REST.

I have a code that extract information a program and generates a JSON with information, and I would like create monitor on SolarWinds based in this information.

 

Ex: My code get a information of stats 0 or 1, send this date to SolarWinds, and the SolarWinds create a chart with number received. With this I can create Alert and track monitoring.

 

This exemple is trivial, my code extract more information.

 

Is there a possibility or can I just add a knot among other things using OrionSDK?

API for updating Custom Fields via REST Call in Solarwinds

$
0
0

Hi All,

 

We are looking for the API for updating Custom Fields via REST Call so that we should use that by ITSM like (Service NOW) & it could use & update fields. There are limited fields that we want to push from Service Now to SolarWinds (Like City, Region, Type). Please let me know if someone came across same case.

 

Thanks,

Amit

Find port and switch for a given IPAddress

$
0
0

I'm attempting to get the port and switch for some IP Addresses that are connected and in use.  I've attempted a couple of different ways, but haven't had any luck.  Can anyone provide some advice?

 

Raw non UDT based.

SELECT P.PortID      , P.IfIndex      , P.VlanId      , P.PortType     , p.Description     , N.IPAddress     , N.DisplayName
FROM Orion.NodePortInterfaceMap AS P
JOIN Orion.Nodes AS N ON N.NodeID = P.NodeId
WHERE N.IPAddress = '#.#.#.#' -- with a real IP Address

 

UDT based.

SELECT N.DisplayName     , N.IPAddress     , P.PortDescription     , P.PortIndex
FROM Orion.Nodes N
INNER JOIN Orion.UDT.Port AS P on P.NodeID=N.NodeID 
WHERE N.IPAddress = '#.#.#.#' -- with a real IP Address

 

Thanks in advance.

Mute Alerts in SolarWinds via Powershell

$
0
0

Hello All,

 

I have the script below which works great for scheduling nodes for unmanage.  Is there any way to configure this script not to unmanage nodes, but to mute the alerts?

 

# 2017-03-29 Node Scheduled Unmanage script for SolarWinds SDK Powershell

#Instructions:Configure the Start and End times.  Edit the nodelist.txt file to include all of the servers that need

#the alerts muted for the scheduled change times.

#Region PSSnapin presence check/add

#Silently Call SolarWinds SDK

 

if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue)) 

{     

    Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue 

}

 

#EndRegion

 

 

 

 

$OrionServer = 'ServerName'

GET-CREDENTIAL –Credential abc\ServiceAccount | EXPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml

$MyCredentials=IMPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml

 

 

$swis = Connect-Swis -Hostname $OrionServer -Credential $MyCredentials

 

 

write-host "Sample - Date:'2019-05-22 05:45:00 PM'" -ForegroundColor Red -BackgroundColor Black

[datetime]$start = Read-Host "enter date and time to mute alerts" -ForegroundColor Red -BackgroundColor Black

 

 

 

 

write-host "Sample - Date:'2019-05-22 06:30:00 PM'" -ForegroundColor Green -BackgroundColor Black

[datetime]$end = Read-Host "enter date and time to end alert muting" -ForegroundColor Green -BackgroundColor Black

 

 

Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE Caption IN @captions" @{captions=(Get-Content c:\temp\nodelist.txt)} | Set-SwisObject $swis -Properties @{UnmanageFrom=$start.ToUniversalTime();UnmanageUntil=$end.ToUniversalTime()}


[Python] OrionSDK get all subnets Displayname by its Description

$
0
0

Hello, recently i managed to use the OrionSDK API to get available IP from subnets. Now i want to use the API to so i can list all the available subnets and get the Display name by its Description, however this is not an easy task. Are there anyone who can assist me in this, in python if possible.

 

Thanks in advance

Remove Non Cisco Devices from UDT

$
0
0

We have an issue where users will add servers into UDT.  Our methodology is to only allow access switches in UDT.  I have created the script below to identify all devices where the vendor is not Cisco.   It brings back the expected Uri's however when I add the Remove-SwisObject statement it errors out. 

 

$ErrorActionPreference = 'Stop'

 

#Add the snapin
Add-PSSnapin SwisSnapin

 

#create a connection to solarwinds

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

 

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

 

#Query Data

$query = Get-SwisData $swis "SELECT u.uri FROM Orion.UDT.Port u JOIN Orion.Nodes n ON n.nodeid = u.nodeid WHERE n.vendor <> 'cisco'"

 

# The line above does finds the Uri's below.  Which happen to be the devices I want GONE!

swis://XXX.net/Orion/Orion.Nodes/NodeID=160/Ports/PortID=1
swis://XXX.net/Orion/Orion.Nodes/NodeID=160/Ports/PortID=2
swis://XXX.net/Orion/Orion.Nodes/NodeID=160/Ports/PortID=3
swis://XXX.net/Orion/Orion.Nodes/NodeID=160/Ports/PortID=4
swis://XXX.net/Orion/Orion.Nodes/NodeID=162/Ports/PortID=5

 

# Remove Objects

$query | Remove-SwisObject $swis

 

# Error when adding $query | Remove-SwisObject $swis

 

Remove-SwisObject : Operation not supported on Orion.UDT.Port
At C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Remove Non Cisco Devices From UDT.ps1:22 char:10
+ $query | Remove-SwisObject $swis
+          ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Remove-SwisObject], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.RemoveSwisObject

Import Template using SwisPowershell

$
0
0

Hi there,

 

I am currently automating the installation and configuration of solarwinds with the help of the SwisPowershell module. I have managed to fully install solarwinds orion, agents on the nodes and can assign templates to each node easy enough with 0 touch. However, I am wanting to create new custom application templates using the GUI in advance, export them and include them in my automated install. The idea is to import these custom templates in to Orion and then assign nodes to them all using Powershell code.

 

In SWQL Studio I noticed methods in Orion.APM.ApplicationTemplate for "Delete Template" and "UpdateApplication Template Settings" but nothing for importing.

 

Is this possible through the API at all? Can I use New-SwisObject to achieve this?

 

thanks in advance.

Changing a Performance Counter Instance Name, Overriding a Template

$
0
0

Hey all,

 

I currently have a template that is applied to multiple servers to collect windows performance counter information for some custom software.  The issue is, the instance names changes on a server, and there can be more than one instance of the counters on each server (each with a unique name).  I'm looking for a way to override the template's instance name setting and update each individual component's Instance.  Alternatively, I suppose I could use PowerShell to retrieve which counters and instances exist on each server (Already have the ability to obtain that information via script) and then hopefully use Invoke-SwisVerb to create individual templates, applications and components - but I'm not sure where to start with scripting the creation of solarwinds portion.

 

From enacting the change manually via the web console and then running a SWQL query, I can see that the overriding setting is held in Orion.APM.ComponentSetting with a Key of "Instance" and a "Value" of the instance name I entered (Along with ComponentID for the individual component of the application, as well as ValueType = 0 and Required = False)

 

I'm not finding any Swis Verbs to invoke in order to update a specific component like this - does anyone have any guidance?

 

I know the above is rather vague - if I can provide more information to facilitate a solution, please let me know.

Problem trying to add UNDP to node

$
0
0

So in the interest of keeping things simple, this is what I'm sending in Powershell:

$result = New-SwisObject $swis –EntityType 'Orion.NPM.CustomPollerAssignmentOnNode' -Properties @{CustomPollerID='0a5ddec7-57b0-45a2-a595-37311bf5d88c';NodeID='10101';}

 

This is the result I'm getting back:

New-SwisObject : Cannot insert the value NULL into column 'AssignmentName', table 'CPMIT.dbo.CustomPollerAssignment'; column does not allow nulls. INSERT fails.

 

Running core  2018.2 HF6

Any ideas?

Python Orion SDK swis.update broken after IPAM 4.6.0 upgrade

$
0
0

Before upgrade, the Python Orion SDK swis.update was working fine. After upgrade, the Python Orion SDK swis.update broke with the error HTTP error 400: "The given key was not present in the dictionary”

 

Full technical details

Before upgrade: IPAM 4.5.2, SAM  6.4.0, VMAN 8.0.0, NPM 12.1, 

After upgrade:  IPAM 4.6.0, SAM 6.5.0, VMAN 8.1.0, NPM 12.2

 

The Python code

 

    swis = orionsdk.SwisClient(solarwinds_url, solarwinds_user, solarwinds_pass)

    ipFree = swis.query(

        "SELECT TOP 1 I.uri, I.DisplayName FROM IPAM.IPNode I WHERE Status=2 " +

        " AND I.DNSBackward is NULL " +

        " AND I.Subnet.DisplayName = '" + solarwinds_network + "'")

    ipAddr=ipFree['results'][0]['DisplayName']

    ipUri=ipFree['results'][0]['uri']

    swis.update(ipUri , Status=1, DNSBackward=customer_hostname)

 

 

Did a HTTP request and reponse capture

  1. Find the next free IP (This works)
    URL: https://solarwinds.url.com:17778
    POST /SolarWinds/InformationService/v3/Json/Query
    Request: {"query": "SELECT TOP 1 I.uri, I.DisplayName FROM IPAM.IPNode I WHERE Status=2  AND I.DNSBackward is NULL  AND I.Subnet.DisplayName = \'Mgt Services\'", "parameters": {}}
    Response: [{u'DisplayName': u'10.10.14.26', u'uri': u'swis://HE1-SWAPP-01.headquarters.healthedge.com/Orion/IPAM.IPNode/IpNodeId=9316'}]
  2. Change IP Node status to Used (This does not work)
    URL: https://solarwinds.url.com:17778

POST /SolarWinds/InformationService/v3/Json/swis://HE1-SWAPP-01.headquarters.healthedge.com/Orion/IPAM.IPNode/IpNodeId=9316
Request: {"Status": 1, "DNSBackward": "mynewdomain.url.com"}
Response: 'HTTP/1.1 400 Bad Request  "The given key was not present in the dictionary”

 

 

 

There is an open Solarwinds ticket for this issue 35188

 

Message was edited by: Jirawat Uttayaya

Get the next available subnet of a particular size within a supernet

$
0
0

Is there any way in the API or through SQL queries to retrieve the next available subnet in a supernet? For example, if I want to know the next free /28 subnet in a 10.10.10.0/24, how would I do that?

 

 

 


Problem with scripting the appinsight for sql template?

$
0
0

So this is an excerpt from a script I was using to copy over the app templates from an old instance to a new one but I noticed it wasn't working fully for the appinsight templates.  It creates the app monitor, but they all stay in "inital polling" forever.  If i click into the edit and test the credential it passes as expected, then submit that and it will start working, but there must be something missing when using the verb.  Using a similar version of the syntax creates the rest of the app monitors and they fire right up.

 

if($app.templatename -like "AppInsight for SQL") {

                 Invoke-SwisVerb $swisdest "Orion.APM.SqlServerApplication" "CreateApplication" @(

                    #nodeid

                    "$newnode",

                    #applicationtemplateid

                    "$newtemplate",

                    #credentialid, -3 inherits from node

                    -3,

                    #skip if duplicate

                    1

                )

 

Anyone every tried to use this verb and had it working successfully?

Modification of Policy Report Rules

$
0
0

I am trying to automate the customization of policy report rules. The example is I would like update the rules that define the NTP server settings the complacency reports use to judge if my switches are configured correctly.

 

I can find the URI for the rule with:

 

$uri = Get-SwisData $swis "SELECT uri FROM Cirrus.PolicyRules where name = 'NTP Server Settings' and grouping = 'Cisco Time Settings'"

 

When I make the call to change the value I meet with:

 

PS C:\Windows\system32> set-swisobject $swis -Uri $uri -properties @{ comment = "Ensures the Network Time Protocol (NTP) is configured properly (IP: 192.168.71.30)"}

set-swisobject : Operation not supported on Cirrus.PolicyRules

At line:1 char:1

+ set-swisobject $swis -Uri $uri -properties @{ comment = "Ensures the  ...

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

    + CategoryInfo          : InvalidOperation: (:) [Set-SwisObject], FaultException`1

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.SetSwisObject

 

 

How can I find the operations supported on Cirrus.PolicyRules or is there a different way to approach the change?

How to write the power shell scripting in solarwinds ??

$
0
0

Hi Guys,

 

how to write the power shell scripting in soalrwinds. can you give me simple example ?

how many members login to the solarwinds session. can we see through solarwinds power shell script ?

 

 

Thanks and Regards,

Krish.

Add UDT ports via API

$
0
0

I have not found a way to do this, but maybe I'm not looking in the right place. We've got Python scripts for discovering and adding nodes and interfaces via API no problem. We're using corePluginConfig  and  interfacesPluginConfig to accomplish this. But I have not seen a similar "ports" PluginConfig (i.e. portsPluginConfig). When we started down the road of automating device entry, we assumed UDT ports would also be available to us via API. Like when we import discovered results in the web console, the Interfaces screen (with all of its selection criteria and filtering) is followed by an almost identical Ports screen. So it seemed safe to assume we would be able to include UDT ports when automating device entry via API.

 

Hopefully I'm just missing something and the option to do this is available.

 

Thanks!

Add UDT Ports via API (Orion SDK)

$
0
0

Hello all,

I've been using the API for a while now and have managed to find a lot of answers here so thanks for your help so far!

I am now completely stuck however when it comes to UDT Ports via the API.

The only documentation I am aware of is: UDT vNext API · solarwinds/OrionSDK Wiki · GitHub

Sadly this doesn't seem to allow me to add ports to a node I receive the following error (using the python orion sdk):

requests.exceptions.HTTPError: 400 Client Error: Unable to create Orion.UDT.Port. Details : Error: In property NodeID. Reason: Value is not valid. Entity with NodeId: 3071 - are not exist. Ports can be created only on existed node.

 

However this node exists in Solarwinds and I can view it in the web GUI:

 

'DetailsUrl': '/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:3071',


code:

  props = {

 

   "NodeId": 3071,

   "PortIndex": 6,

   "Name": "2/0.3",

   "MACAddress": "1234.4321.1234",

  }

  swis.create("Orion.UDT.Port", **props)

 

I'm assuming I need to enable UDT for this node somehow first? I can see there is NodeCapability in the database: SolarWinds Information Service v3.0 Schema Documentation do I need to use this? Looks like it's read only though...

Or the most logical way is to add the UDT Ports during discovery? As this is what happens on the web GUI. But I can't see any documentation on this at all?

 


Any advice is much appreciated!

Viewing all 2677 articles
Browse latest View live


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