Impossible to create Orion objects through API (PowerShell SWIS or REST API)

Hello,

I need to create and manage Orion objects (example API Poller) through API (Powershell Swis or REST API). My problem is the lack of documentation provided by Solarwinds. Could you please help me on this topic or tell me if this topic is not possible due to a product limitation ?

Thank you in advance for your help and have a nice day

Regards

Parents
  • Hello,

    Is certainly possible to create and manage objects using the Orion API. As a start, I would recommend these sources to get a better understanding of the API

    https://www.youtube.com/watch?v=8pTQo8Oqk8c

    https://thwack.solarwinds.com/resources/b/product-blog/posts/intro-to-api-sdk-swql

    Although I have not used the API specifically for the purposed of creating API pollers, when I look at the entity documentation in SWQL studio it should be possible as The entity support CRUD opreations 

    Can you elaborate a little more on what exactly you want to achieve for managing these?

  • Hello Tony,

    Thank you for your feedback. I have read the provided url but this url mainly talk about getting info from Orion using API

    The only examples/explanations I have found on how to set some data are described here:

    -https://github.com/solarwinds/OrionSDK/wiki/Creating-Custom-Properties

    -https://github.com/solarwinds/OrionSDK/wiki/Managing-Custom-Properties

    Regarding swql, the following link https://github.com/solarwinds/OrionSDK/wiki/SWQL-Functions is talking about returning data and not how to push data in the database

    I will try to explain my need:

    I want to use Orion API or a non-UI way to setup a new API poller:

    I hope it is more clear. Thank you in advance for your help

    Regards

  • Hi  Thank you for the example, it helped me a lot.

    I am in the same Nicolas situation. Did you happen to know the tables that we should insert the data following this workflow? Which tables are going to be updated automatically?

    I am not sure if Orion.APIPoller.ApiPoller table should have anything to do with the workflow. So, the main goal is to know which tables have to be updated with the new information on the API Pollers.

    For now I have inserted new data into Orion.APIPoller.RequestDetails and Orion.APIPoller.PollingConfiguration where the ApiPollerId value matches in both tables.

    What about Orion.APIPoller.ApiPoller table? Does it get updated the first time a Polling is done?

    Thank you!

  • Hello Tony,

    Thank you for the useful info. I have tested successfully your example in my environment in the specific table.

    Unfortunately, this table is not the only one to configure properly an API Poller. When I try to set also the table APIPoller.ApiPoller with the following code I receive an error message:

    $OrionAPIPoller = @{
        Description = "apipoller_desc";
        DetailsUrl = "/Orion/View.aspx?NetObject=OAPI:17";
        DisplayName = "apipoller_dn";
        Name = "apipoller_name";
        RelatedEntityId = 877;
        RelatedEntityType = "Orion.Nodes";
    
    }
    $NewOrionAPIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoller" -Properties $OrionAPIPoller
    

    The error message:

    New-SwisObject : Property Description of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:34 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject

    The error is similar when I try to do the same using the SWQL studio. And again no documentation found on that topic : no table schema, no creation rule or requirement, no examples.

    Thank you in advance for your patience and your help.

    Have a nice day

    Regards

  • Seems like you can't set any value to the column Description. Try removing that property from your JSON.

    UPDATE: I have tested and seems like that table will be automatically updated by Solarwinds when a polling is triggered

  • Hello Mulambo,

    I have tried unsuccessfully to remove info from the JSON for the different variables but I receive the same kind of error message:

    New-SwisObject : Property Description of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:34 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    
    ---
    
    New-SwisObject : Property DetailsUrl of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:33 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    
    ---
    
    New-SwisObject : Property DisplayName of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:32 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    

    I don't understand also your update : which table you are talking about ? Did you create something using the webUI or did you use exclusively powershell ? Thank you

  • I tried to create a record on the table Orion.APIPoller.ApiPoller  by using PowerShell and it can't be done. Seems like that table can't be modified by a 3rd party app via APIs through CRUD operations. 

  • Exactly... but SWQL indicates the opposite:

    If the documentation is resumed by the red square in the screenshot it is a shame for a paid product like Orion... I'm very disappointed. And a bit angry because the Solarwinds support do not help me except tolding me to grab info in this forum

  • Possibly, or incorrect documentation. I have opened a case to look into it in more detail

  • Hi

    I found that there is another table that can't be object of CRUD operations although the documentation says any CRUD is allowed.

    When I try to create a record on the Orion.APIPoller.ValueToMonitor table I receive this error in PowerShell:


           $ValueToMonitor = @{
           ApiPollerId = $Queryresult+1;
           StatusDescription = "Up";
           Metric = $Metric;
           Status = 1;
           DetailsUrl = $pivote;
           StringToNumberTransformationOtherValues = 0;
           Type = $Path;
           ThresholdRule = $ThresholdRule;
           CriticalThreshold = $CriticalThreshold;
           WarningThreshold = $WarningThreshold;
           Path = $Path;
           DisplayName = $DisplayName;
           RequestIdDetails = $Queryresult;
           }
    
    $NewOrionAPIPollerInfo = New-SwisObject $swis -EntityType "Orion.APIPoller.ValueToMonitor" -Properties $ValueToMonitor
    
    
    New-SwisObject : Property DetailsUrl of entity type Orion.APIPoller.ValueToMonitor is a computed property and cannot be set during
    Create.
    At C:\Users\chacongj\Documents\Test scripts\PowerShell\Test_API_Poller.ps1:158 char:30
    + ... ollerInfo = New-SwisObject $swis -EntityType "Orion.APIPoller.ValueTo ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [New-SwisObject], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject

    Questions:

    (1) Did you receive any feedback about these issues?

    (2) Do you know what exactly should be the flow to create polling data within these tables via CRUD operations?

  • Hello Tony,

    Do you have received any feedback from your open incident ?

    For info I have also contacted the support team for that issue.

    Have a nice day

    Regards

Reply Children
No Data