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

Top 10 Alerting Nodes

$
0
0

Hi,

 

I am looking to retrieve the top 10 alerting nodes (i.e. node 1 had 10 alerts, node 2 had 9 alerts etc.) via the API/SWQL

 

Could anyone assist on how I would go about this?

 

I have been looking at the Orion.AlertStatus table in conjunction with the Orion.AlertObjects table but I'm not convinced the data I'm getting back is correct for my requirements.

 

Regards,

Andrew


Updating account password through API ?

$
0
0

I've been looking at the db structure. According to the Accounts table, there are 2 columns related to the password : "password" and "password-hash"

 

Question : Is the password purely managed by SQL ? if so, how can it be updated ?

 

Otherwise, does the SWIS API can manage account passwords ?

 

I've been looking for a way for users to update their password on Orion, but no luck.


Best regards,

 

 

Luc

Adding node with DNS instead of IP

$
0
0

Searched around the forums and google for a bit and not coming up with an answer as to why this might not be working for me. How do I add nodes that use DHCP instead of a static IP? Below is a snippet of the code i'm using, but when I go into NCM/NPM the node shows as unknown and it's polling IP is always 0.0.0.0. It's like it's not even attempting to resolve the FQDN and start walking the device.

 

    orion_props = {

     'DynamicIP': True,

     'EngineID': 1,

     'ObjectSubType': 'SNMP',

     'SNMPVersion': 2,

     'DNS': device,

     'Community': 'read-only-SNMP',

     'NodeName': device}

 

 

    node_uri = conn.create('Orion.Nodes', **orion_props)

 

 

    # Verify unicode string result return, otherwise there was a problem

    if isinstance(node_uri, dict):

        raise RuntimeError('Node add failed: {0}'.format(node_uri['ExceptionType']))

    else:

        node_id = re.search('(\d+)$', node_uri).group(0)

 

 

    pollers_enabled = {

        'N.Status.ICMP.Native': True,

        'N.Status.SNMP.Native': False,

        'N.ResponseTime.ICMP.Native': True,

        'N.ResponseTime.SNMP.Native': False,

        'N.Details.SNMP.Generic': True,

        'N.Uptime.SNMP.Generic': True,

        'N.Cpu.SNMP.HrProcessorLoad': True,

        'N.Memory.SNMP.NetSnmpReal': True,

        'N.AssetInventory.Snmp.Generic': True,

        'N.Topology_Layer3.SNMP.ipNetToMedia': False,

        'N.Routing.SNMP.Ipv4CidrRoutingTable': False}

 

 

    pollers = []

    for k in pollers_enabled:

        pollers.append({

            'PollerType': k,

            'NetObject': 'N:' + node_id,

            'NetObjectType': 'N',

            'NetObjectID': node_id,

            'Enabled': pollers_enabled[k]})

 

 

    for p in pollers:

        response = conn.create('Orion.Pollers', **p)

        pprint(response)

Add pollers and interfaces via SDK

$
0
0

Howdy,

 

  When we add a node manually via the Orion GUI, setting the interfaces and pollers are steps in the process.

I have been able to script adding nodes, but must then go in to set the poller and interfaces via the GUI.

 

Can someone let me know what to send in order to add these two configurations after adding a new node?

 

 

Please advise,

Kev!

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!

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.

how to input 'y' or 'yes' with powershell script to NCM

$
0
0

Hello, Team

is anybody who can give me an idea how to input the 'yes' or 'y' command when waiting for the user input.

want to automate the Nexus 3048 ios upgrade process with powershell script with NCM.

 

Also, powershell script can apply for multiple devices at the same time for example upgrade 100 devices at the same time for 1 powershell script.

 

for example

Images will be upgraded according to following table:

Module             Image         Running-Version             New-Version  Upg-Required

------  ----------------  ----------------------  ----------------------  ------------

     1            system             6.0(2)U1(2)             6.0(2)U3(1)           yes

     1         kickstart             6.0(2)U1(2)             6.0(2)U3(1)           yes

     1              bios      v1.2.0(08/25/2011)      v1.2.0(08/25/2011)            no

     1         power-seq                    v4.4                    v4.4            no

 

 

Switch will be reloaded for disruptive upgrade.

Do you want to continue with the installation (y/n)?  [n] y   <--- here, how to input 'y' command with powershell script ??

 

Install is in progress, please wait.

Performing runtime checks.

[####################] 100% -- SUCCESS

Setting boot variables.

[####################] 100% -- SUCCESS

Performing configuration copy.

[####################] 100% -- SUCCESS

Finishing the upgrade, switch will reboot in 10 seconds.

as20a.w40216b.x460.krccw#

PowerShell or Python ?

$
0
0

Ive taken a few python classes at school a while back and while I enjoyed it I never used it too much in the real world. From doing research and reading various posts I seem to have this feeling that knowing powershell vs python would put me in a much better position to excel as a SolarWinds admin.  Curious on Tdanners and others thoughts. 


Automatization for add nodes in server.

$
0
0

Guys, I need help for to make the action for my customer.

when he add a server um your enviroment , the orion server identify this server and add a new node.

How we can automatiation this ?

PowerShell or Python ?

$
0
0

Ive taken a few python classes at school a while back and while I enjoyed it I never used it too much in the real world. From doing research and reading various posts I seem to have this feeling that knowing powershell vs python would put me in a much better position to excel as a SolarWinds admin.  Curious on Tdanners and others thoughts. 

Should I use discovery or swis verb to add child objects/pollers to agent based nodes?

$
0
0

We added several hundred agent-based nodes and found our discovery profile with the check for update agents does not get through all of them adding volumes and interfaces- maybe just the first dozen or so.

Knowing we are going to have 1000 agent-based nodes should I try to use a single discovery profile or just script a swis verb API to add items for each?

Is there a swql function to query the database?

$
0
0

Is there a swql function to query the database?

Automatization for add nodes in server.

$
0
0

Guys, I need help for to make the action for my customer.

when he add a server um your enviroment , the orion server identify this server and add a new node.

How we can automatiation this ?

API created ICMP node never gets polled

$
0
0

I'm using PS and the API to add nodes from a CSV, and set custom properties. Here is the content of the CSV:

Code,     Hostname,     IpAddr,          Department,             Env,                  TimeOffset

C1,          DAG01,         10.0.0.1,    Win DBA,                    Testing,            0

C2,          DAG02,         10.0.0.2,     Server Operations,     Production,      0

 

The nodes get created, the custom properties get set, but they are neverpolled and the NodeID is not inserted into the Pollers table. The IP (changed for this thread) is pingable. When I use the GUI "Add Node" and the same IP it gets into the poller table and comes up right away.

What am I missing?

 

Here is the code:

 

#requires -version 2
<#
.SYNOPSIS
This script is used to add a new node using CRUD operations from a CSV file
It adds the node in Alert_Muted_Node = TRUE state
Other customproperties can be set

The script progresses in several steps:
1. Create the node based on caption and IP
1a. Optionally set a trailing caption qualifier
2. Assign ICMP pollers
3. Set custom properties
.DESCRIPTION
Run via SWIS.
.OUTPUTS
None.
.NOTES
Version: 1.0
Author: Michael Landman <Michael.Landman@FirstCitizens.com>
Creation Date: MAR. 01, 2017
Purpose/Change: Initial script development.
#>

#---------------------------------------------------------[Initializations]--------------------------------------------------------

# set error action to silently continue
$ErrorActionPreference = "SilentlyContinue"


#----------------------------------------------------------[Declarations]----------------------------------------------------------

# script version
$scriptVersion = "1.0"

#-------------------------------------------------------------[Init]---------------------------------------------------------------

$hostname = "REDACTED";
$Nodename = @();
$IPAddr = @();
$Dept = @();
$Environ = @();
$TimeO = @();
$customProps = @();
$CaptionQualifier = "";
$PathToFile = "D:\temp\TestClustersIP.csv";
$msg="";
$now = (get-date -Format s);
$outFile = ("d:\temp\$now.AddIcmpNodeSWISlog.txt").Replace(":",".");

#-----------------------------------------------------------[Functions]------------------------------------------------------------

#-----------------------------------------------------------[Execution]------------------------------------------------------------

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

# Connect to SWIS

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

Import-Csv $PathToFile |ForEach-Object {
   $Nodename += $_."Hostname";
   $IPAddr += $_."IpAddr";
            $Dept += $_."Department";
            $Environ += $_."Env";
            $TimeO += $_."TimeOffset";
  }
#$ip = "10.0.0.1"

# add a node
for ($i=0; $i -lt $Nodename.length; $i++)
{
    If($Nodename[$i] -match "sd")
    {
        $CaptionQualifier = "_SqlCluster";
    }
    else
    {
        $CaptionQualifier = "_Cluster";
    }

$newNodeProps = @{
  IPAddress = $IPAddr[$i];
  EngineID = 1;
  ObjectSubType = "ICMP";
  Caption = $Nodename[$i] + $CaptionQualifier;
  # SNMP v2 specific
  #ObjectSubType = "SNMP";

  #SNMPVersion = 2;

  # === 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"];
      
}

# 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

    # set Alert_muted_Node to True and other custom properties

    # prepare a custom property value. These MUST be present or no properties will be set
    $customProps = @{
        Alert_Muted_Node=1;
        Department = $Dept[$i];
        Environment = $Environ[$i];
        TimeOffset=$TimeO[$i];
    }

    # build the node URI
    $uri = "swis://$hostname/Orion/Orion.Nodes/NodeID=$($nodeProps["NodeID"])/CustomProperties";

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

PowerShell Add Server Node - Details

$
0
0

I am playing with the CRUD.AddNode.PS1 Example script to get a Server added to SAM.  I can get my server added but, I am not getting the information in the Node Details pane.

 

I wait for polling to happen, and hit "Poll Now", but the Node Details pane never fills in.  The only way I can get the Node Details to have information is when I goto 'Edit Node" and hit the Test Button in the Polling Method window.

This is what I have for SNMP in CRUD.AddNode.PS1 and this corresponds to whats in the Polling Method window.

# SNMP v2 specific

    ObjectSubType = "SNMP";

    SNMPVersion = 2;

  Community = "mystring";

 

 

 

Thanks for any help.

 

Chris


how to input 'y' or 'yes' with powershell script to NCM

$
0
0

Hello, Team

is anybody who can give me an idea how to input the 'yes' or 'y' command when waiting for the user input.

want to automate the Nexus 3048 ios upgrade process with powershell script with NCM.

 

Also, powershell script can apply for multiple devices at the same time for example upgrade 100 devices at the same time for 1 powershell script.

 

for example

Images will be upgraded according to following table:

Module             Image         Running-Version             New-Version  Upg-Required

------  ----------------  ----------------------  ----------------------  ------------

     1            system             6.0(2)U1(2)             6.0(2)U3(1)           yes

     1         kickstart             6.0(2)U1(2)             6.0(2)U3(1)           yes

     1              bios      v1.2.0(08/25/2011)      v1.2.0(08/25/2011)            no

     1         power-seq                    v4.4                    v4.4            no

 

 

Switch will be reloaded for disruptive upgrade.

Do you want to continue with the installation (y/n)?  [n] y   <--- here, how to input 'y' command with powershell script ??

 

Install is in progress, please wait.

Performing runtime checks.

[####################] 100% -- SUCCESS

Setting boot variables.

[####################] 100% -- SUCCESS

Performing configuration copy.

[####################] 100% -- SUCCESS

Finishing the upgrade, switch will reboot in 10 seconds.

as20a.w40216b.x460.krccw#

Python Add Node Error

$
0
0

I'm getting an error message when I run the following node:

 

===============================================================================================

#!/usr/bin/python

from __future__ import print_function

import re

import requests

from orionsdk import SwisClient

 

def main():

    npm_server = 'SOLARWINDSHOSTNAMEFRONTEND'

    username = 'MYUSERNAME'

    password = 'MYPASSWORD'

 

    swis = SwisClient(npm_server, username, password)

    print("Add an SNMP v3c node:")

 

    # fill these in for the node you want to add!

    ip_address = 'IPADRESSOFTHENEWNODE'

 

    # set up property bag for the new node

    props = {

        'IPAddress': ip_address,

        'EngineID': 2,

        'ObjectSubType': 'SNMP',

        'SNMPVersion': 3,

        'Caption': 'HOSTNAMEOFTHENEWNODE',

        'SNMPV3AuthKey': 'SNMPPASSWORD',

        'SNMPv3AuthKeyIsPwd': True,

        'SNMPv3AuthMethod': 'MD5',

        'SNMPv3PrivKey': 'SNMPPASSWORD',

        'SNMPv3PrivKeyIsPwd': True,

        'SNMPv3PrivMethod': 'DES56',

        'SNMPV3Username': 'SNMPUSER'

    }

 

    print("Adding node {}... ".format(props['IPAddress']), end="")

    results = swis.create('Orion.Nodes', **props)

    print("DONE!")

 

    # extract the nodeID from the result

    nodeid = re.search('(\d+)$', results).group(0)

    print(nodeid)

 

    pollers_enabled = {

        'N.Status.ICMP.Native': True,

        'N.Status.SNMP.Native': False,

        'N.ResponseTime.ICMP.Native': True,

        'N.ResponseTime.SNMP.Native': False,

        'N.Details.SNMP.Generic': True,

        'N.Uptime.SNMP.Generic': True,

        'N.Cpu.SNMP.HrProcessorLoad': True,

        'N.Memory.SNMP.NetSnmpReal': True,

        'N.AssetInventory.Snmp.Generic': True,

        'N.Topology_Layer3.SNMP.ipNetToMedia': False,

        'N.Routing.SNMP.Ipv4CidrRoutingTable': False

    }

 

    pollers = []

    for k in pollers_enabled:

        pollers.append(

            {

                'PollerType': k,

                'NetObject': 'N:' + nodeid,

                'NetObjectType': 'N',

                'NetObjectID': nodeid,

                'Enabled': pollers_enabled[k]

            }

        )

 

    for poller in pollers:

        print("  Adding poller type: {} with status {}... ".format(poller['PollerType'], poller['Enabled']), end="")

        response = swis.create('Orion.Pollers', **poller)

        print("DONE!")

 

    print("Discover and add interfaces:")

    results = swis.invoke('Orion.NPM.Interfaces', 'DiscoverInterfacesOnNode', nodeid)

 

    # use the results['DiscoveredInterfaces'] for all interfaces

    # or get a subset of interfaces using a comprehension like below

    eth_only = [

            x for x

            in results['DiscoveredInterfaces']

            if x['Caption'].startswith('VLAN')]

 

    print(eth_only)

 

    results2 = swis.invoke(

            'Orion.NPM.Interfaces',

            'AddInterfacesOnNode',

            nodeid,

            eth_only,

            'AddDefaultPollers')

 

    print(results2)

 

requests.packages.urllib3.disable_warnings()

 

if __name__ == '__main__':

    main()

===============================================================================================

 

The error is:

 

===============================================================================================

Add an SNMP v3c node:

Adding node IPOFTHEBOX... Traceback (most recent call last):

  File "./prom_add_node2.py", line 112, in <module>

    main()

  File "./prom_add_node2.py", line 39, in main

    results = swis.create('Orion.Nodes', **props)

  File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 34, in create

    "Create/" + entity, properties).json()

  File "/usr/lib/python2.7/site-packages/orionsdk/swisclient.py", line 59, in _req

    resp.raise_for_status()

  File "/usr/lib/python2.7/site-packages/requests/models.py", line 844, in raise_for_status

    raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 400 Client Error: Object reference not set to an instance of an object. for url: https://NAMEOFTHESOLARWINDSSERVER:17778/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes

----------------------------------------------------------------------------------------------------------------------------------------

{"Message":"Invalid SWIS uri at character 18: Incomplete uri. Parser did not finish in End state, but instead was left in Scheme state\u000d\u000aParameter name: uri","ExceptionType":"System.ArgumentException","FullException":"System.ArgumentException: Invalid SWIS uri at character 18: Incomplete uri. Parser did not finish in End state, but instead was left in Scheme state\u000d\u000aParameter name: uri\u000d\u000a at SolarWinds.Data.Utility.SwisUriParser.ParsingError(String message)\u000d\u000a at SolarWinds.Data.Utility.SwisUriParser.ParseInternal()\u000d\u000a at SolarWinds.InformationService.Core.InformationService.Read(String uri)"}

===============================================================================================

 

 

Any thoughts?

python orionsdk.SwisClient.(invoke, update) method examples

$
0
0

Hi,

 

Are there any more examples of using the Orionsdk.SwisClient.invoke( or update) methods than what's at the wiki page for python Orionsdk? I need to push data from an external script into the AlertNote field found in the AlertObjects table so that I can then use the ${N=Alerting;M=Notes} variable in an email alert notification that I send.. It has an association with the AlertActive table and  I see the only verbs to use (I think this is the one) is the AlertActive.AppendNote.  I'm referencing this wiki link where I attempt the syntax:

 

Alerts · solarwinds/OrionSDK Wiki · GitHub

 

aliases = swis.invoke('Orion.AlertActive', 'AppendNote ', value ,'TEST')      # value gets assigned as my AlertObjectID

print(aliases)

 

 

However I can't seem to get it to work.  Here's a Snippet of my results:

 

<type 'list'>

{u'TriggeredDateTime': u'2017-03-04T22:53:36.033', u'AlertNote': u'Hellow', u'TriggeredMessage': u'High CPU Utilization with Top 10 Processes', u'AlertObjectID': 6220, u'RelatedNodeId': 14}

<type 'dict'>

TriggeredDateTime

AlertNote

TriggeredMessage

AlertObjectID

AlertObjectID value is: 6220

RelatedNodeId

 

Traceback (most recent call last):

  File "./check.py", line 67, in <module>

    aliases = swis.invoke('Orion.AlertActive', 'AppendNote ', value,'TEST')

  File "/Library/Python/2.7/site-packages/orionsdk/swisclient.py", line 29, in invoke

    "Invoke/{}/{}".format(entity, verb), args).json()

  File "/Library/Python/2.7/site-packages/orionsdk/swisclient.py", line 59, in _req

    resp.raise_for_status()

  File "/Library/Python/2.7/site-packages/requests/models.py", line 909, in raise_for_status

    raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 400 Client Error: Verb Orion.AlertActive.AppendNote : Not found for url: https://solarwinds-orion:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertActive/AppendNote%20

 

 

 

.......what am I missing??

 

 

Also are is there some 'update' example that's possible for what I'm trying to do??

 

Help on class SwisClient in orionsdk:

 

 

orionsdk.SwisClient = class SwisClient

|  Methods defined here:

|

|  __init__(self, hostname, username, password, verify=False)

|

|  create(self, entity, **properties)

|

|  delete(self, uri)

|

|  invoke(self, entity, verb, *args)

|

|  query(self, query, **params)

|

|  read(self, uri)

|

|  update(self, uri, **properties)

(END)

SWQL how to join multiple custom properties into group reports

$
0
0

Hi guys, just joined the forum.  Been searching on how to get container data to merge in with custom properties table.  I would normally do this on the web report, but I can't link the custom group with node custom properties, but alas, I found swql as a stepping stone.

 

I  have a question on how to  "join" other tables into this query.  Can you direct me on how to add in multiple custom properties tables into this? 

 

Thanks for the support!

 

 

 

select parent_container_name, parent_containerid, child_container_name, child_container_id, c.entityid as nodeid, c.name as caption 

from  ( 

    select c.name as parent_container_name, containerid as parent_containerid, entityid as child_container_id, s.name as child_container_name 

    from orion.containermembersnapshots s 

    inner join orion.container c on c.containerid = s.containerid 

    where s.entitytype = 'orion.groups' 

      ) as p 

left join orion.containermembersnapshots c 

    on p.child_container_id = c.containerid 

where c.entitytype = 'orion.nodes' 

Python command to create dependencies

$
0
0

in a old post found the following command: but what's the existing one please

 

$swis = Connect-Swis -UserName admin -Password ''

 

New-SwisObject $swis Orion.Dependencies @{Name="test1";ParentUri='swis://tdanner-dev.swdev.local/Orion/Orion.Nodes/NodeID=1';ChildUri='swis://tdanner-dev.swdev.local/Orion/Orion.Nodes/NodeID=2'}

Viewing all 3719 articles
Browse latest View live


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