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

How to Start a Windows Service via Alert Action ONLY if the Startup Type is Automatic

$
0
0

So I'm tasked with setting up an alert in Orion that will Start a Down Windows Service but only if the Startup Type of that Service is set to Automatic.

 

I know how to setup a PowerShell script that I can call from the Alert Action and pass the parameters necessary to Start the service.  That isn't my problem.  My problem is how to first query for the Startup Type of that service.  It doesn't look like the standard Windows Component Monitor in SAM captures Startup Type of Services.  I know the Service Control Manager feature does, but I don't know how to tap into that via the API.

 

The possible solutions I can think of are as follows:

- (Least Desired) Create a WMI Script monitor that fetches the startup type of all monitored services on a Windows Node.  I could then query this data for a component via a SWQL query when executing my script.  This would be a total pain, especially considering we have almost a thousand Windows nodes I'd have to apply this to (yeah, I can do it with the new automatic templates assigned to Groups feature, but I really don't want that many more Component Monitors in our environment, we already have SO many.)

- (Also not Desired) Create a library of possible Windows Credentials in my script and call the appropriate one based on what credential is used by the Component Monitor or Node.  This is not ideal because I don't want to have to store all of my credentials in a script, even if I do encrypt the password.

- (Most Desired) Somehow call the Credential object from the SWIS API and pass that to my Get-Service cmdlet.  Not sure if this is possible, but that'd be great if it is.

- (This'll Do) Have my script call the same program that the "Service Control Manager" does in the Orion Web Console and fetch the Startup Type value for the matching service.  Don't know if this is possible either, but this would also be great if it was...

 

 

Can anybody (especially tdanner maybe ) let me know if the bottom two solutions are possible, or maybe if there is another better solution I can't think of?  I really don't want to use my first two options if I can help it.


Executing NCM script with PowerShell

$
0
0

I'm just starting to get my head around the powershell/sdk goodness and have a few queries based on the example here: https://github.com/solarwinds/OrionSDK/blob/master/Samples/PowerShell/NCM.ExecuteScript.ps1.

 

Credentials

 

If I configure the logon as username password :

 

$hostname = "MyOrionServerName"
$username = "MyUSerName"
$plainpass = "MyPlainTextPassword"
$swis = Connect-Swis -v2 -host $hostname -username $username -password $plainpass

 

The script completes and produces the results as expected.

 

However, I'd rather not have plain text username/password combination in my script, so changing to certificate based credentials, and running the script in ISE as administrator:

 

$hostname = "MyOrionServerName"
$username = "MyUSerName"
$swis = Connect-Swis -Certificate

 

I get the error:

 

Invoke-SwisVerb : System.Data.SqlClient.SqlException --> String or binary data would be truncated.
The statement has been terminated.
At C:\scripts\NCM.ps1:45 char:1
+ Invoke-SwisVerb $swis Cirrus.ConfigArchive Execute @($nodeIdList, $script, $user ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

at this:

 

 Invoke-SwisVerb $swis Cirrus.ConfigArchive Execute @($nodeIdList, $script, $username) | Out-Null

 

 

and the job fails to complete.

 

Any input here appreciated.

 

Output

 

I have added the (working) code to a template we have for sending emails.  When the job completes, Write-Host$outputpresents to the debug window nicely formatted text.

 

 

If however I send $output to the email, the text just becomes a single continuous string:

 

I've tried ConvertTo-HTML:

 

$($output | ConvertTo-Html -fragment | out-string)

 

which produces the completely non-helpful:

Now, in all honesty, I'm nowhere near a PowerShell expert, so I'd be gratful for any pointers on what I am (clearly) doing wrong that is stopping the text being a nicely formatted table

 

Thanks

Stuart

error connection when orion script try to connect with server

$
0
0

Hi! I'm doing an automation with python. I do a script that query about existing nodes in orion. This is my script:

 

import requests

from orionsdk import SwisClient

 

npm_server = 'SSS'

orion_user = 'UUU'

orion_pass = 'XXX'

 

verify = False

if not verify:

    from requests.packages.urllib3.exceptions import InsecureRequestWarning

    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

swis = SwisClient(npm_server, orion_user, orion_pass)

print("Query Test:")

orion_res = swis.query("SELECT IP_address FROM Orion.Nodes")

 

orion_list = []

for row in orion_res['results']:

    orion_list.append("{IP_address}".format(**row))

 

print orion_list

 

and this is the error

 

Query Test:

Traceback (most recent call last):

  File "./connect2orion.py", line 18, in <module>

    orion_res = swis.query("SELECT IP_address FROM Orion.Nodes")

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

    {'query': query, 'parameters': params}).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 837, in raise_for_status

    raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://serverXXX:portXXX/SolarWinds/InformationService/v3/Json/Query

 

I try to do a ping and telnet with the server and i could connect correctly

SwisPowerShell from within SAM template/Component?

$
0
0

I'm trying to have a script that runs regularly and updates the custom properties on a node based on the other results in that script.

 

I have installed the module on the SolarWinds app server and am able to import it and run SWIS-type commands using the PowerShell ISE on the server.

 

However, when I build a template and app monitor with that script as a component, it says there was no module found named SwisPowerShell in any module directory. Is there a fix for this so I can use the API from within SAM?

 

Nathan Hejnicki

Loop1 Systems

Python - listing/adding resources to agent polled node

$
0
0

Hi Everyone,

 

We have a vm template that has the agent installed on the system already. Once a system is provisioned,  our C.M. activates the agent and it shows up in Orion but with no resources listed.

 

I am trying to figure out how to perform the same functions as list resources would, from research I am guessing I would have to do a discovery on the node but everything is based on SNMP that I see. End goal is being able to programmatically add/remove resources ( volumes, interfaces, cpu/mem) for a agent polled node thats already in Orion. 

 

Thanks for any help.

Help: How to enable Dynamic IP Address (DHCP or BOOTP) and assign a DNS Hostname through API

$
0
0

Hi, I can add node to SolarWinds perfectly, but I have some nodes need to enable DHCP option with DNS hostname.

 

I tried to use 'DynamicIP': 1, but it return an error.

 

Below is my code.

results = addNode(swis)

 

def addNode(s):

    print "Adding Node...",

    node_props = {

        'IPAddress': node_ip_address,

        'EngineID':    1,

        'ObjectSubType': 'SNMP',

        'Status': 1,

        'SNMPVersion':    2,

        'Community': node_community,

        'Caption': node_name,

        'AgentPort': node_snmp_port,

    }

    res = s.create('Orion.Nodes', **node_props)

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

    print " Done!"

    print "  Node ID: " + nodeid

    for n in node_props:

        print " ", n,": ",node_props[n]

    return res

has anyone automated changing DB password with PowerShell script instead of using configuration wizard?

$
0
0

We have to change the password for DB user every 42 days and would like a way to automate it. We currently use SecretServer to store our passwords and it has the capability to enlist powershell scripts to update applications with the new password after SecretServer changes it. Has anyone created a script that can automate the password change for the SolarWinds DB password?

Automation of adding nodes into Solarwinds

$
0
0

Hi All

 

We are looking at using Chef to automate server deployment and part of this work would be:

 

1. Lookup in IPAM the next available address in a subnet, reserve it and add the hostname to the reservation

2. Chef passes a name/IP and node creation (and possible node type or template name) request to Solarwinds for monitoring

3. Solarwinds adds the above node and enables a predefined set of base monitors.

 

The next parts are to do with Chef running scripts to talk to Solarwind

  1. 1.       Chef sends a script to disable monitoring of an existing node
  2. 2.       Chef sends a script to enable monitoring of an existing node
  3. 3.       Chef sends a script to delete an existing node

 

If anyone has any automation style scripts they can share, or any pitfalls to avoid when doing this work I would appreciate any input

 

 

Thanks

 

Simon

 


Check node status in Powershell

$
0
0

Hello everyone,

 

Been browsing for a bit and this is a great community. I have a quick question. I have created scripts to Unmange/Remanage nodes using Powershell and am curious if there is a way to have the script continuously check the node status to confirm if it's down/up. I read an older topic which dictated that this is not possible to do if you use powershell to remotely manage nodes, is this still the case?

 

Any help is greatly appreciated.

SWQL Volumes Forecast Capacity Table A and B Columns

$
0
0

Math is not my strength, that's for sure.  For the life of me I can not figure out what the Aavg/Apeak and Bavg/Bpeak columns in the SWQL Entity/Table Orion.VolumesForecastCapacity are.  I've got several ideas of what they could be, but I'm just not sure.  Can somebody explain what these are so my feeble brain will understand them?  Thank you.

 

EDIT: OK, I think I've figured out (well, my co-worker mostly figured it out).  The Bavg appears to be the percent growth per day from the MinDateTime to the MaxDateTime (180 Days by default, unless the Volume was added to Orion less than 180 days ago).  The Aavg I'm still a little fuzzy about, but I think it is the avg utilization over the number of days between the MinDateTime and MaxDateTime.  So if the CurrentValue and Aavg have a big difference between them, that indicates a large change in volume size over the sample period (that, and the Bavg will show a larger percent growth per day), whereas if the Aavg is very close to the CurrentValue, then that shows it hasn't changed size much (and of course, the Bavg will be very small as well).  I'm not sure how the Aavg helps, since the Bavg seems to be the most useful piece of data to me, but I'm sure it has its use or they wouldn't have it in the table. 

 

If I'm incorrect or anything, please let me know.  Also, if you want to look at how this is done yourself, check out the Stored Procedure in the Orion SQL Database called: VolumeUsage_ForecastCoefficients.  It has all of the calculations they use to manipulate the VolumeUsage statistics and calculate the Forecast data.

 

Query runs forever until server runs out of resources

$
0
0

I am attempting to run the following query using the SWIS powershell module and when I execute the script it runs for seemingly forever until my primary poller runs out of RAM.

 

SELECT TOP 1 ApplicationID, AdvancedApplicationID, Bytes, DestinationASID, DestinationCountryCode, DestinationDomain, DestinationHostname, DestinationIP, DestinationIPGroupSegmentID, InterfaceIDRx, InterfaceIDTx, NodeID, Packets, Port, ProtocolID, SourceASID, SourceCountryCode, SourceDomain, SourceHostname, SourceIP, SourceIPGroupSegmentID, TimeStamp, ToSID, ObservationTimestamp, Description, IngressBytes, EgressBytes, IngressPackets, EgressPackets, TotalBytes, TotalPackets, EnabledApplicationID, ApplicationEnabled FROM Orion.Netflow.FlowsByConversation

 

The InformationService.log and InformationServicev3.log show no errors around execution time.

 

It would be my guess that this should only run for a few seconds not 3 hours then crash. I even tried only to return the NodeID with this query and still the same issue.

 

Does anyone have any insight into what may be going on?

[python] subnet CRUD operations problem

$
0
0

Hi,

 

I'm trying to update the 'Comments' property on an already existing subnet using the orionsdk python 'update()' method, but it fails miserably (see code below).

What on earth am I doing wrong?

Also, I am trying to figure out if it is possible to create supernets or subnets within an already existing supernet using the Orion API?

 

Any help would be very much appreciated.

 

/BR, Espen

 

My python test code looks like this:

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

import orionsdk

swis = orionsdk.SwisClient('hostname', user, passwd)

uri = 'swis://localhost/Orion/IPAM.Subnet/SubnetId=6244,ParentId=109'

comments = 'MY-TEST-COMMENT'

swis.update(uri, Comments=comments)

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

 

API responds with this error (running inside ipython):

 

In [51]: swis.update(uri, Comments=comments)

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

HTTPError                                 Traceback (most recent call last)

<ipython-input-55-133cfe3d54f8> in <module>()

----> 1 swis.update(uri, Comments=comments)

 

 

/home/eto/dev/venv-orionsdk/lib/python2.7/site-packages/orionsdk/swisclient.pyc in update(self, uri, **properties)

     38

     39     def update(self, uri, **properties):

---> 40         self._req("POST", uri, properties)

     41

     42     def delete(self, uri):

 

 

/home/eto/dev/venv-orionsdk/lib/python2.7/site-packages/orionsdk/swisclient.pyc in _req(self, method, frag, data)

     57                 pass;

     58

---> 59         resp.raise_for_status()

     60         return resp

 

 

/home/eto/dev/venv-orionsdk/lib/python2.7/site-packages/requests/models.pyc in raise_for_status(self)

    933

    934         if http_error_msg:

--> 935             raise HTTPError(http_error_msg, response=self)

    936

    937     def close(self):

 

 

HTTPError: 400 Client Error: The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request. for url: https://hostname:17778/SolarWinds/InformationService/v3/Json/swis://localhost/Orion/IPAM.Subnet/SubnetId=6244,ParentId=109

 

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

NPM

$
0
0

why can't i go to the node details page when i click on the node? when i click on the node for node details, it takes me back to the homepage.

 

please any urgent help.

Invoke-SwisVerb - Access Denied

$
0
0

I was advised by SolarWinds support to post a question on the community forms.  I am trying to run the below command and receive access is denied errors.  The account is a full admin on the server and in the IPAM application.  Any help would be greatly appreciated.

 

'Invoke-SwisVerb $swis IPAM.SubnetManagement GetFirstAvailableIp @("10.99.99.0", "24")'. 

 

using OrionSDK with jython

$
0
0

Hello,

I want to create an integration with HP's ucmdb so I need to code my discovery with jython, which is basically the same as python.

I cannot find any version requirements for the Orion python sdk,

what is the oldest python version that supports the python sdk ?

 

thanks

David.


error connection when orion script try to connect with server

$
0
0

Hi! I'm doing an automation with python. I do a script that query about existing nodes in orion. This is my script:

 

import requests

from orionsdk import SwisClient

 

npm_server = 'SSS'

orion_user = 'UUU'

orion_pass = 'XXX'

 

verify = False

if not verify:

    from requests.packages.urllib3.exceptions import InsecureRequestWarning

    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

swis = SwisClient(npm_server, orion_user, orion_pass)

print("Query Test:")

orion_res = swis.query("SELECT IP_address FROM Orion.Nodes")

 

orion_list = []

for row in orion_res['results']:

    orion_list.append("{IP_address}".format(**row))

 

print orion_list

 

and this is the error

 

Query Test:

Traceback (most recent call last):

  File "./connect2orion.py", line 18, in <module>

    orion_res = swis.query("SELECT IP_address FROM Orion.Nodes")

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

    {'query': query, 'parameters': params}).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 837, in raise_for_status

    raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://serverXXX:portXXX/SolarWinds/InformationService/v3/Json/Query

 

I try to do a ping and telnet with the server and i could connect correctly

Can I add new node with api rest?

$
0
0

Hi I want to add new nodes into Orion but I don't know if I can do this with Rest API. Is posible do this?

API Network Discovery

$
0
0

Following the instructions on GitHub (Discovery · solarwinds/OrionSDK Wiki · GitHub ) I am attempting to create a very basic network scan where IP address's between 10.X.0.1-10.X.31.254 are scanned with the credential ID's provided.   I am assuming the 3 separate plugin configuration are all actually part of the same script ?  Assuming this is correct, when I run the script now, the system is expecting an argument at the line below

 

#Error expecting argument

PS C:\Users\nsd000.QACMA> C:\Users\nsd000.QACMA\Documents\PowerShell Scripts\Do not Modify\Discovery.ps1

 

cmdlet Invoke-SwisVerb at command pipeline position 1

 

Supply values for the following parameters:

 

Arguments[0]:

 

Invoke-SwisVerb : Verb Orion.NPM.Interfaces.CreateInterfacesPluginConfiguration requires 1 parameters not 0

 

At C:\Discovery.ps1:73 char:34

 

+ $InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces Crea ...

 

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

 

    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

 

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

 

 

 

#The error above is referencing the line directly below

$InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

 

#Complete Script Below, Everything above this line is describing the problem

#CONNECTION TO SWIS

$ErrorActionPreference = 'Stop'

#Add the snapin
Add-PSSnapin SwisSnapin

#create a connection to solarwinds

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

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

 

 

#Core Plugin Configuration

$CorePluginConfigurationContext = ([xml]"
<CorePluginConfigurationContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
        <IpAddressRange>
            <StartAddress>10.X.0.1</StartAddress>
            <EndAddress>10.X.31.254</EndAddress>
        </IpAddressRange>
    <Credentials>
        <SharedCredentialInfo>
            <CredentialID></CredentialID>
            <CredentialID>1</CredentialID>
         <CredentialID>2</CredentialID>
         <CredentialID>11</CredentialID>
            <CredentialID>13</CredentialID>
            <CredentialID>20</CredentialID>
            <CredentialID>21</CredentialID>
         <CredentialID>47</CredentialID>
         <CredentialID>71</CredentialID>
            <CredentialID>89</CredentialID>
            <CredentialID>110</CredentialID>
            <CredentialID>156</CredentialID>
            <CredentialID>163</CredentialID>
            <CredentialID>170</CredentialID>
         <CredentialID>197</CredentialID>
            <CredentialID>198</CredentialID>
            <CredentialID>202</CredentialID>
            <Order>1</Order>
        </SharedCredentialInfo>
    </Credentials>
    <WmiRetriesCount>1</WmiRetriesCount>
    <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>
</CorePluginConfigurationContext>
").DocumentElement

 

#Interface Plugin Configuration

$CorePluginConfiguration = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($CorePluginConfigurationContext

$InterfacesPluginConfigurationContext = ([xml]"
<InterfacesDiscoveryPluginContext xmlns='http://schemas.solarwinds.com/2008/Interfaces'
                                  xmlns:a='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
    <AutoImportStatus>
        <a:string>Up</a:string>
        <a:string>Down</a:string>
        <a:string>Shutdown</a:string>
    </AutoImportStatus>
    <AutoImportVirtualTypes>
        <a:string>Virtual</a:string>
        <a:string>Physical</a:string>
    </AutoImportVirtualTypes>
    <AutoImportVlanPortTypes>
        <a:string>Trunk</a:string>
        <a:string>Access</a:string>
        <a:string>Unknown</a:string>
    </AutoImportVlanPortTypes>
    <UseDefaults>false</UseDefaults>
</InterfacesDiscoveryPluginContext>
").DocumentElement

$InterfacesPluginConfiguration = Invoke-SwisVerb $swis Orion.NPM.Interfaces CreateInterfacesPluginConfiguration

 

#Discovery Plugin Configuration

$EngineID = 1
$DeleteProfileAfterDiscoveryCompletes = "false"

$StartDiscoveryContext = ([xml]"
<StartDiscoveryContext xmlns='http://schemas.solarwinds.com/2012/Orion/Core' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
    <Name>Script Discovery $([DateTime]::Now)</Name>
    <EngineId>$EngineID</EngineId>
    <JobTimeoutSeconds>3600</JobTimeoutSeconds>
    <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>
    <SnmpTimeoutMiliseconds>2000</SnmpTimeoutMiliseconds>
    <SnmpRetries>1</SnmpRetries>
    <RepeatIntervalMiliseconds>1500</RepeatIntervalMiliseconds>
    <SnmpPort>161</SnmpPort>
    <HopCount>0</HopCount>
    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>
    <DisableIcmp>false</DisableIcmp>
    <AllowDuplicateNodes>false</AllowDuplicateNodes>
    <IsAutoImport>true</IsAutoImport>
    <IsHidden>$DeleteProfileAfterDiscoveryCompletes</IsHidden>
    <PluginConfigurations>
        <PluginConfiguration>
            <PluginConfigurationItem>$($CorePluginConfiguration.InnerXml)</PluginConfigurationItem>
            <PluginConfigurationItem>$($InterfacesPluginConfiguration.InnerXml)</PluginConfigurationItem>
        </PluginConfiguration>
    </PluginConfigurations>
</StartDiscoveryContext>
").DocumentElement)

 

#Running The Discovery ( I get the error noted at the top regardless of the line below.  To be honest, I guessed this would be at the bottom of the script.

$DiscoveryProfileID = (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($StartDiscoveryContext)).InnerText

SWQL Query to select only records with latest timestamp

$
0
0

So I am trying to write an SWQL query that shows me all nodes that are unmanaged with some extra information tagged in, like Who unmanaged the node and When.  OK, I wrote a nice little SWQL query like this:

 

SELECT DISTINCT N.Caption AS NodeCaption, N.ChildStatus AS ChildStatus, N.Status AS NodeStatus, ToLocal(N.UnmanageFrom) AS UnManageFrom, ToLocal(N.UnmanageUntil) AS UnManageUntil, ToLocal(AE.ObservationTimestamp) AS UnManagedWhen, AE.AccountID AS Who

FROM Orion.Nodes N

LEFT OUTER JOIN Orion.AuditingEvents AS AE

   ON AE.AuditEventMessage LIKE CONCAT ('% unmanaged node ', N.Caption, '.')

INNER JOIN Orion.AuditingActionTypes AS AT

   ON AE.ActionTypeID = AT.ActionTypeID

WHERE ((N.Unmanaged = 'True' OR N.UnmanageFrom >= GetUtcDate())

AND AT.ActionTypeDisplayName LIKE '%Node unmanaged%')

GROUP BY N.Caption, N.ChildStatus, N.Status, N.UnmanageFrom, N.UnmanageUntil, AE.ObservationTimestamp, Who

ORDER BY N.Caption ASC, UnManagedWhen DESC

 

 

That works great but I am getting multiple entries for nodes which have been managed/unmanaged multiple times in past.  OK, so I rewrote the query slightly like this;

 

SELECT DISTINCT N.Caption AS NodeCaption, N.ChildStatus AS ChildStatus, N.Status AS NodeStatus, ToLocal(N.UnmanageFrom) AS UnManageFrom, ToLocal(N.UnmanageUntil) AS UnManageUntil, MAX(ToLocal(AE.ObservationTimestamp)) AS UnManagedWhen, AE.AccountID AS Who

FROM Orion.Nodes N

LEFT OUTER JOIN Orion.AuditingEvents AS AE

   ON AE.AuditEventMessage LIKE CONCAT ('% unmanaged node ', N.Caption, '.')

INNER JOIN Orion.AuditingActionTypes AS AT

   ON AE.ActionTypeID = AT.ActionTypeID

WHERE ((N.Unmanaged = 'True' OR N.UnmanageFrom >= GetUtcDate())

AND AT.ActionTypeDisplayName LIKE '%Node unmanaged%')

GROUP BY N.Caption, N.ChildStatus, N.Status, N.UnmanageFrom, N.UnmanageUntil, Who

ORDER BY N.Caption ASC, UnManagedWhen DESC

 

Well, that's pretty close to what I want but I still see that there are multiple entries for nodes which had had different users (AccountID) doing manage/unmanage.  If the user was the same, all duplicates disappear and I get what I want.   How do I further filter out results so I get the listing of all nodes that are currently unmanaged but I only get listing of the LATEST occurrence when this unmanaging happened and the user who did that.

Thanks.

Update Alert Notes via SDK

$
0
0

Ahoy,

I am trying to figure out how I can update an alert's note via the SDK and I'm not having much luck getting it done. I am trying to integrate a specific alert with our ticket system so that when a ticket is opened on this specific alert, the ticket system performs an HTTP POST to Orion to post the ticket ID into the alert notes. Now, I know that there seem to be two types of 'notes' in alerts - the view in the database shows 'Notes' and 'AlertNotes'. I want to be able to overwrite whatever is in the 'Notes' column with just the 6-digit ticket ID. Here is what I have so far:

 

I copied a previously configured POST update from my ticket system which updates some custom properties, but replaced the SWIS URL with what I thought was the right schema. As a test, I am using cURL on a server to make the POST:

 

curl -v -X POST -H "Content-Type: application/json" -k -u user:pass -d '{"Notes":"123456"}' https://orion-server:17778/SolarWinds/InformationService/v3/Json/swis://orion-server/Orion/Orion.AlertStatus/AlertObjectID=7849

 

This is the error that I get back:

 

{"Message":"Invalid key properties specified for entity Orion.AlertStatus.\u000d\u000aParameter name: filter","ExceptionType":"System.ArgumentException","FullException":"System.ArgumentException: Invalid key properties specified for entity Orion.AlertStatus.\u000d\u000aParameter name: filter\u000d\u000a   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveFilter(IEntityType entity, SwisUriFilter filter, Boolean isHosted)\u000d\u000a   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveUri(SwisUri uri, IQueryExecutionContext context)\u000d\u000a   at SolarWinds.InformationService.Core.SwisUriResolver.GetResolver(SwisUri uri, Boolean queryKeysOnly, IQueryProcessor queryProcessor, IQueryPlanCache queryPlanCache, IQueryExecutionContext context)\u000d\u000a   at SolarWinds.InformationService.Core.CrudProcessor.Update(SwisUri uri, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)\u000d\u000a   at SolarWinds.InformationService.Core.InformationService.Update(S*

 

I am not sure what this all means. Any assistance understanding will be much appreciated.

Viewing all 2677 articles
Browse latest View live


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