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

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)


Viewing all articles
Browse latest Browse all 3719

Trending Articles



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