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

Solarwinds API for all events.

$
0
0

Dear team,

 

Can any one help me in getting all the solarwinds events by API


Using SWIS to pull table summary

$
0
0

Wondering if there is a way to pull the table size and table summary with SWIS.  We have a problem with table growth and we need to monitor table sizes more frequently.  We currently have to use the Database Manager and export the sizes into Excel.  We do not have rights to the SQL server to run the query directly.

 

 

Create WMI Node via API Request

$
0
0

When attempting to create a new WMI node I am running into an issue where the node is created but its not receiving a value for the WMICredential field in "Orion.NodeSettings" which I am attempting to update after the node is created with the output of the NodeID I am getting in the return sting. The host shows up under manage hosts, but when you click on edit node properties it returns the exact error below:

 

 

So to run through the steps I am taking to get this issue:

1. I pass a JSON string to create the new node: REST to '/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes' with json string {"EntityType":"Orion.Nodes", "IPAddress":"'+ip+'", "IPAddressGUID":"nnnnnnnn-0000-0000-0000-000000000000", "Caption":"'+newHostname+'", "DynamicIP": false, "EngineID": 2, "Status": 0, "UnManaged": false, "Allow64BitCounters": false, "SysObjectID": "", "MachineType": "", "VendorIcon": "", "ObjectSubType": "WMI"}

 

2. Grab the NodeID from the json API return and pass it to the "Node.NodeSettings"

 

3. Update the "Node.NodeSettings" value for "WMICredntial": REST to '/SolarWinds/InformationService/v3/Json/swis://orion/Orion/Orion.NodeSettings'; with json sting '{"EntityType":"Orion.NodeSettings", "NodeID":"11006" "SettingName":"WMICredential", "SettingValue": 22}'

 

4. Result is 200. Which would lead me to believe that field is being updated, but the error still exists.

 

Could anyone point me in the right direction of updating that "WMICredential" value for the specific Node after its been created?

 

I've looked at a few different threads but this one had some good info it and its where I got the idea of updating the node after its been created >> Create node with credential set

This is the document that points out the WMICredential value is missing which is causing the issue >> Given key is not present in the dictionary - SolarWinds Worldwide, LLC. Help and Support

 

Thanks!

SW API with Python None value is not NULL

$
0
0

Hi,

We need to setup a custom property to NULL using a python script.

This is fully available in PowerShell ans the result is OK howerver in Python setting NULL value only delete the cotent of the Custom Property but it is not set to NULL

 

# connection
Import-Module SwisPowerShell

# Connect to SWIS
$hostname = "localhost"
$username = "admin"
$password = ""
$swis = Connect-Swis -host $hostname -UserName $username -Password $password

$vmid = 1588

$customProps = @{
    TlsCmdbStatus=$null;
}

$uri = "swis://localhost/Orion/Orion.VIM.VirtualMachines/VirtualMachineID=$vmid/CustomProperties"

# set the custom property
Set-SwisObject $swis -Uri $uri -Properties $customProps

 

The result of this query is correct :

select 
vm.VirtualMachineID,
vm.CustomProperties.TlsCmdbStatus
from Orion.VIM.VirtualMachines vm

 

VirtualMachineID TlsCmdbStatus

1588 NULL

 

the following Python script unfortunately has not the same result:

 

import requests
from orionsdk import SwisClient
def main():    npm_server = 'localhost'    username = 'admin'    password = ''    swis = SwisClient(npm_server, username, password)    print("Custom Property Update Test:")    results = swis.query(        "SELECT vm.Uri FROM Orion.VIM.VirtualMachines vm WHERE NodeID=@id",        id=1)  # set valid NodeID!    uri = results['results'][0]['Uri']    print (results)    swis.update(uri + '/CustomProperties', TlsCmdbStatus=None)    obj = swis.read(uri + '/CustomProperties')    print (obj)    
requests.packages.urllib3.disable_warnings()

if __name__ == '__main__':
    main()

 

The result of the script is:

 

Custom Property Update Test:

{'results': [{'Uri': 'swis://localhost/Orion/Orion.VIM.VirtualMachines/VirtualMachineID=1588'}]}

{'VirtualMachineID': 1588, 'InstanceType': 'Orion.VIM.VirtualMachinesCustomProperties', 'TlsCmdbInstanceId': None, 'TlsCmdbLastUpdated': '2018-12-07T15:48:04Z', 'TlsCmdbReconId': None, 'TlsCmdbStatus': '', 'TlsCmdbStatusReason': None, 'TlsCompany': None, 
'TlsDispatch': None, 'DisplayName': None, 'Description': None, 'Uri': 'swis://localhost/Orion/Orion.VIM.VirtualMachines/VirtualMachineID=1588/CustomProperties', 'InstanceSiteId': 0}

 

'TlsCmdbStatus': ''

the result is an empty property not a NULL or none value...

 

Have you been able to set a field to NULL (truly) using Python ?

 

Cheers

Question about granting rights for SolarWinds IPAM API

$
0
0

We received a request to grant Full Admin rights to the SolarWinds IPAM application for two internal accounts in my firm.  These two accounts would be used for SolarWinds API calls to do the following:

 

create, list, and delete subnets within supernet in Solarwinds IPAM via API call to the application

 

Unfortunately, I do not know anything about the SolarWinds APIs, so I do not know how to do this -- nor if Full Admin rights are truly needed to perform the actions listed above.  I read the Orion SDK documentation but I still do not understand. 

 

Bottom line, I very much would appreciate guidance concerning the rights issue and how to go about it.  Thanks!!! 

SWQL: Re-creating the Alerts Acknowledge Button

$
0
0

Hello,

 

Is it possible to re-create the Active Alerts 'Acknowledge' button into another custom query?

 

I need to create a custom query filter only specific nodes that have been alerted, along with the 'acknowledge' button. 


Thank you in advance!

 

changing value of custom property via script

$
0
0

I've setup a custom property for our on-call rotation.  I can change this custom property via the SolarWinds Orion gui.  It's 600 nodes presently and will only get larger.  Is there a way to script the change of the value of a custom property or manage it via the command line?  I presently have the custom property setup as a drop down list and I checked out what it would be like to do an on-call change and you have to highlight all the nodes that our team is responsible for and edit the properties.  With 600 nodes it takes a while for the gui to handle the change.

Using Orion API / SDK to update IncidentNumber

$
0
0

Hi all

 

I have just started playing with the Solarwinds API using the Go SDK. I can do a basic query such as: SELECT AlertActiveID FROM Orion.AlertActive

 

What I am trying to achieve is to use the SDK/API to populate the Incident Number field (and maybe others) that appear on the Alerts list page (https://solarwinds.bskyb.com/Orion/NetPerfMon/Alerts.aspx).

 

We use SendHttpRequest alert actions to send alerts to another system. That system does processing and a couple of minutes later generates an incident number, which we then want annotate the alert with.

 

Any help would be much appreciated!


Unmanaging and suppressing alerts for applications - Scheduled recurring maintenance windows

$
0
0

Here's my take on a recurring, scheduled maintenance window for applications. We've got a hot/cold environment for one of our big in-house applications that rotates every two weeks.

 

Unmanage:

#Add-Pssnapin swissnapin
Import-Module SwisPowerShell
$start = (Get-Date).ToUniversalTime() 
$end = $start.AddDays(14)
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password


$applist = Get-SwisData -SwisConnection $swis -Query @"
SELECT ID
FROM Orion.APM.Application 
WHERE Name LIKE '%KEYWORD%'
"@


Foreach( $a in $applist ) {
    $appid = @( $a | ForEach-Object { [string]( $_  ) } )    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.APM.Application -Verb Unmanage -Arguments @( "AA:$appid", $start, $end, "false" )
}

 

Suppress alerts:

#Add-Pssnapin swissnapin
Import-Module SwisPowerShell
$start = (Get-Date).ToUniversalTime()
$end = $start.AddDays(14) #two week release cycle
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password


$apps = Get-SwisData -SwisConnection $swis -Query @"
SELECT Uri
FROM Orion.APM.Application 
WHERE Name LIKE '%KEYWORD%'
"@

Foreach( $a in $apps ) {
    $uri = @( $apps | ForEach-Object { [string]( $_  ) } )    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @( $uri, $start, $end )    
}

 

Just set these Powershell scripts to run on a Scheduled Task and you're all set!

 

Special thanks to zackmKMSigma and aLTeReGo for lots of patience while I learn this API thing.

Unable to unmanage application using orion API

$
0
0

Hi All, I am trying to unmanage an application using orion API. I took python script to unmanage a node as a reference and modified it to also support for application.

 

Script was able to execute with no errors and exceptions but application didnt get unamanaged. I am kind of stuck here as don't have any errors to check and logs to find the root cause.

 

Please help if anyone has faced this issue before.

 

import requests

from orionsdk import SwisClient

from datetime import datetime, timedelta

 

 

def main():

    hostname = 'localhost'

    username = 'test'

    password = 'dadasdd'

    print("i am running")

    swis = SwisClient(hostname, username, password)

    results = swis.query('SELECT ApplicationID, ApplicationTemplateID FROM Orion.APM.Application WHERE ApplicationID = @ApplicationID', ApplicationID='28')

    if results['results']:

        ApplicationID = results['results'][0]['ApplicationID']

        ApplicationTemplateID = results['results'][0]['ApplicationTemplateID']

        netObjectId = 'AA:{}'.format(ApplicationID)

        now = datetime.utcnow()

      

        tomorrow = now + timedelta(days=1)

        response = swis.invoke('Orion.APM.Application', 'Unmanage', netObjectId, now, tomorrow, False)

        print('Done...{} will be Remanage until {}'.format(ApplicationID, tomorrow))

        print('Response - {} '.format(response))

    else:

        print("Device doesn't Exist")

 

 

requests.packages.urllib3.disable_warnings()

 

 

if __name__ == '__main__':

    main()

 

 

 

 

 

 

 

 

 

 

 

Thanks in advance for checking.

 

Regards

Devraj S

Unable to execute Get-SwisData command

$
0
0

Hi TimI have an issue while executing the Get-SwisData command with the below error,Get-SwisData : The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'.:line:1 char:11$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE IPAddress = ' ...+ CategoryInfo : NotSpecified: (:) [Get-SwisData], communicationException+FullyQualyfiedErrorId : System.ServiceModel.CommunicationException,SwisPowershell.GetSwisDataPlease help me to solve this issue with Get-SwisData and I can add swissnapin and also connect with my credentials to solarwinds as well but not able to execute Get-SwisData

How to receive an email from a separate internal application and use that to trigger something in solarwinds?

$
0
0

Good Morning

 

I am pretty new to solarwinds, so please excuse me in advance.

 

What i am looking to do is currently there is an application in my environment that sends out an email if there is an issue. I would like to capture that in solarwinds, so it shows up in the console as an issue/error.

 

How can I go about solarwinds getting a copy of that email and build a trigger job off of there to send an alert and make it show up in the console.

 

Thanks for your help.

Clone the new Map tab onto all your custom details views

$
0
0

So for those of you who run heavily customized environments you may have noticed that the new maps view only gets added to the default node details view.  I wrote this script that looks through all the views, figures out which ones could have a Maps tab and clones it in for you.  All you need to do is run the below powershell on your Orion server under a Windows account with view customizing permissions and in 2 seconds it will add the maps tab to all your custom versions of the details views.  I've tested it pretty extensively in my lab but as always take a backup of your db before you run any scripts and let me know if you get any unexpected results.

 

 

 

<#------------- CONNECT TO SWIS -------------#>

# load the snappin if it's not already loaded (step 1)

if (!(Get-PSSnapin|Where-Object { $_.Name -eq"SwisSnapin" })) {

    Add-PSSnapin"SwisSnapin"

}

 

#define host, credentials, and sql connection string

 

$hostname='localhost'

#$user = "user"

#$password = "pass"

# create a connection to the SolarWinds API

#$swis = connect-swis -host $hostname -username $user -password $password -ignoresslerrors

$swis=Connect-Swis-Hostname$hostname-Trusted

 

 

<#------------- ACTUAL SCRIPT -------------#>

 

 

# get list of all views types with a map option

$viewkeys=get-swisdata$swis"SELECT distinct ViewKey FROM Orion.Views where viewtitle = 'map' and viewkey like '%StaticSubview' "

 

foreach ($viewkeyin$viewkeys)

    {

"Working on $viewkey"

 

        #get the viewgroup to use for our parent clone

$mapviewgroup=get-swisdata$swis"select top 1 viewgroup from orion.views where viewkey = '$viewkey'"

 

        #this will be the viewid of the parent of our clones

$cloneviewparent=get-swisdata$swis"select viewid, uri from orion.views where viewgroup = '$mapviewgroup' and viewkey = '$viewkey'"

" View to clone is $($cloneviewparent.viewid)"

 

#get the correct viewkey

$viewkeytoadd=get-swisdata$swis"select viewkey from orion.views where viewgroup = '$mapviewgroup' and (viewgroupposition = 1 or viewgroupposition is null)"

 

#find any instances of that viewtype that don't already have a map

$viewgrouptoadd=get-swisdata$swis"select viewgroup, viewgroupname, viewkey, viewtype, viewgroupposition from orion.views where viewkey = '$viewkeytoadd' and viewgroup not in (select viewgroup from orion.views where viewkey like '$viewkey%')"

"Number of view groups to clone into is $($viewgrouptoadd.viewgroup.count)"

 

foreach ($vgin$viewgrouptoadd.viewgroup )

{

$vieworder=get-swisdata$swis"select viewgroupname, max(viewgroupposition)+1 as position from orion.views where viewgroup = '$vg' group by viewgroupname "

"  Cloning map to $($vieworder.viewgroupname) position $($vieworder.position)"

              

               $newview=Invoke-SwisVerb$swisOrion.ViewsCloneView @($cloneviewparent.viewid ,"Map")

"   New Viewid is $($newview.'#text')"

$newviewuri=get-swisdata$swis" select uri from orion.views where viewid = $($newview.'#text')"

"   New view Uri is $newviewuri"

Set-SwisObject$swis-Uri"$newviewuri"-Properties @{"ViewGroupName"="$($vieworder.viewgroupname)"; “ViewGroup”="$vg"; "ViewGroupPosition"="$($vieworder.position)" }

            }

 

    }

 

 

 

-Marc Netterfield

    Loop1 Systems: SolarWinds Training and Professional Services

SWQL works in studio but not in Website

$
0
0

After migrating to NPM 12.1 I've decided to update my SQL queries to SWQL queries since row limit started to bother me and searchable textbox seems to be legit.

 

My swql query looks like:

 

select 
case when ccs.Availability=1 then 'Up' else 'Down' end as STATUS,
'/NetPerfmon/images/Small-' + case when ccs.Availability=1 then 'Up' else 'Down' end + '.gif' as _IconFor_STATUS,
n.Caption, c.Name,
ccs.TimeStamp, 
ccs.LastTimeUp, 
ccs.ErrorMessage
from 
Orion.Nodes n, Orion.APM.Component c, Orion.APM.Application a, Orion.APM.CurrentComponentStatus ccs
where 
n.NodeID=a.NodeID and 
ccs.ApplicationID=a.ID and 
ccs.ComponentID=c.ComponentID and 
a.Name like 'Windows %' and 
c.Name <> 'Task Scheduler' and
(c.Status=1 or c.Status=2) and
a.Unmanaged=0

 

It works perfectly on swql studio but not on custom query on website. Any comments?

 

Thanks.

SSL Certificate Experiation Date Monitor (SWQL)

$
0
0

Here is a widget that can be used for a NOC view which list the SSL certs.  Nice little view which can also be used for a summary view.

 

 

select

n.Caption as [Node]

,n.DetailsURL as [_LinkFor_Node]

,'/Orion/images/StatusIcons/Small-' + n.StatusIcon AS [_IconFor_Node]

,cts.value as [Port]

,CONCAT(round(floor(tmp.data/30),0),' Months ',(tmp.data)-(FLOOR(tmp.data/30)*30),'Days') AS [Expiration Duration]

,concat(substring(tmp.errormessage,CharIndex(':',tmp.errormessage)+1,99),' (',tmp.data,' days)') as [Expiration Date]

,c.DetailsUrl as [_linkfor_Expiration Date]

,case when tmp.data<tmp.ThresholdStatisticCritical then '/Orion/images/StatusIcons/Small-Critical.gif'

      when tmp.data<tmp.ThresholdStatisticWarning then '/Orion/images/StatusIcons/Small-Warning.gif'

      else '/Orion/images/StatusIcons/Small-up.gif' end as [_Iconfor_Expiration Date]

from Orion.nodes n

join Orion.APM.Application a on a.NodeID=n.NodeID

join orion.apm.Component c on c.ApplicationID=a.ApplicationID

left join Orion.APM.componenttemplate ct on ct.id = c.templateid

left join Orion.APM.ComponentTemplateSetting cts on cts.componenttemplateid = ct.id and cts.[key] = 'portnumber'

left  join

(SELECT DISTINCT n.caption, n.nodeid, n.Applications.Name, c.Name, c.ComponentID, c.ApplicationID ,c.CurrentStatistics.ComponentStatisticData as [data], c.CurrentStatistics.ErrorMessage, c.ShortName

,c.DetailsUrl,ct.ThresholdStatisticWarning, ct.ThresholdStatisticCritical

from Orion.Nodes n join Orion.APM.Component c on c.ApplicationID=n.Applications.ApplicationID

join orion.APM.ComponentAlertThresholds ct on ct.ComponentID=c.ComponentID

where c.name like  'SSL%') tmp on tmp.applicationid=a.ApplicationID and tmp.nodeid=n.nodeid

where a.ApplicationTemplateID in (SELECT distinct a.ApplicationTemplateID from Orion.APM.Application a

left join Orion.APM.ApplicationTemplate t on t.ApplicationTemplateID=a.ApplicationTemplateID where t.name like '%SSL%')

group by n.Caption, n.nodeid,n.DetailsURL, n.Statusicon, tmp.data, tmp.shortname,tmp.errormessage, cts.Value, c.DetailsUrl, tmp.ThresholdStatisticCritical, tmp.ThresholdStatisticWarning

order by tmp.data asc

 

THanks

Amit


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

$
0
0

Hi Folks

 

Further to my post back in October, I've experienced a recurrence of this issue.

 

Unfortunately this time it impacted our server build process albeit minimally.

 

Previously I had only seen the error while interrogating Orion DB using powershell locally, this time I was using SWQL Studio, developing a query to furnish an alert in SolarWinds.

 

After a couple of hours (first time working with SWQL and the Orion DB) the SWQL console popped up an error message, unfortunately I didn't get a screen grab of it but if someone can point me at a log to look at I'll see if I can retrieve it.

 

At the same time I saw errors from our server build process failing to enroll nodes in SolarWinds, on investigation I discovered it was this same issue

 

+ FullyQualifiedErrorId : Get-SolarWindsNode: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Get-SolarWindsNode is just out wrapper function which is calling Get-SwisData, I tested in powershell console and got the original 'An error occurred when verifying..." etc. message.
This is not an account issue, the server build process uses a service account and had been working for over a month (and continues to work now), SWQL Studio had been logged in using my AD account and had been working for a couple of hours prior to breaking.
I attempted Information Service restart on SolarWinds node but with no success. Also tried to find any specific log or event entries but again with no success
At no point was SolarWinds UI or the monitoring, alerting or add node functionality of it affected.
Next morning, problem had disappeared. All connections available again.
I really need to understand what's happening here, could be an underlying transport issue and nothing to do with Orion SDK but I need to prove it one way or the other.
Any help greatly appreciated.
 

 

Solarwind - HP OBR integration

$
0
0

Hello Experts,

 

we need info about integrating solarwind to HP OBR, we want to achieve performance Data of the server added under SolarWinds to HP OBR.

 

please suggest in any manner can we achieve this .

 

Regards,

Rohit

Custom Poller Assignment

$
0
0

How is the CustomPollerAssignmentID generated?

~Ed

powershell script to search node and delete

$
0
0

Please note that this script was based on this thwack message.

All I did was to change the swsql query used to get the URI and to search and delete a node via PowerShell

 

# This script will search for  node and delete it if exists

#

################################## Attention ###############################################

# You must have Orion SDK installed and set-execution policy must be set to unrestricted!!#

#Before running you must setup your hashed encrypted password using the line below.       #

###########################################################################################

 

#### Prerequisites ###

#  run the line below save credentials to be used by this script on a encrypted file

#GET-CREDENTIAL –Credential "EnterTheOrionUserNamehere” | EXPORT-CLIXML C:\Scripts\SecureCredentialsSAM.xml

## Load the SolarWinds Powershell snapin.

##Needed in order to execute the script.

##Requires the Orion SDK 2.0 installed on the machine this script is running from.

Add-PSSnapinSwisSnapin

# SolarWinds username and password section.

# It is recommended to use a local account create within SAM with only. I strongly recommend that you don't use a MS local account or domain account.

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

#This is using the hashed encrypted password

$MyCredentials=IMPORT-CLIXMLC:\Scripts\SecureCredentialsSam.xml

$ORIONSERVERNAME= 'yourserver.domain.com'

#This is connecting to SAM to pull the info we need need with the info given

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

$nodename=read-host"Enter node Name"

$nodeuri=Get-SwisData$swis"SELECT Uri FROM Orion.Nodes WHERe NodeName LIKE '%$nodename'"

if (!$nodeuri) {Write-Host"node does not exist on SAM"}

if ($nodeuri) {

Write-Host"node exist, uri: $nodeuri"

Remove-SwisObject$swis$nodeUri

Write-Host"node has been removed"

}

VerbArgument Example for 'AddResourceToView'

$
0
0

Hello Thwack Community,

 

Looking to automate the creation of custom query / swql resources. Here is what I have from the Metadata.VerbArgument table in SWQL Studio filtering on the 'AddResourceToView' activity -

 

**REQUIRED - Name: viewID  = ViewID to add resource to - I’m good on this.

 

**REQUIRED -  Name: config = This is what I need Assuming what is needed: PropertyName, PropertyValue

Can someone provide an example string/format/syntax to get me started with creating a resource?

 

Name: moveColliding = Not sure what this does

 

Great Thanks,  =swql

Viewing all 2677 articles
Browse latest View live


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